From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: x86: Avoid busy loops over uninjectable pending APIC timers Date: Sun, 28 Apr 2013 12:15:05 +0200 Message-ID: <517CF6A9.4090500@web.de> References: <5144DAC3.7080401@web.de> <20130317084705.GC11223@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2GKPHGULFGDHOTOLFMWKC" Cc: Marcelo Tosatti , kvm To: Gleb Natapov Return-path: Received: from mout.web.de ([212.227.15.4]:54357 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753158Ab3D1KPI (ORCPT ); Sun, 28 Apr 2013 06:15:08 -0400 In-Reply-To: <20130317084705.GC11223@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2GKPHGULFGDHOTOLFMWKC Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2013-03-17 09:47, Gleb Natapov wrote: > On Sat, Mar 16, 2013 at 09:49:07PM +0100, Jan Kiszka wrote: >> From: Jan Kiszka >> >> If the guest didn't take the last APIC timer interrupt yet and generat= es >> another one on top, e.g. via periodic mode, we do not block the VCPU >> even if the guest state is halted. The reason is that >> apic_has_pending_timer continues to return a non-zero value. >> >> Fix this busy loop by taking the IRR content for the LVT vector in >> apic_has_pending_timer into account. >> > Just drop coalescing tacking for lapic interrupt. After posted interrup= t > will be merged __apic_accept_irq() will not longer return coalescing > information, so the code will be dead anyway. If I understood the follow-up discussion correctly, we aren't dropping de-coalescing support yet. So how to proceed with this fix here? Jan >=20 >> Signed-off-by: Jan Kiszka >> --- >> >> Not a critical issue, we are looping fully interruptible, but it's ugl= y >> to do so IMHO. >> >> arch/x86/kvm/lapic.c | 4 +++- >> 1 files changed, 3 insertions(+), 1 deletions(-) >> >> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c >> index a8e9369..658abf5 100644 >> --- a/arch/x86/kvm/lapic.c >> +++ b/arch/x86/kvm/lapic.c >> @@ -1473,7 +1473,9 @@ int apic_has_pending_timer(struct kvm_vcpu *vcpu= ) >> struct kvm_lapic *apic =3D vcpu->arch.apic; >> =20 >> if (kvm_vcpu_has_lapic(vcpu) && apic_enabled(apic) && >> - apic_lvt_enabled(apic, APIC_LVTT)) >> + apic_lvt_enabled(apic, APIC_LVTT) && >> + !apic_test_vector(apic_lvt_vector(apic, APIC_LVTT), >> + apic->regs + APIC_IRR)) >> return atomic_read(&apic->lapic_timer.pending); >> =20 >> return 0; >> --=20 >> 1.7.3.4 >=20 > -- > Gleb. ------enig2GKPHGULFGDHOTOLFMWKC 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.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlF89qkACgkQitSsb3rl5xS6OgCeLI5/8dr5gHWLte+P2Lmd09yz ua4An0v02T+rMCCxHlqkc13T8hDHItEY =UbB7 -----END PGP SIGNATURE----- ------enig2GKPHGULFGDHOTOLFMWKC--