perf/x86/ibs: Fix race with IBS_STARTING state
authorPeter Zijlstra <[email protected]>
Wed, 16 Mar 2016 22:55:21 +0000 (23:55 +0100)
committerIngo Molnar <[email protected]>
Mon, 21 Mar 2016 08:08:15 +0000 (09:08 +0100)
commit5a50f52917011365a4a2c0f1d2cea0990c4465cd
tree35a40bdf23e947e83caa3ebb5d3948e3ff72e69c
parent0158b83f7508851cda9e62c4b14678c5bd492cb2
perf/x86/ibs: Fix race with IBS_STARTING state

While tracing the IBS bits I saw the NMI hitting between clearing
IBS_STARTING and the actual MSR writes to disable the counter.

Since IBS_STARTING was cleared, the handler assumed these were spurious
NMIs and because STOPPING wasn't set yet either, insta-triggered an
"Unknown NMI".

Cure this by clearing IBS_STARTING after disabling the hardware.

Tested-by: Borislav Petkov <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Vince Weaver <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/events/amd/ibs.c