perf/x86/intel/uncore: Fix minor race in box set up
authorAndi Kleen <ak@linux.intel.com>
Mon, 22 Sep 2014 22:27:06 +0000 (15:27 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 3 Oct 2014 04:02:49 +0000 (06:02 +0200)
commit4f971248bc6ad2bb2a89a25a072ebfec5757d298
tree0b3282180645dc7e7c9010e3c55b0721f9350d9c
parent69e8f5b15ef43da1e177665a3e2063711ee4c9de
perf/x86/intel/uncore: Fix minor race in box set up

I was looking for the trinity oops cause in the uncore driver.
(so far didn't found it)

However I found this tiny race: when a box is set up two threads on the
same CPU, they may be setting up the box in parallel (e.g. with kernel
preemption). This could lead to the reference count being increasing
too much. Always recheck there is no existing cpu reference inside the lock.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: eranian@google.com
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Link: http://lkml.kernel.org/r/1411424826-15629-1-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/cpu/perf_event_intel_uncore.c