powerpc/perf: Implement a global lock to avoid races between trace, core and thread...
authorAnju T Sudhakar <anju@linux.vnet.ibm.com>
Fri, 13 Mar 2020 05:52:37 +0000 (11:22 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 Apr 2020 13:09:58 +0000 (00:09 +1100)
commita36e8ba60b991d563677227f172db69e030797e6
tree3de5db9eb9e0c60f19f57ef44eadc3d74afc5264
parenta95a0a1654f16366360399574e10efd87e867b39
powerpc/perf: Implement a global lock to avoid races between trace, core and thread imc events.

IMC(In-memory Collection Counters) does performance monitoring in
two different modes, i.e accumulation mode(core-imc and thread-imc events),
and trace mode(trace-imc events). A cpu thread can either be in
accumulation-mode or trace-mode at a time and this is done via the LDBAR
register in POWER architecture. The current design does not address the
races between thread-imc and trace-imc events.

Patch implements a global id and lock to avoid the races between
core, trace and thread imc events. With this global id-lock
implementation, the system can either run core, thread or trace imc
events at a time. i.e. to run any core-imc events, thread/trace imc events
should not be enabled/monitored.

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200313055238.8656-1-anju@linux.vnet.ibm.com
arch/powerpc/perf/imc-pmu.c