mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 23:26:45 +07:00
perf_events: Check for filters on fixed counter events
Intel fixed counters do not support all the filters possible with a generic counter. Thus, if a fixed counter event is passed but with certain filters set, then the fixed_mode_idx() function must fail and the event must be measured in a generic counter instead. Reject filters are: inv, edge, cnt-mask. Signed-off-by: Stephane Eranian <eranian@gmail.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <1254840129-6198-2-git-send-email-eranian@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
26dd2cb074
commit
04a705df47
@ -28,9 +28,20 @@
|
|||||||
*/
|
*/
|
||||||
#define ARCH_PERFMON_EVENT_MASK 0xffff
|
#define ARCH_PERFMON_EVENT_MASK 0xffff
|
||||||
|
|
||||||
|
/*
|
||||||
|
* filter mask to validate fixed counter events.
|
||||||
|
* the following filters disqualify for fixed counters:
|
||||||
|
* - inv
|
||||||
|
* - edge
|
||||||
|
* - cnt-mask
|
||||||
|
* The other filters are supported by fixed counters.
|
||||||
|
* The any-thread option is supported starting with v3.
|
||||||
|
*/
|
||||||
|
#define ARCH_PERFMON_EVENT_FILTER_MASK 0xff840000
|
||||||
|
|
||||||
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c
|
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c
|
||||||
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
|
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
|
||||||
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0
|
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0
|
||||||
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
|
#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
|
||||||
(1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
|
(1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
|
||||||
|
|
||||||
|
@ -1349,6 +1349,12 @@ fixed_mode_idx(struct perf_event *event, struct hw_perf_event *hwc)
|
|||||||
if (!x86_pmu.num_events_fixed)
|
if (!x86_pmu.num_events_fixed)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* fixed counters do not take all possible filters
|
||||||
|
*/
|
||||||
|
if (hwc->config & ARCH_PERFMON_EVENT_FILTER_MASK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
|
if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
|
||||||
return X86_PMC_IDX_FIXED_INSTRUCTIONS;
|
return X86_PMC_IDX_FIXED_INSTRUCTIONS;
|
||||||
if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
|
if (unlikely(hw_event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
|
||||||
|
Loading…
Reference in New Issue
Block a user