diff mbox

[v2,1/8] KVM: VMX: No need to clear pending NMI/interrupt on inject realmode interrupt

Message ID 1511278211-12257-2-git-send-email-liran.alon@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liran Alon Nov. 21, 2017, 3:30 p.m. UTC
kvm_inject_realmode_interrupt() is called from one of the injection
functions which writes event-injection to VMCS: vmx_queue_exception(),
vmx_inject_irq() and vmx_inject_nmi().

All these functions are called just to cause an event-injection to
guest. They are not responsible of manipulating the event-pending
flag. The only purpose of kvm_inject_realmode_interrupt() should be
to emulate real-mode interrupt-injection.

This was also incorrect when called from vmx_queue_exception().

Signed-off-by: Liran Alon <liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
---
 arch/x86/kvm/x86.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Jim Mattson Dec. 1, 2017, 11:45 p.m. UTC | #1
Reviewed-by: Jim Mattson <jmattson@google.com>

On Tue, Nov 21, 2017 at 7:30 AM, Liran Alon <liran.alon@oracle.com> wrote:
> kvm_inject_realmode_interrupt() is called from one of the injection
> functions which writes event-injection to VMCS: vmx_queue_exception(),
> vmx_inject_irq() and vmx_inject_nmi().
>
> All these functions are called just to cause an event-injection to
> guest. They are not responsible of manipulating the event-pending
> flag. The only purpose of kvm_inject_realmode_interrupt() should be
> to emulate real-mode interrupt-injection.
>
> This was also incorrect when called from vmx_queue_exception().
>
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> ---
>  arch/x86/kvm/x86.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 34c85aa2e2d1..c85fc4406a7d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5411,11 +5411,6 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip)
>         kvm_rip_write(vcpu, ctxt->eip);
>         kvm_set_rflags(vcpu, ctxt->eflags);
>
> -       if (irq == NMI_VECTOR)
> -               vcpu->arch.nmi_pending = 0;
> -       else
> -               vcpu->arch.interrupt.pending = false;
> -
>         return EMULATE_DONE;
>  }
>  EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);
> --
> 1.9.1
>
Liran Alon Dec. 2, 2017, 12:19 a.m. UTC | #2
On 02/12/17 01:45, Jim Mattson wrote:
> Reviewed-by: Jim Mattson <jmattson@google.com>
Thanks for the review.

>
> On Tue, Nov 21, 2017 at 7:30 AM, Liran Alon <liran.alon@oracle.com> wrote:
>> kvm_inject_realmode_interrupt() is called from one of the injection
>> functions which writes event-injection to VMCS: vmx_queue_exception(),
>> vmx_inject_irq() and vmx_inject_nmi().
>>
>> All these functions are called just to cause an event-injection to
>> guest. They are not responsible of manipulating the event-pending
>> flag. The only purpose of kvm_inject_realmode_interrupt() should be
>> to emulate real-mode interrupt-injection.
>>
>> This was also incorrect when called from vmx_queue_exception().
>>
>> Signed-off-by: Liran Alon <liran.alon@oracle.com>
>> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
>> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
>> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
>> ---
>>   arch/x86/kvm/x86.c | 5 -----
>>   1 file changed, 5 deletions(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 34c85aa2e2d1..c85fc4406a7d 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -5411,11 +5411,6 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip)
>>          kvm_rip_write(vcpu, ctxt->eip);
>>          kvm_set_rflags(vcpu, ctxt->eflags);
>>
>> -       if (irq == NMI_VECTOR)
>> -               vcpu->arch.nmi_pending = 0;
>> -       else
>> -               vcpu->arch.interrupt.pending = false;
>> -
>>          return EMULATE_DONE;
>>   }
>>   EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);
>> --
>> 1.9.1
>>
diff mbox

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 34c85aa2e2d1..c85fc4406a7d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5411,11 +5411,6 @@  int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip)
 	kvm_rip_write(vcpu, ctxt->eip);
 	kvm_set_rflags(vcpu, ctxt->eflags);
 
-	if (irq == NMI_VECTOR)
-		vcpu->arch.nmi_pending = 0;
-	else
-		vcpu->arch.interrupt.pending = false;
-
 	return EMULATE_DONE;
 }
 EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);