Messages in this thread | | | Subject | Re: [PATCH 3/4] KVM/VMX: Invoke NMI non-IST entry instead of IST entry | From | Paolo Bonzini <> | Date | Tue, 4 May 2021 10:10:42 +0200 |
| |
On 03/05/21 22:02, Thomas Gleixner wrote: > but this and the next patch are not really needed. The below avoids the > extra kvm_before/after() dance in both places. Hmm?
Sure, that's good as well.
Paolo
> Thanks, > > tglx > --- > --- a/arch/x86/kernel/nmi.c > +++ b/arch/x86/kernel/nmi.c > @@ -526,6 +526,10 @@ DEFINE_IDTENTRY_RAW(exc_nmi) > > DEFINE_IDTENTRY_RAW_ALIAS(exc_nmi, exc_nmi_noist); > > +#if IS_MODULE(CONFIG_KVM_INTEL) > +EXPORT_SYMBOL_GPL(asm_exc_nmi_noist); > +#endif > + > void stop_nmi(void) > { > ignore_nmis++; > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -36,6 +36,7 @@ > #include <asm/debugreg.h> > #include <asm/desc.h> > #include <asm/fpu/internal.h> > +#include <asm/idtentry.h> > #include <asm/io.h> > #include <asm/irq_remapping.h> > #include <asm/kexec.h> > @@ -6395,18 +6396,17 @@ static void vmx_apicv_post_state_restore > > void vmx_do_interrupt_nmi_irqoff(unsigned long entry); > > -static void handle_interrupt_nmi_irqoff(struct kvm_vcpu *vcpu, u32 intr_info) > +static void handle_interrupt_nmi_irqoff(struct kvm_vcpu *vcpu, > + unsigned long entry) > { > - unsigned int vector = intr_info & INTR_INFO_VECTOR_MASK; > - gate_desc *desc = (gate_desc *)host_idt_base + vector; > - > kvm_before_interrupt(vcpu); > - vmx_do_interrupt_nmi_irqoff(gate_offset(desc)); > + vmx_do_interrupt_nmi_irqoff(entry); > kvm_after_interrupt(vcpu); > } > > static void handle_exception_nmi_irqoff(struct vcpu_vmx *vmx) > { > + const unsigned long nmi_entry = (unsigned long)asm_exc_nmi_noist; > u32 intr_info = vmx_get_intr_info(&vmx->vcpu); > > /* if exit due to PF check for async PF */ > @@ -6417,18 +6417,20 @@ static void handle_exception_nmi_irqoff( > kvm_machine_check(); > /* We need to handle NMIs before interrupts are enabled */ > else if (is_nmi(intr_info)) > - handle_interrupt_nmi_irqoff(&vmx->vcpu, intr_info); > + handle_interrupt_nmi_irqoff(&vmx->vcpu, nmi_entry); > } > > static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu) > { > u32 intr_info = vmx_get_intr_info(vcpu); > + unsigned int vector = intr_info & INTR_INFO_VECTOR_MASK; > + gate_desc *desc = (gate_desc *)host_idt_base + vector; > > if (WARN_ONCE(!is_external_intr(intr_info), > "KVM: unexpected VM-Exit interrupt info: 0x%x", intr_info)) > return; > > - handle_interrupt_nmi_irqoff(vcpu, intr_info); > + handle_interrupt_nmi_irqoff(vcpu, gate_offset(desc)); > } > > static void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu)
| |