From: Jan Kiszka <jan.kiszka@web.de>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, sheng.yang@intel.com, gleb@redhat.com
Subject: Re: [PATCH 08/14] KVM: x86: Enable NMI Watchdog via in-kernel PIT source
Date: Sun, 28 Sep 2008 12:01:05 +0200 [thread overview]
Message-ID: <48DF55E1.2030102@web.de> (raw)
In-Reply-To: <48DF511A.6040100@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]
Avi Kivity wrote:
> jan.kiszka@siemens.com wrote:
>> LINT0 of the LAPIC can be used to route PIT events as NMI watchdog ticks
>> into the guest. This patch aligns the in-kernel irqchip emulation with
>> the user space irqchip with already supports this feature. The trick is
>> to route PIT interrupts to all LAPIC's LVT0 lines.
>>
>> Rebased and slightly polished patch originally posted by Sheng Yang.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> Signed-off-by: Sheng Yang <sheng.yang@intel.com>
>> ---
>> arch/x86/kvm/i8254.c | 15 +++++++++++++++
>> arch/x86/kvm/irq.h | 1 +
>> arch/x86/kvm/lapic.c | 34 +++++++++++++++++++++++++++++-----
>> 3 files changed, 45 insertions(+), 5 deletions(-)
>>
>> Index: b/arch/x86/kvm/i8254.c
>> ===================================================================
>> --- a/arch/x86/kvm/i8254.c
>> +++ b/arch/x86/kvm/i8254.c
>> @@ -594,10 +594,25 @@ void kvm_free_pit(struct kvm *kvm)
>>
>> static void __inject_pit_timer_intr(struct kvm *kvm)
>> {
>> + struct kvm_vcpu *vcpu;
>> + int i;
>> +
>> mutex_lock(&kvm->lock);
>> kvm_set_irq(kvm, 0, 1);
>> kvm_set_irq(kvm, 0, 0);
>> mutex_unlock(&kvm->lock);
>> +
>> + /*
>> + * Provides NMI watchdog support in IOAPIC mode.
>> + * The route is: PIT -> PIC -> LVT0 in NMI mode,
>> + * timer IRQs will continue to flow through the IOAPIC.
>> + */
>> + for (i = 0; i < KVM_MAX_VCPUS; ++i) {
>> + vcpu = kvm->vcpus[i];
>> + if (!vcpu)
>> + continue;
>> + kvm_apic_local_deliver(vcpu, APIC_LVT0);
>> + }
>> }
>>
>
> It would be better to gate this on a variable which is set only if this
> is actually necessary (e.g, does any vcpu have LVT0 set to NMI mode).
> Otherwise, we touch all vcpus up to 1000 times a second. As this is an
> optimization, it can be done later.
Good idea, will cook an add-on patch.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2008-09-28 10:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 7:30 [PATCH 00/14] Fix & enhance NMI support for KVM - v4 jan.kiszka
2008-09-26 7:30 ` [PATCH 01/14] KVM: VMX: include all IRQ window exits in statistics jan.kiszka
2008-09-26 7:30 ` [PATCH 02/14] KVM: VMX: Use INTR_TYPE_NMI_INTR instead of magic value jan.kiszka
2008-09-26 7:30 ` [PATCH 03/14] KVM: VMX: Support for NMI task gates jan.kiszka
2008-09-28 10:53 ` Gleb Natapov
2008-09-26 7:30 ` [PATCH 04/14] KVM: x86: Reset pending/inject NMI state on CPU reset jan.kiszka
2008-09-28 10:53 ` Gleb Natapov
2008-09-26 7:30 ` [PATCH 05/14] KVM: VMX: refactor/fix IRQ and NMI injectability determination jan.kiszka
2008-09-26 7:30 ` [PATCH 06/14] KVM: VMX: refactor IRQ and NMI window enabling jan.kiszka
2008-09-26 7:30 ` [PATCH 07/14] KVM: VMX: fix real-mode NMI support jan.kiszka
2008-09-26 7:30 ` [PATCH 08/14] KVM: x86: Enable NMI Watchdog via in-kernel PIT source jan.kiszka
2008-09-28 9:40 ` Avi Kivity
2008-09-28 10:01 ` Jan Kiszka [this message]
2008-09-26 7:30 ` [PATCH 09/14] KVM: x86: VCPU with pending NMI is runnabled jan.kiszka
2008-09-26 7:30 ` [PATCH 10/14] KVM: Kick NMI receiving VCPU jan.kiszka
2008-09-26 7:30 ` [PATCH 11/14] KVM: x86: Support for user space injected NMIs jan.kiszka
2008-09-26 7:30 ` [PATCH 12/14] KVM: VMX: Provide support " jan.kiszka
2008-09-26 7:30 ` [PATCH 13/14] KVM: VMX: work around lacking VNMI support jan.kiszka
2008-09-26 7:30 ` [PATCH 14/14] kvm-userspace: Enable NMI support for user space irqchip jan.kiszka
2008-09-28 9:45 ` [PATCH 00/14] Fix & enhance NMI support for KVM - v4 Avi Kivity
2008-09-28 10:00 ` Jan Kiszka
2008-09-28 10:05 ` Gleb Natapov
2008-09-28 10:57 ` Gleb Natapov
2008-09-30 17:00 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48DF55E1.2030102@web.de \
--to=jan.kiszka@web.de \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=sheng.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).