> From: Tomasz Duszynski [mailto:tduszyn...@marvell.com] > Sent: Thursday, 26 January 2023 16.28 > > >From: Bruce Richardson <bruce.richard...@intel.com> > >Sent: Thursday, January 26, 2023 1:59 PM > > > >Other possible complication is - how does this work with threads that > are not pinned to a > >particular physical core? Do things work as expected in that case? > > > > It's assumed that once set of counters is enabled on particular l-core > then this thread shouldn't be migrating > back and for the obvious reasons. > > But, once scheduled elsewhere all should still work as expected.
Just to elaborate what Tomasz stated here... The patch contains this line (code comments are mine): return syscall(SYS_perf_event_open, &attr, /*pid*/ 0, /*cpu*/ -1, group_fd, 0); And man 2 perf_event_open [1] says: pid == 0 and cpu == -1: This measures the calling process/thread on any CPU. So it should work just fine, even when a thread is not pinned to a particular physical core. [1]: https://man7.org/linux/man-pages/man2/perf_event_open.2.html