Re: [PATCH 2/2] KVM: x86: check_nested_events if there is an injectable NMI
From: Paolo Bonzini
Date: Thu Apr 23 2020 - 14:32:37 EST
On 23/04/20 17:43, Paolo Bonzini wrote:
>>
> Ah no, it's a bug in Cathy's patch and it's a weird one.
>
> The problem is that on AMD you exit guest mode with the NMI latched and
> GIF=0. So check_nested_events should enable the NMI window in addition
> to causing a vmexit.
>
> So why does it work? Because on AMD we don't have (yet)
> nested_run_pending, so we just check if we already have a vmexit
> scheduled and if so return -EBUSY. The second call causes
> inject_pending_event to return -EBUSY and thus go through KVM_REQ_EVENT
> again, which enables the NMI window.
... and this means that suddenly your event handling series has become
twice as large so I'm taking it over.
Paolo