FAILED: patch "[PATCH] perf/x86/intel: Don't clear perf metrics overflow bit" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x a5f5e1238f4ff919816f69e77d2537a48911767b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025042159-unison-erupt-4734@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a5f5e1238f4ff919816f69e77d2537a48911767b Mon Sep 17 00:00:00 2001
From: Dapeng Mi <[email protected]>
Date: Tue, 15 Apr 2025 10:41:34 +0000
Subject: [PATCH] perf/x86/intel: Don't clear perf metrics overflow bit
unconditionally
The below code would always unconditionally clear other status bits like perf metrics overflow bit once PEBS buffer overflows:
status &= intel_ctrl | GLOBAL_STATUS_TRACE_TOPAPMI;
This is incorrect. Perf metrics overflow bit should be cleared only when fixed counter 3 in PEBS counter group. Otherwise perf metrics overflow could be missed to handle.
arch/x86/events/intel/core.c +11 -2
@@ -3049,7 +3049,6 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)struct cpu_hw_events *cpuc =this_cpu_ptr (&cpu_hw_events);int bit;int handled =0 ; -u64 intel_ctrl =hybrid (cpuc->pmu, intel_ctrl);inc_irq_stat (apic_perf_irqs);
@@ -3093,7 +3092,6 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status) handled++;x86_pmu_handle_guest_pebs (regs, &data);static_call (x86_pmu_drain_pebs)(regs, &data); - status &= intel_ctrl |GLOBAL_STATUS_TRACE_TOPAPMI ;/* * PMI throttle may be triggered, which stops the PEBS event.
@@ -3104,6 +3102,15 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)*/ if (pebs_enabled != cpuc->pebs_enabled)wrmsrl (MSR_IA32_PEBS_ENABLE , cpuc->pebs_enabled); + +/* +* Above PEBS handler (PEBS counters snapshotting) has updated fixed +* counter 3 and perf metrics counts if they are in counter group, +* unnecessary to update again. +*/ +if (cpuc->events[INTEL_PMC_IDX_FIXED_SLOTS ] && +is_pebs_counter_event_group (cpuc->events[INTEL_PMC_IDX_FIXED_SLOTS ])) + status &= ~GLOBAL_STATUS_PERF_METRICS_OVF_BIT ; }/*
@@ -3123,6 +3130,8 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)static_call (intel_pmu_update_topdown_event)(NULL ,NULL ); } + status &=hybrid (cpuc->pmu, intel_ctrl); +/* * Checkpointed counters can lead to 'spurious' PMIs because the * rollback caused by the PMI will have cleared the overflow status