perf-events: Fix LLC-* events on Intel Nehalem/Westmere v2
Subsystems (2)
PATCH 3/7 perf-events: Fix LLC-* events on Intel Nehalem/Westmere v2
From: Andi Kleen <[email protected]>
The generic perf LLC-* events do count the L2 caches, not the real L3 LLC on Intel Nehalem and Westmere. This lead to quite some confusion.
Fixing this properly requires use of the special OFFCORE_RESPONSE events which need a separate mask register. This has been implemented in a earlier patch.
Now use this infrastructure to set correct events for the LLC-* on Nehalem and Westmere
Signed-off-by Andi Kleen <[email protected]>
--- arch/x86/kernel/cpu/perf_event.c | 12 ++++---- arch/x86/kernel/cpu/perf_event_intel.c | 46 +++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 19 deletions(-)
arch/x86/kernel/cpu/perf_event.c +6 -6
@@ -510,8 +510,9 @@ static inline int x86_pmu_initialized(void) }static inline int -set_ext_hw_attr (struct hw_perf_event *hwc,struct perf_event_attr *attr) +set_ext_hw_attr (struct hw_perf_event *hwc,struct perf_event *event) { +struct perf_event_attr *attr = &event->attr;unsigned int cache_type, cache_op, cache_result;u64 config, val;
@@ -537,9 +538,8 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event_attr *attr)if (val ==-1 )return -EINVAL ; - hwc->config |= val; - -return 0 ; + hwc->config |= val &X86_RAW_EVENT_MASK ; +return x86_pmu_extra_regs (val, event); }static int x86_setup_perfctr (struct perf_event *event)
@@ -564,10 +564,10 @@ static int x86_setup_perfctr(struct perf_event *event) }if (attr->type ==PERF_TYPE_RAW ) -return 0 ; +return x86_pmu_extra_regs (event->attr.config, event);if (attr->type ==PERF_TYPE_HW_CACHE ) -return set_ext_hw_attr (hwc, attr); +return set_ext_hw_attr (hwc, event);if (attr->config >= x86_pmu.max_events)return -EINVAL ;
arch/x86/kernel/cpu/perf_event_intel.c +33 -13
72 lines not on this page · raw message
Signature · 1 line
1.7.3