Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v2 0/2] perf/x86: Limit branch snapshots to valid entries
@ 2026-10-15 11:46 Sandipan Das
  2026-10-15 11:46 ` [PATCH v2 1/2] perf/x86/amd/lbr: " Sandipan Das
  2026-10-15 11:46 ` [PATCH v2 2/2] perf/x86/intel/lbr: " Sandipan Das
  0 siblings, 2 replies; 5+ messages in thread
From: Sandipan Das @ 2026-10-15 11:46 UTC (permalink / raw)
  To: linux-perf-users, linux-kernel, bpf
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin, Dapeng Mi,
	Andrii Nakryiko, Song Liu, Ravi Bangoria, Ananth Narayan,
	Sandipan Das

Sashiko reported that the vendor-specific branch snapshot callbacks
used by bpf_get_branch_snapshot() copy up to x86_pmu.lbr_nr entries
from cpuc->lbr_entries[], regardless of how many valid entries the
last LBR read produced. This makes BPF programs read stale or invalid
branch records. Patch 1 addresses AMD and patch 2 addresses Intel.

Previous version(s) can be found at
v1: https://lore.kernel.org/all/20261007181002.4005262-1-sandipan.das@amd.com/

Changes in v2:
  * Include a fix for Intel LBR.
  * Add Tested-by from Dapeng to the Intel fix.
    https://lore.kernel.org/all/eb6c7bda-0dcf-4fac-ad69-9f5b24abc21b@linux.intel.com/

Sandipan Das (2):
  perf/x86/amd/lbr: Limit branch snapshots to valid entries
  perf/x86/intel/lbr: Limit branch snapshots to valid entries

 arch/x86/events/amd/core.c   | 2 +-
 arch/x86/events/amd/lbr.c    | 4 +++-
 arch/x86/events/intel/core.c | 2 +-
 arch/x86/events/intel/lbr.c  | 4 +++-
 4 files changed, 8 insertions(+), 4 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-10-15 12:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 11:46 [PATCH v2 0/2] perf/x86: Limit branch snapshots to valid entries Sandipan Das
2026-10-15 11:46 ` [PATCH v2 1/2] perf/x86/amd/lbr: " Sandipan Das
2026-10-15 12:01   ` sashiko-bot
2026-10-15 11:46 ` [PATCH v2 2/2] perf/x86/intel/lbr: " Sandipan Das
2026-10-15 12:01   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox