Skip to content

Commit

Permalink
perf/x86: Fix missing sample size update on AMD BRS
Browse files Browse the repository at this point in the history
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: eb55b45 ("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
  • Loading branch information
Namhyung Kim authored and Peter Zijlstra committed May 8, 2023
1 parent 1d1bfe3 commit 90befef
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions arch/x86/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 90befef

Please sign in to comment.