Re: [PATCH] perf/x86: Don't enforce minimum period for KVM guest-only events

From: Peter Zijlstra
Date: Wed Nov 29 2023 - 06:21:03 EST


On Tue, Nov 28, 2023 at 05:33:16PM -0800, Sean Christopherson wrote:

> If programming a "period" of 1 puts the host at risk in some way, then I agree
> that this is unsafe and we need a different solution.

IIRC if you put in -1 on a Nehalem, you end up with an NMI-storm which
wasn't trivial to recover from if at all (it's too long ago and I don't
have ancient hardware like that anymore :/)

> But if the worst case
> scenario is non-determinstic or odd behavior from the guest's perspective, then
> that's the guest's problem (with the caveat that the guest might not have accurate
> Family/Model/Stepping data to make informed decisions).

Things like bdm_limit_period() will cause odd behaviour IIRC, it does
daft things like generate extra PEBS records on overflow and gives
otherwise daft results for PDIR.

glc_limit_period() lacks a useful comment :/