On Thu, 2021-02-25 at 17:05 +0100, Paolo Bonzini wrote: > 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@xxxxxxxxxx> > > Does this already fix some of your new test cases? Yes, this fixes the 'interrupted' interrupt delivery test, while patch fixes th 'interrupted' exception delivery. Both interrupted by an exception. Best regards Maxim Levitsky > > 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; > >