]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sparc64: Fix the watchdog corrupting performance counters
authorDave Aldridge <david.j.aldridge@oracle.com>
Fri, 24 Jun 2016 13:17:25 +0000 (06:17 -0700)
committerAllen Pais <allen.pais@oracle.com>
Sun, 22 Jan 2017 15:38:10 +0000 (21:08 +0530)
commit8b28df9930252181c8acb43fe8a8f1e6274cd03a
tree739299b115c18bce5de7706e21c0f516412c0c82
parentc9750824ff585fdb8519bdb14f432d15463b919d
sparc64: Fix the watchdog corrupting performance counters

There is a race condition in the perf_event_grab_pmc() which
means that we do not increment the active_events count correctly
when a new event is added. Ultimately, we end up with a negative
value for the active_event count. This means that the next time
we try and add a new event the watchdog will not be stopped
correctly and corruption of the performance count will
be observed.

Note: In sparc64 land the watchdog is implemented using one
of the performance counters.

This issue is fixed by moving the mutex lock to make
sure it encompasses the whole critical section in the
perf_event_grab_pmc().

Orabug: 23106709

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
(cherry picked from commit 54ed00318fec5db3fab1b035ade5d95926d84799)
(cherry picked from commit d9ad125578c9f2fa015beb9dc10bd3d1eb9004ec)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/kernel/perf_event.c