From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 08/14] KVM: x86: Enable NMI Watchdog via in-kernel PIT source Date: Sun, 28 Sep 2008 12:01:05 +0200 Message-ID: <48DF55E1.2030102@web.de> References: <20080926073044.252540328@mchn012c.ww002.siemens.net> <20080926073045.926844425@mchn012c.ww002.siemens.net> <48DF511A.6040100@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1158AD974498A453A858ACD1" Cc: kvm@vger.kernel.org, sheng.yang@intel.com, gleb@redhat.com To: Avi Kivity Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:56463 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751487AbYI1KBI (ORCPT ); Sun, 28 Sep 2008 06:01:08 -0400 In-Reply-To: <48DF511A.6040100@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1158AD974498A453A858ACD1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Avi Kivity wrote: > jan.kiszka@siemens.com wrote: >> LINT0 of the LAPIC can be used to route PIT events as NMI watchdog tic= ks >> into the guest. This patch aligns the in-kernel irqchip emulation with= >> the user space irqchip with already supports this feature. The trick i= s >> 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 >> Signed-off-by: Sheng Yang >> --- >> 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 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- a/arch/x86/kvm/i8254.c >> +++ b/arch/x86/kvm/i8254.c >> @@ -594,10 +594,25 @@ void kvm_free_pit(struct kvm *kvm) >> =20 >> 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 =3D 0; i < KVM_MAX_VCPUS; ++i) { >> + vcpu =3D kvm->vcpus[i]; >> + if (!vcpu) >> + continue; >> + kvm_apic_local_deliver(vcpu, APIC_LVT0); >> + } >> } >> =20 >=20 > 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).=20 > 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 --------------enig1158AD974498A453A858ACD1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkjfVeEACgkQniDOoMHTA+lfCgCghGIP/yhdH0r1s50WitlsFNBx VpAAn2NEKYulurWhPhg807NBCnLbZFFz =Efqu -----END PGP SIGNATURE----- --------------enig1158AD974498A453A858ACD1--