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

From: Mi, Dapeng

Date: Wed Jun 10 2026 - 07:43:07 EST



On 6/10/2026 7:21 PM, Peter Zijlstra wrote:
> On Wed, Jun 10, 2026 at 04:50:45PM +0800, Mi, Dapeng wrote:
>> On 6/10/2026 4:20 PM, 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.
>> The reason that it works on bare metal is currently the constraint lookup
>> would fallback into non-PEBS constraints if there is no matched entry in
>> the PEBS constraints as long as the PEBS supports sampling on all counters
>> including fixed counters (what the flag "PMU_FL_PEBS_ALL" indicates), like
>> the below code shows.
>>
>> ```
> Why the markdown nonsense? You're not an LLM, right? And you all know
> I'm reading this in mutt. Its just visual noise.
>
> Anyway, please clarify the Changelog.

Sorry for the visual noise. I'm using the thunderbird mail client,  not
sure why the markdown doesn't work.

Sure. I would rewrite the change log and increase more details. Thanks.