[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation
From: |
Jan Kiszka |
Subject: |
Re: [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation |
Date: |
Tue, 11 Oct 2011 20:17:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
On 2011-10-11 19:03, 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, inject-nmi request is handled as follows.
>
> - When in-kernel irqchip is disabled, inject LINT1 instead of NMI
> interrupt.
> - When in-kernel irqchip is enabled, send nmi event to kernel as the
> current code does. LINT1 should be emulated in kernel.
>
> (laijs) changed from v1:
> use KVM_CAP_LAPIC_NMI
> adjust the pic_deliver_nmi() API
>
> Signed-off-by: Kenji Kaneshige <address@hidden>
> Tested-by: Lai Jiangshan <address@hidden>
> ---
> hw/apic.c | 26 ++++++++++++++++++++++++++
> hw/apic.h | 1 +
> monitor.c | 6 +++++-
> 3 files changed, 32 insertions(+), 1 deletions(-)
>
> diff --git a/hw/apic.c b/hw/apic.c
> index 69d6ac5..76e8208 100644
> --- a/hw/apic.c
> +++ b/hw/apic.c
> @@ -205,6 +205,32 @@ void apic_deliver_pic_intr(DeviceState *d, int level)
> }
> }
>
> +void apic_deliver_nmi(DeviceState *d)
> +{
> + APICState *s = DO_UPCAST(APICState, busdev.qdev, d);
> +
> +#ifdef KVM_CAP_LAPIC_NMI
Unneeded #ifdef, x86 has this defined unconditionally.
> + static int kernel_lapic_nmi;
Some enum with symbolic states would be more readable.
> +
> + if (kernel_lapic_nmi == 0) {
> + if (!kvm_enabled() || !kvm_irqchip_in_kernel() ||
> + !kvm_check_extension(kvm_state, KVM_CAP_LAPIC_NMI)) {
This is wrong: If we run with in-kernel irqchip on an old kernel without
KVM_CAP_LAPIC_NMI, we still must not call into the user space APIC model.
As explained in some other mail, we could then emulate the missing
kernel feature by reading out the current in-kernel APIC state, testing
if LINT1 is unmasked, and then delivering the NMI directly.
Jan
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH] qemu-kvm: fix improper nmi emulation (was: Re: [PATCH] qemu: Fix inject-nmi), Lai Jiangshan, 2011/10/10
- Re: [Qemu-devel] [PATCH] qemu-kvm: fix improper nmi emulation, Jan Kiszka, 2011/10/10
- Re: [Qemu-devel] [PATCH] qemu-kvm: fix improper nmi emulation, Andreas Färber, 2011/10/10
- [Qemu-devel] [PATCH 1/2 V2] qemu-kvm: Synchronize kernel headers, Lai Jiangshan, 2011/10/11
- [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation, Lai Jiangshan, 2011/10/11
- Re: [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation,
Jan Kiszka <=
- Re: [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation, Lai Jiangshan, 2011/10/13
- Re: [Qemu-devel] [PATCH 2/2 V2] qemu-kvm: fix improper nmi emulation, Jan Kiszka, 2011/10/14
- [Qemu-devel] [PATCH 1/1 V4] qemu-kvm: fix improper nmi emulation, Lai Jiangshan, 2011/10/14
- Re: [Qemu-devel] [PATCH 1/1 V4] qemu-kvm: fix improper nmi emulation, Jan Kiszka, 2011/10/14
- Re: [Qemu-devel] [PATCH 1/1 V4] qemu-kvm: fix improper nmi emulation, Lai Jiangshan, 2011/10/14
- Re: [Qemu-devel] [PATCH 1/1 V4] qemu-kvm: fix improper nmi emulation, Jan Kiszka, 2011/10/14
- [Qemu-devel] [PATCH 1/2 V5] qemu-kvm: Synchronize kernel headers, Lai Jiangshan, 2011/10/14
- [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation, Lai Jiangshan, 2011/10/14
- Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation, Jan Kiszka, 2011/10/14
- Re: [Qemu-devel] [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation, Lai Jiangshan, 2011/10/14