perf/x86: Fix incorrect PEBS_REGS

PEBS_REGS used as mask for the supported registers for large PEBS.
However, the mask cannot filter the sample_regs_user/sample_regs_intr
correctly.

(1ULL << PERF_REG_X86_*) should be used to replace PERF_REG_X86_*, which
is only the index.

Rename PEBS_REGS to PEBS_GP_REGS, because the mask is only for general
purpose registers.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.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>
Cc: acme@kernel.org
Cc: jolsa@kernel.org
Fixes: 2fe1bc1f501d ("perf/x86: Enable free running PEBS for REGS_USER/INTR")
Link: https://lkml.kernel.org/r/20190402194509.2832-2-kan.liang@linux.intel.com
[ Renamed it to PEBS_GP_REGS - as 'GPRS' is used elsewhere ;-) ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Kan Liang and committed by
Ingo Molnar
9d5dcc93 339bc418

+20 -20
+1 -1
arch/x86/events/intel/core.c
··· 3131 flags &= ~PERF_SAMPLE_TIME; 3132 if (!event->attr.exclude_kernel) 3133 flags &= ~PERF_SAMPLE_REGS_USER; 3134 - if (event->attr.sample_regs_user & ~PEBS_REGS) 3135 flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR); 3136 return flags; 3137 }
··· 3131 flags &= ~PERF_SAMPLE_TIME; 3132 if (!event->attr.exclude_kernel) 3133 flags &= ~PERF_SAMPLE_REGS_USER; 3134 + if (event->attr.sample_regs_user & ~PEBS_GP_REGS) 3135 flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR); 3136 return flags; 3137 }
+19 -19
arch/x86/events/perf_event.h
··· 96 PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ 97 PERF_SAMPLE_PERIOD) 98 99 - #define PEBS_REGS \ 100 - (PERF_REG_X86_AX | \ 101 - PERF_REG_X86_BX | \ 102 - PERF_REG_X86_CX | \ 103 - PERF_REG_X86_DX | \ 104 - PERF_REG_X86_DI | \ 105 - PERF_REG_X86_SI | \ 106 - PERF_REG_X86_SP | \ 107 - PERF_REG_X86_BP | \ 108 - PERF_REG_X86_IP | \ 109 - PERF_REG_X86_FLAGS | \ 110 - PERF_REG_X86_R8 | \ 111 - PERF_REG_X86_R9 | \ 112 - PERF_REG_X86_R10 | \ 113 - PERF_REG_X86_R11 | \ 114 - PERF_REG_X86_R12 | \ 115 - PERF_REG_X86_R13 | \ 116 - PERF_REG_X86_R14 | \ 117 - PERF_REG_X86_R15) 118 119 /* 120 * Per register state.
··· 96 PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ 97 PERF_SAMPLE_PERIOD) 98 99 + #define PEBS_GP_REGS \ 100 + ((1ULL << PERF_REG_X86_AX) | \ 101 + (1ULL << PERF_REG_X86_BX) | \ 102 + (1ULL << PERF_REG_X86_CX) | \ 103 + (1ULL << PERF_REG_X86_DX) | \ 104 + (1ULL << PERF_REG_X86_DI) | \ 105 + (1ULL << PERF_REG_X86_SI) | \ 106 + (1ULL << PERF_REG_X86_SP) | \ 107 + (1ULL << PERF_REG_X86_BP) | \ 108 + (1ULL << PERF_REG_X86_IP) | \ 109 + (1ULL << PERF_REG_X86_FLAGS) | \ 110 + (1ULL << PERF_REG_X86_R8) | \ 111 + (1ULL << PERF_REG_X86_R9) | \ 112 + (1ULL << PERF_REG_X86_R10) | \ 113 + (1ULL << PERF_REG_X86_R11) | \ 114 + (1ULL << PERF_REG_X86_R12) | \ 115 + (1ULL << PERF_REG_X86_R13) | \ 116 + (1ULL << PERF_REG_X86_R14) | \ 117 + (1ULL << PERF_REG_X86_R15)) 118 119 /* 120 * Per register state.