stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/x86: Fix missing sample size update on AMD BRS
@ 2023-04-27  3:05 Namhyung Kim
  2023-05-10 13:25 ` [tip: perf/urgent] " tip-bot2 for Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2023-04-27  3:05 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ian Rogers, Adrian Hunter,
	LKML, Stephane Eranian, Ravi Bangoria, Sandipan Das, stable

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")
Cc: stable@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 arch/x86/events/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index d096b04bf80e..9d248703cbdd 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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);
-- 
2.40.1.495.gc816e09b53d-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: perf/urgent] perf/x86: Fix missing sample size update on AMD BRS
  2023-04-27  3:05 [PATCH] perf/x86: Fix missing sample size update on AMD BRS Namhyung Kim
@ 2023-05-10 13:25 ` tip-bot2 for Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Namhyung Kim @ 2023-05-10 13:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Namhyung Kim, Peter Zijlstra (Intel), stable, x86, linux-kernel

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 <namhyung@kernel.org>
AuthorDate:    Wed, 26 Apr 2023 20:05:27 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20230427030527.580841-1-namhyung@kernel.org
---
 arch/x86/events/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index d096b04..9d24870 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-10 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-27  3:05 [PATCH] perf/x86: Fix missing sample size update on AMD BRS Namhyung Kim
2023-05-10 13:25 ` [tip: perf/urgent] " tip-bot2 for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).