Skip to content

Commit f5ded92

Browse files
Kan Liangmehmetb0
authored andcommitted
perf/x86/intel: Clean up PEBS-via-PT on hybrid
BugLink: https://bugs.launchpad.net/bugs/2104873 [ Upstream commit 0a55615 ] The PEBS-via-PT feature is exposed for the e-core of some hybrid platforms, e.g., ADL and MTL. But it never works. $ dmesg | grep PEBS [ 1.793888] core: cpu_atom PMU driver: PEBS-via-PT $ perf record -c 1000 -e '{intel_pt/branch=0/, cpu_atom/cpu-cycles,aux-output/pp}' -C8 Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cpu_atom/cpu-cycles,aux-output/pp). "dmesg | grep -i perf" may provide additional information. The "PEBS-via-PT" is printed if the corresponding bit of per-PMU capabilities is set. Since the feature is supported by the e-core HW, perf sets the bit for e-core. However, for Intel PT, if a feature is not supported on all CPUs, it is not supported at all. The PEBS-via-PT event cannot be created successfully. The PEBS-via-PT is no longer enumerated on the latest hybrid platform. It will be deprecated on future platforms with Arch PEBS. Let's remove it from the existing hybrid platforms. Fixes: d9977c4 ("perf/x86: Register hybrid PMUs") Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20250129154820.3755948-2-kan.liang@linux.intel.com Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Noah Wager <noah.wager@canonical.com>
1 parent 620cb37 commit f5ded92

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

arch/x86/events/intel/core.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,11 +4901,6 @@ static void intel_pmu_check_hybrid_pmus(struct x86_hybrid_pmu *pmu)
49014901
else
49024902
pmu->intel_ctrl &= ~(1ULL << GLOBAL_CTRL_EN_PERF_METRICS);
49034903

4904-
if (pmu->intel_cap.pebs_output_pt_available)
4905-
pmu->pmu.capabilities |= PERF_PMU_CAP_AUX_OUTPUT;
4906-
else
4907-
pmu->pmu.capabilities &= ~PERF_PMU_CAP_AUX_OUTPUT;
4908-
49094904
intel_pmu_check_event_constraints(pmu->event_constraints,
49104905
pmu->cntr_mask64,
49114906
pmu->fixed_cntr_mask64,
@@ -4974,9 +4969,6 @@ static bool init_hybrid_pmu(int cpu)
49744969

49754970
pr_info("%s PMU driver: ", pmu->name);
49764971

4977-
if (pmu->intel_cap.pebs_output_pt_available)
4978-
pr_cont("PEBS-via-PT ");
4979-
49804972
pr_cont("\n");
49814973

49824974
x86_pmu_show_pmu_cap(&pmu->pmu);
@@ -6287,11 +6279,9 @@ static __always_inline int intel_pmu_init_hybrid(enum hybrid_pmu_type pmus)
62876279
pmu->intel_cap.capabilities = x86_pmu.intel_cap.capabilities;
62886280
if (pmu->pmu_type & hybrid_small) {
62896281
pmu->intel_cap.perf_metrics = 0;
6290-
pmu->intel_cap.pebs_output_pt_available = 1;
62916282
pmu->mid_ack = true;
62926283
} else if (pmu->pmu_type & hybrid_big) {
62936284
pmu->intel_cap.perf_metrics = 1;
6294-
pmu->intel_cap.pebs_output_pt_available = 0;
62956285
pmu->late_ack = true;
62966286
}
62976287
}

arch/x86/events/intel/ds.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,15 @@ void __init intel_ds_init(void)
25232523
}
25242524
pr_cont("PEBS fmt4%c%s, ", pebs_type, pebs_qual);
25252525

2526-
if (!is_hybrid() && x86_pmu.intel_cap.pebs_output_pt_available) {
2526+
/*
2527+
* The PEBS-via-PT is not supported on hybrid platforms,
2528+
* because not all CPUs of a hybrid machine support it.
2529+
* The global x86_pmu.intel_cap, which only contains the
2530+
* common capabilities, is used to check the availability
2531+
* of the feature. The per-PMU pebs_output_pt_available
2532+
* in a hybrid machine should be ignored.
2533+
*/
2534+
if (x86_pmu.intel_cap.pebs_output_pt_available) {
25272535
pr_cont("PEBS-via-PT, ");
25282536
x86_get_pmu(smp_processor_id())->capabilities |= PERF_PMU_CAP_AUX_OUTPUT;
25292537
}

0 commit comments

Comments
 (0)