aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKan Liang <kan.liang@linux.intel.com>2019-04-02 15:44:58 -0400
committerIngo Molnar <mingo@kernel.org>2019-04-16 06:13:58 -0400
commit9d5dcc93a6ddfc78124f006ccd3637ce070ef2fc (patch)
treecdc452a27952803e2330d77b3f5ecd82d68278cd
parent339bc4183596e1f68c2c98a03b87aa124107c317 (diff)
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>
-rw-r--r--arch/x86/events/intel/core.c2
-rw-r--r--arch/x86/events/perf_event.h38
2 files changed, 20 insertions, 20 deletions
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index f61dcbef20ff..f9451566cd9b 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3131,7 +3131,7 @@ static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event)
3131 flags &= ~PERF_SAMPLE_TIME; 3131 flags &= ~PERF_SAMPLE_TIME;
3132 if (!event->attr.exclude_kernel) 3132 if (!event->attr.exclude_kernel)
3133 flags &= ~PERF_SAMPLE_REGS_USER; 3133 flags &= ~PERF_SAMPLE_REGS_USER;
3134 if (event->attr.sample_regs_user & ~PEBS_REGS) 3134 if (event->attr.sample_regs_user & ~PEBS_GP_REGS)
3135 flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR); 3135 flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR);
3136 return flags; 3136 return flags;
3137} 3137}
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index a75955741c50..1e98a42b560a 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -96,25 +96,25 @@ struct amd_nb {
96 PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ 96 PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \
97 PERF_SAMPLE_PERIOD) 97 PERF_SAMPLE_PERIOD)
98 98
99#define PEBS_REGS \ 99#define PEBS_GP_REGS \
100 (PERF_REG_X86_AX | \ 100 ((1ULL << PERF_REG_X86_AX) | \
101 PERF_REG_X86_BX | \ 101 (1ULL << PERF_REG_X86_BX) | \
102 PERF_REG_X86_CX | \ 102 (1ULL << PERF_REG_X86_CX) | \
103 PERF_REG_X86_DX | \ 103 (1ULL << PERF_REG_X86_DX) | \
104 PERF_REG_X86_DI | \ 104 (1ULL << PERF_REG_X86_DI) | \
105 PERF_REG_X86_SI | \ 105 (1ULL << PERF_REG_X86_SI) | \
106 PERF_REG_X86_SP | \ 106 (1ULL << PERF_REG_X86_SP) | \
107 PERF_REG_X86_BP | \ 107 (1ULL << PERF_REG_X86_BP) | \
108 PERF_REG_X86_IP | \ 108 (1ULL << PERF_REG_X86_IP) | \
109 PERF_REG_X86_FLAGS | \ 109 (1ULL << PERF_REG_X86_FLAGS) | \
110 PERF_REG_X86_R8 | \ 110 (1ULL << PERF_REG_X86_R8) | \
111 PERF_REG_X86_R9 | \ 111 (1ULL << PERF_REG_X86_R9) | \
112 PERF_REG_X86_R10 | \ 112 (1ULL << PERF_REG_X86_R10) | \
113 PERF_REG_X86_R11 | \ 113 (1ULL << PERF_REG_X86_R11) | \
114 PERF_REG_X86_R12 | \ 114 (1ULL << PERF_REG_X86_R12) | \
115 PERF_REG_X86_R13 | \ 115 (1ULL << PERF_REG_X86_R13) | \
116 PERF_REG_X86_R14 | \ 116 (1ULL << PERF_REG_X86_R14) | \
117 PERF_REG_X86_R15) 117 (1ULL << PERF_REG_X86_R15))
118 118
119/* 119/*
120 * Per register state. 120 * Per register state.