WSL2-Linux-Kernel/arch
Kan Liang e4557c1a46 perf/x86/intel: Fix spurious NMI on fixed counter
If a user first sample a PEBS event on a fixed counter, then sample a
non-PEBS event on the same fixed counter on Icelake, it will trigger
spurious NMI. For example:

  perf record -e 'cycles:p' -a
  perf record -e 'cycles' -a

The error message for spurious NMI:

  [June 21 15:38] Uhhuh. NMI received for unknown reason 30 on CPU 2.
  [    +0.000000] Do you have a strange power saving mode enabled?
  [    +0.000000] Dazed and confused, but trying to continue

The bug was introduced by the following commit:

  commit 6f55967ad9 ("perf/x86/intel: Fix race in intel_pmu_disable_event()")

The commit moves the intel_pmu_pebs_disable() after intel_pmu_disable_fixed(),
which returns immediately.  The related bit of PEBS_ENABLE MSR will never be
cleared for the fixed counter. Then a non-PEBS event runs on the fixed counter,
but the bit on PEBS_ENABLE is still set, which triggers spurious NMIs.

Check and disable PEBS for fixed counters after intel_pmu_disable_fixed().

Reported-by: Yi, Ammy <ammy.yi@intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: <stable@vger.kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 6f55967ad9 ("perf/x86/intel: Fix race in intel_pmu_disable_event()")
Link: https://lkml.kernel.org/r/20190625142135.22112-1-kan.liang@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2019-07-13 11:21:29 +02:00
..
alpha alpha: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
arc
arm Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00
arm64 arm64: move jump_label_init() before parse_early_param() 2019-07-12 11:05:46 -07:00
c6x Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2019-07-10 21:42:03 -07:00
csky csky: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
h8300 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2019-07-10 21:42:03 -07:00
hexagon
ia64 TTY / Serial driver updates for 5.3-rc1 2019-07-11 15:38:21 -07:00
m68k Merge branch 'akpm' (patches from Andrew) 2019-07-12 11:40:28 -07:00
microblaze clone3-v5.3 2019-07-11 10:09:44 -07:00
mips mips: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
nds32 nds32: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
nios2 nios2: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
openrisc
parisc parisc: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
powerpc Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00
riscv riscv: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
s390 mm: rename CONFIG_HAVE_GENERIC_GUP to CONFIG_HAVE_FAST_GUP 2019-07-12 11:05:44 -07:00
sh Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00
sparc mm: rename CONFIG_HAVE_GENERIC_GUP to CONFIG_HAVE_FAST_GUP 2019-07-12 11:05:44 -07:00
um um: switch to generic version of pte allocation 2019-07-12 11:05:45 -07:00
unicore32 unicore32: switch to generic version of pte allocation 2019-07-12 11:05:46 -07:00
x86 perf/x86/intel: Fix spurious NMI on fixed counter 2019-07-13 11:21:29 +02:00
xtensa clone3-v5.3 2019-07-11 10:09:44 -07:00
.gitignore
Kconfig