Re: [PATCH 06/15] KVM: x86: Register perf callbacks only when actively handling interrupt

2021-08-27 Thread Peter Zijlstra
On Thu, Aug 26, 2021 at 05:57:09PM -0700, Sean Christopherson wrote: > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 9bc1375d6ed9..2f28d9d8dc94 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -6485,6 +6485,18 @@ static void perf_pending_event(struct irq_work

[PATCH 06/15] KVM: x86: Register perf callbacks only when actively handling interrupt

2021-08-26 Thread Sean Christopherson
Register KVM's perf callback only when handling an interrupt that may be a PMI (sadly this includes IRQs), and unregister the callback immediately after handling the interrupt (or closing the window). Registering the callback on a per-CPU basis (with preemption disabled!), fixes a mostly theoretic