Re: [PATCH v2 07/11] KVM: x86: add a delayed hardware NMI injection interface

From: Sean Christopherson
Date: Tue Jan 31 2023 - 16:12:25 EST


On Sat, Jan 28, 2023, Sean Christopherson wrote:
> On Tue, Nov 29, 2022, Maxim Levitsky wrote:
> > @@ -10015,13 +10022,34 @@ static void process_nmi(struct kvm_vcpu *vcpu)
> > * Otherwise, allow two (and we'll inject the first one immediately).
> > */
> > if (static_call(kvm_x86_get_nmi_mask)(vcpu) || vcpu->arch.nmi_injected)
> > - limit = 1;
> > + limit--;
> > +
> > + /* Also if there is already a NMI hardware queued to be injected,
> > + * decrease the limit again
> > + */
>
> /*
> * Block comment ...
> */
>
> > + if (static_call(kvm_x86_get_hw_nmi_pending)(vcpu))
>
> I'd prefer "is_hw_nmi_pending()" over "get", even if it means not pairing with
> "set". Though I think that's a good thing since they aren't perfect pairs.

Thinking more, I vote for s/hw_nmi/vnmi. "hardware" usually means actual hardware,
i.e. a pending NMI for the host.