linux-stable/arch
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
..
alpha mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
arc mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
arm MMC core: 2015-07-24 16:43:16 -07:00
arm64 ARM64/irq: Use access helper irq_data_get_affinity_mask() 2015-07-22 10:57:09 +01:00
avr32 AVR32/time: Migrate to new 'set-state' interface 2015-07-20 12:19:10 +02:00
blackfin mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
c6x mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
cris mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
frv mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
h8300 mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
hexagon mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
ia64 mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
m32r m32r: Add ioreadXX/iowriteXX big-endian mmio accessors 2015-07-23 18:08:28 -07:00
m68k mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
metag mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
microblaze mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
mips Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-07-19 14:12:22 -07:00
mn10300 mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
nios2 mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
openrisc mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
parisc parisc: mm: Fix a memory leak related to pmd not attached to the pgd 2015-07-19 08:56:14 +02:00
powerpc powerpc/perf/24x7: Fix lockdep warning 2015-07-08 15:18:04 +10:00
s390 s390: adapt entry.S to the move of thread_struct 2015-07-20 13:22:18 +02:00
score mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
sh mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
sparc mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
tile tile: use free_bootmem_late() for initrd 2015-07-23 14:11:09 -04:00
um mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
unicore32 mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
x86 perf/x86/intel/pebs: Robustify PEBS buffer drain 2015-08-04 10:17:01 +02:00
xtensa mm: clean up per architecture MM hook header files 2015-07-17 16:39:53 -07:00
.gitignore
Kconfig x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and use it on x86 2015-07-18 03:42:51 +02:00