On 02/08/2017 10:05, Wanpeng Li wrote:
>>>
>>> SDM says that with acknowledge interrupt on exit, bit 31 of the VM-exit
>>> interrupt information (valid interrupt) is always set to 1 on
>>> EXIT_REASON_EXTERNAL_INTERRUPT.  We don't want to break hypervisors
>>> expecting an interrupt in that case, so we should do a userspace VM exit
>>> when the window is open and then inject the userspace interrupt with a
>>> VM exit.
>> Agreed.
>>
>>> The simplest thing that came to my mind is to:
>>>
>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>>> index 39a6222bf968..9ad0c882c4f5 100644
>>> --- a/arch/x86/kvm/vmx.c
>>> +++ b/arch/x86/kvm/vmx.c
>>> @@ -10687,7 +10687,8 @@ static int vmx_check_nested_events(struct kvm_vcpu 
>>> *vcpu, bool external_intr)
>>>                 return 0;
>>>         }
>>>
>>> -       if ((kvm_cpu_has_interrupt(vcpu) || external_intr) &&
>>> +       if ((kvm_cpu_has_interrupt(vcpu) ||
>>> +            (external_intr && !nested_exit_intr_ack_set(vcpu))) &&
>>>             nested_exit_on_intr(vcpu)) {
>>>                 if (vmx->nested.nested_run_pending)
>>>                         return -EBUSY;
>>>
>> Agreed.
>
> What's your opinion, Paolo? :) Actually I considered the above idea
> before, it is what SDM defined.

Radim and I always agree. :)

Paolo

Reply via email to