Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcadbaa0

Browse files
Stephane EranianPeter Zijlstra
Stephane Eranian
authored and
Peter Zijlstra
committed
perf/x86/intel: Make anythread filter support conditional
Starting with Arch Perfmon v5, the anythread filter on generic counters may bedeprecated. The current kernel was exporting the any filter without checking.On Icelake, it means you could do cpu/event=0x3c,any/ even though the filterdoes not exist. This patch corrects the problem by relying on the CPUID 0xa leaffunction to determine if anythread is supported or not as described in theIntel SDM Vol3b 18.2.5.1 AnyThread Deprecation section.Signed-off-by: Stephane Eranian <eranian@google.com>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>Link:https://lkml.kernel.org/r/20201028194247.3160610-1-eranian@google.com
1 parent1908dc9 commitcadbaa0

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

‎arch/x86/events/intel/core.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4987,6 +4987,12 @@ __init int intel_pmu_init(void)
49874987

49884988
x86_add_quirk(intel_arch_events_quirk);/* Install first, so it runs last */
49894989

4990+
if (version >=5) {
4991+
x86_pmu.intel_cap.anythread_deprecated=edx.split.anythread_deprecated;
4992+
if (x86_pmu.intel_cap.anythread_deprecated)
4993+
pr_cont(" AnyThread deprecated, ");
4994+
}
4995+
49904996
/*
49914997
* Install the hw-cache-events table:
49924998
*/
@@ -5512,6 +5518,10 @@ __init int intel_pmu_init(void)
55125518
x86_pmu.intel_ctrl |=
55135519
((1LL <<x86_pmu.num_counters_fixed)-1) <<INTEL_PMC_IDX_FIXED;
55145520

5521+
/* AnyThread may be deprecated on arch perfmon v5 or later */
5522+
if (x86_pmu.intel_cap.anythread_deprecated)
5523+
x86_pmu.format_attrs=intel_arch_formats_attr;
5524+
55155525
if (x86_pmu.event_constraints) {
55165526
/*
55175527
* event on fixed counter2 (REF_CYCLES) only works on this

‎arch/x86/events/perf_event.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ union perf_capabilities {
585585
u64pebs_baseline:1;
586586
u64perf_metrics:1;
587587
u64pebs_output_pt_available:1;
588+
u64anythread_deprecated:1;
588589
};
589590
u64capabilities;
590591
};

‎arch/x86/include/asm/perf_event.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ union cpuid10_edx {
137137
struct {
138138
unsignedintnum_counters_fixed:5;
139139
unsignedintbit_width_fixed:8;
140-
unsignedintreserved:19;
140+
unsignedintreserved1:2;
141+
unsignedintanythread_deprecated:1;
142+
unsignedintreserved2:16;
141143
}split;
142144
unsignedintfull;
143145
};

‎arch/x86/kvm/cpuid.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
672672

673673
edx.split.num_counters_fixed=min(cap.num_counters_fixed,MAX_FIXED_COUNTERS);
674674
edx.split.bit_width_fixed=cap.bit_width_fixed;
675-
edx.split.reserved=0;
675+
edx.split.anythread_deprecated=1;
676+
edx.split.reserved1=0;
677+
edx.split.reserved2=0;
676678

677679
entry->eax=eax.full;
678680
entry->ebx=cap.events_mask;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp