Re: [PATCH] KVM: x86/pmu: Do not accidentally create BTS events

Peter Zijlstra
2025-12-02T09:35:43Z

On Mon, Dec 01, 2025 at 02:45:01PM +0000, Woodhouse, David wrote:
> On Mon, 2025-12-01 at 16:23 +0200, Fernand Sieber wrote
> > Perf considers the combination of PERF_COUNT_HW_BRANCH_INSTRUCTIONS with
> > a sample_period of 1 a special case and handles this as a BTS event (see
> > intel_pmu_has_bts_period()) -- a deviation from the usual semantic,
> > where the sample_period represents the amount of branch instructions to
> > encounter before the overflow handler is invoked.
>
> That's kind of awful, and seems to be the real underlying cause of the KVM
> issue. Can we kill it with fire? Peter?

Well, IIRC it gives the same information and was actually less expensive
to run, seeing how BTS can buffer the data rather than having to take an
interrupt on every event.

But its been ages since this was done.

Now arguably it should not be done for this kvm stuff, because the
data-store buffers don't virtualize (just like old PEBS).