linux-stable/arch/x86
Peter Zijlstra 75f80859b1 perf/x86/intel/pebs: Robustify PEBS buffer drain
Vince Weaver and Stephane Eranian reported warnings in the PEBS
code when running the perf fuzzer. Stephane wrote:

  > I can reproduce the problem on my HSW running the fuzzer.
  >
  > I can see why this could be happening if you are mixing PEBS and non PEBS events
  > in the bottom 4 counters. I suspect:
  >         for (bit = 0; bit < x86_pmu.max_pebs_events; bit++) {
  >                 if ((counts[bit] == 0) && (error[bit] == 0))
  >                         continue;
  >
  > This test is not correct when you have non-PEBS events mixed with
  > PEBS events and they overflow at the same time. They will have
  > counts[i] != 0 but error[i] == 0, and thus you fall thru the loop
  > and hit the assert. Or it is something along those lines.

The only way I can make this work is if ->status only has !PEBS events
set, because if it has both set we'll take that slow path which masks
out the !PEBS bits.

After masking there are 3 options:

 - there is one bit set, and its @bit, we increment counts[bit].

 - there are multiple bits set, we increment error[] for each set bit,
   we do not increment counts[].

 - there are no bits set, we do nothing.

The intent was to never increment counts[] for !PEBS events.

Now if we start out with only a single !PEBS event set, we'll pass the
test and increment counts[] for a !PEBS and hit the warn.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kan.liang@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-08-04 10:17:01 +02:00
..
boot The libnvdimm sub-system introduces, in addition to the libnvdimm-core, 2015-06-29 10:34:42 -07:00
configs kconfig: add xenconfig defconfig helper 2015-06-16 11:04:29 +01:00
crypto crypto: aesni - fix failing setkey for rfc4106-gcm-aesni 2015-06-29 16:06:30 +08:00
entry x86/asm/entry/32: Revert 'Do not use R9 in SYSCALL32' commit 2015-07-24 16:36:00 +02:00
ia32 Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:59:09 -07:00
include x86: Add new MSRs and MSR bits used for Intel Skylake PMU support 2015-08-04 10:16:56 +02:00
kernel perf/x86/intel/pebs: Robustify PEBS buffer drain 2015-08-04 10:17:01 +02:00
kvm KVM: x86: rename quirk constants to KVM_X86_QUIRK_* 2015-07-23 08:24:42 +02:00
lguest Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:59:09 -07:00
lib perf/x86: Fix copy_from_user_nmi() return if range is not ok 2015-07-06 14:09:27 +02:00
math-emu x86/fpu: Harmonize FPU register state types 2015-05-19 15:48:09 +02:00
mm x86/mm/pat: Revert 'Adjust default caching mode translation tables' 2015-07-26 10:27:37 +02:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
oprofile
pci PCI changes for the v4.2 merge window: 2015-06-23 13:41:24 -07:00
platform Replace module_init with equivalent device_initcall in non modules. 2015-07-02 10:30:48 -07:00
power Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:59:09 -07:00
purgatory
realmode
tools
um Merge branch 'for-linus-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml 2015-06-28 13:55:08 -07:00
video
xen Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:59:09 -07:00
.gitignore
Kbuild x86/asm/entry, x86/vdso: Move the vDSO code to arch/x86/entry/vdso/ 2015-06-03 18:51:37 +02:00
Kconfig x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and use it on x86 2015-07-18 03:42:51 +02:00
Kconfig.cpu
Kconfig.debug x86/entry/64, x86/nmi/64: Add CONFIG_DEBUG_ENTRY NMI testing code 2015-07-17 12:50:14 +02:00
Makefile x86/asm/entry: Move the arch/x86/syscalls/ definitions to arch/x86/entry/syscalls/ 2015-06-04 07:37:37 +02:00
Makefile.um
Makefile_32.cpu