Skip to contentSkip to conversation

perf/x86: Fix missing sample size update on AMD BRS

PATCH Applied Namhyung Kim 2 participants 2 messages Apr 27, 2023 – May 10, 2023

Subsystems (3)
lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf/x86: Fix missing sample size update on AMD BRS

It missed to convert a PERF_SAMPLE_BRANCH_STACK user to call the new perf_sample_save_brstack() helper in order to update the dyn_size. This affects AMD Zen3 machines with the branch-brs event.

Fixes eb55b455ef9c ("perf/core: Add perf_sample_save_brstack() helper")
---
 arch/x86/events/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/events/core.c +2 -4
index d096b04bf80e..9d248703cbdd 100644
@@ -1703,10 +1703,8 @@ int x86_pmu_handle_irq(struct pt_regs *regs)
 
 		perf_sample_data_init(&data, 0, event->hw.last_period);
 
-		if (has_branch_stack(event)) {
-			data.br_stack = &cpuc->lbr_stack;
-			data.sample_flags |= PERF_SAMPLE_BRANCH_STACK;
-		}
+		if (has_branch_stack(event))
+			perf_sample_save_brstack(&data, event, &cpuc->lbr_stack);
 
 		if (perf_event_overflow(event, &data, regs))
 			x86_pmu_stop(event, 0);
Signature · 1 line
2.40.1.495.gc816e09b53d-goog
merge bot Applied
#1 lore raw
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     90befef5a9e820ccccc33181ec14c015980300cc
Gitweb:        https://git.kernel.org/tip/90befef5a9e820ccccc33181ec14c015980300cc
Author:        Namhyung Kim <[email protected]>
AuthorDate:    Wed, 26 Apr 2023 20:05:27 -07:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Mon, 08 May 2023 10:58:26 +02:00

perf/x86: Fix missing sample size update on AMD BRS

It missed to convert a PERF_SAMPLE_BRANCH_STACK user to call the new perf_sample_save_brstack() helper in order to update the dyn_size. This affects AMD Zen3 machines with the branch-brs event.

Fixes eb55b455ef9c ("perf/core: Add perf_sample_save_brstack() helper")
---
 arch/x86/events/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/events/core.c +2 -4
index d096b04..9d24870 100644
@@ -1703,10 +1703,8 @@ int x86_pmu_handle_irq(struct pt_regs *regs)
 
 		perf_sample_data_init(&data, 0, event->hw.last_period);
 
-		if (has_branch_stack(event)) {
-			data.br_stack = &cpuc->lbr_stack;
-			data.sample_flags |= PERF_SAMPLE_BRANCH_STACK;
-		}
+		if (has_branch_stack(event))
+			perf_sample_save_brstack(&data, event, &cpuc->lbr_stack);
 
 		if (perf_event_overflow(event, &data, regs))
 			x86_pmu_stop(event, 0);