diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-04-26 07:24:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-26 07:34:34 -0400 |
commit | 18a073a3acd3a47fbb5e23333df7fad28d576345 (patch) | |
tree | 7b961ab5fd0f98a2348e4eaa419838040d7f8034 /arch | |
parent | cd2e49e90f1cae7726c9a2c54488d881d7f1cd1c (diff) |
perf, x86: Fix BTS condition
Currently the x86 backend incorrectly assumes that any BRANCH_INSN
with sample_period==1 is a BTS request. This is not true when we do
frequency driven profiling such as 'perf record -e branches'.
Solves this error:
$ perf record -e branches ./array
Error: sys_perf_event_open() syscall returned with 95 (Operation not supported).
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: "Metzger, Markus T" <markus.t.metzger@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/n/tip-rd2y4ct71hjawzz6fpvsy9hg@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 632e5dc9c9c0..fac0654021b8 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -613,8 +613,8 @@ static int x86_setup_perfctr(struct perf_event *event) | |||
613 | /* | 613 | /* |
614 | * Branch tracing: | 614 | * Branch tracing: |
615 | */ | 615 | */ |
616 | if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && | 616 | if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS && |
617 | (hwc->sample_period == 1)) { | 617 | !attr->freq && hwc->sample_period == 1) { |
618 | /* BTS is not supported by this architecture. */ | 618 | /* BTS is not supported by this architecture. */ |
619 | if (!x86_pmu.bts_active) | 619 | if (!x86_pmu.bts_active) |
620 | return -EOPNOTSUPP; | 620 | return -EOPNOTSUPP; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 43fa20b13817..9194b0698d63 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -998,6 +998,9 @@ intel_bts_constraints(struct perf_event *event) | |||
998 | struct hw_perf_event *hwc = &event->hw; | 998 | struct hw_perf_event *hwc = &event->hw; |
999 | unsigned int hw_event, bts_event; | 999 | unsigned int hw_event, bts_event; |
1000 | 1000 | ||
1001 | if (event->attr.freq) | ||
1002 | return NULL; | ||
1003 | |||
1001 | hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; | 1004 | hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; |
1002 | bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); | 1005 | bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); |
1003 | 1006 | ||