[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <358e284b-957a-388b-9729-9ee82b4fd8e3@redhat.com>
Date: Thu, 25 Feb 2021 17:05:14 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Maxim Levitsky <mlevitsk@...hat.com>, kvm@...r.kernel.org
Cc: Ingo Molnar <mingo@...hat.com>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@...r.kernel.org>, Jim Mattson <jmattson@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Joerg Roedel <joro@...tes.org>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Wanpeng Li <wanpengli@...cent.com>,
Sean Christopherson <seanjc@...gle.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 3/4] KVM: x86: pending exception must be be injected even
with an injected event
On 25/02/21 16:41, Maxim Levitsky wrote:
> Injected events should not block a pending exception, but rather,
> should either be lost or be delivered to the nested hypervisor as part of
> exitintinfo/IDT_VECTORING_INFO
> (if nested hypervisor intercepts the pending exception)
>
> Signed-off-by: Maxim Levitsky <mlevitsk@...hat.com>
Does this already fix some of your new test cases?
Paolo
> ---
> arch/x86/kvm/svm/nested.c | 7 ++++++-
> arch/x86/kvm/vmx/nested.c | 9 +++++++--
> 2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index 881e3954d753b..4c82abce0ea0c 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -1024,7 +1024,12 @@ static int svm_check_nested_events(struct kvm_vcpu *vcpu)
> }
>
> if (vcpu->arch.exception.pending) {
> - if (block_nested_events)
> + /*
> + * Only pending nested run can block an pending exception
> + * Otherwise an injected NMI/interrupt should either be
> + * lost or delivered to the nested hypervisor in EXITINTINFO
> + * */
> + if (svm->nested.nested_run_pending)
> return -EBUSY;
> if (!nested_exit_on_exception(svm))
> return 0;
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index b34e284bfa62a..20ed1a351b2d9 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -3810,9 +3810,14 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
>
> /*
> * Process any exceptions that are not debug traps before MTF.
> + *
> + * Note that only pending nested run can block an pending exception
> + * Otherwise an injected NMI/interrupt should either be
> + * lost or delivered to the nested hypervisor in EXITINTINFO
> */
> +
> if (vcpu->arch.exception.pending && !vmx_pending_dbg_trap(vcpu)) {
> - if (block_nested_events)
> + if (vmx->nested.nested_run_pending)
> return -EBUSY;
> if (!nested_vmx_check_exception(vcpu, &exit_qual))
> goto no_vmexit;
> @@ -3829,7 +3834,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu)
> }
>
> if (vcpu->arch.exception.pending) {
> - if (block_nested_events)
> + if (vmx->nested.nested_run_pending)
> return -EBUSY;
> if (!nested_vmx_check_exception(vcpu, &exit_qual))
> goto no_vmexit;
>
Powered by blists - more mailing lists