Re: [Patch v2 7/9] perf/x86/intel: Drop fixed-counter PEBS constraints for baseline PEBS

From: Peter Zijlstra

Date: Wed Jun 10 2026 - 04:33:00 EST


On Wed, Jun 10, 2026 at 10:20:51AM +0200, Peter Zijlstra wrote:
> On Tue, Jun 09, 2026 at 01:02:20PM +0800, Dapeng Mi wrote:
> > On SPR guests where pebs_baseline is not advertised, running:
> >
> > $ ./perf record -e cpu/event=0x00,umask=0x01,i\
> > name=INST_RETIRED.PREC_DIST/p -c 10000 sleep 1
> >
> > can trigger:
> >
> > unchecked MSR access error: WRMSR to 0x3f1 ... in\
> > intel_pmu_pebs_enable_all()
> >
> > Root cause:
> > SPR-specific PEBS constraints allow fixed-counter scheduling,
> > for example INST_RETIRED.PREC_DIST on fixed counter 0. In guests without
> > pebs_baseline, KVM does not support PEBS sampling on fixed counters,
> > so enabling such events reaches an invalid MSR programming path.
> >
> > Fix:
> > Drop fixed-counter entries from the PEBS constraint table. Without
> > pebs_baseline, those fixed-counter PEBS events now resolve to empty
> > constraints and are not scheduled/enabled, avoiding the warning and the
> > broken guest PEBS path.
> >
> > This is safe because, in pebs_baseline-capable cases, PEBS constraint
> > lookup already falls back to non-PEBS constraints when needed, and
> > fixed-counter constraints are effectively shared there.
>
> I am confused, this works outside of KVM? (It appears to work fine on my
> spr).. so removing this to fix some guest only issue seems wrong.
>

Also, perf tools guys:

[ perf record: Woken up 1 times to write data ]
ERROR: Trying to write bpf_prog_info without libbpf support.
ERROR: Trying to write btf data without libbpf support.
[ perf record: Captured and wrote 0.041 MB perf.data (92 samples) ]


I explicitly build perf like:

make NO_LIBBPF=1 NO_LIBPYTHON=1 NO_LIBLLVM=1 NO_RUST=1

W.T.F does it even attempt to use libbpf and report and error about it
?!?!

(Also, I needed that NO_RUST because the build was full on crashing
without it)