qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] kernel/kvm: fix improper nmi emulation


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH] kernel/kvm: fix improper nmi emulation
Date: Mon, 10 Oct 2011 12:26:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0

On 10/10/2011 08:06 AM, Lai Jiangshan wrote:
From: Kenji Kaneshige<address@hidden>

Currently, NMI interrupt is blindly sent to all the vCPUs when NMI
button event happens. This doesn't properly emulate real hardware on
which NMI button event triggers LINT1. Because of this, NMI is sent to
the processor even when LINT1 is maskied in LVT. For example, this
causes the problem that kdump initiated by NMI sometimes doesn't work
on KVM, because kdump assumes NMI is masked on CPUs other than CPU0.

With this patch, KVM_NMI ioctl is handled as follows.

- When in-kernel irqchip is enabled, KVM_NMI ioctl is handled as a
   request of triggering LINT1 on the processor. LINT1 is emulated in
   in-kernel irqchip.

- When in-kernel irqchip is disabled, KVM_NMI ioctl is handled as a
   request of injecting NMI to the processor. This assumes LINT1 is
   already emulated in userland.

Please add a KVM_NMI section to Documentation/virtual/kvm/api.txt.


-static int kvm_vcpu_ioctl_nmi(struct kvm_vcpu *vcpu)
-{
-       kvm_inject_nmi(vcpu);
-
-       return 0;
-}
-
  static int vcpu_ioctl_tpr_access_reporting(struct kvm_vcpu *vcpu,
                                           struct kvm_tpr_access_ctl *tac)
  {
@@ -3038,9 +3031,10 @@ long kvm_arch_vcpu_ioctl(struct file *fi
                break;
        }
        case KVM_NMI: {
-               r = kvm_vcpu_ioctl_nmi(vcpu);
-               if (r)
-                       goto out;
+               if (irqchip_in_kernel(vcpu->kvm))
+                       kvm_apic_lint1_deliver(vcpu);
+               else
+                       kvm_inject_nmi(vcpu);
                r = 0;
                break;
        }

Why did you drop kvm_vcpu_ioctl_nmi()?

Please add (and document) a KVM_CAP flag that lets userspace know the new behaviour is supported.

--
error compiling committee.c: too many arguments to function




reply via email to

[Prev in Thread] Current Thread [Next in Thread]