From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 10/12] KVM: nVMX: Update guest activity state field on L2 exits Date: Sun, 05 Jan 2014 21:16:33 +0100 Message-ID: <52C9BDA1.7030006@web.de> References: <52C9BA1E.2050001@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ndQE48pIqPEfBp93qs6SFKlC7wLrcQtL8" Cc: Gleb Natapov , Marcelo Tosatti , kvm To: Paolo Bonzini Return-path: Received: from mout.web.de ([212.227.15.14]:57089 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276AbaAEUQm (ORCPT ); Sun, 5 Jan 2014 15:16:42 -0500 Received: from mchn199C.mchp.siemens.de ([95.157.58.223]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LdEsP-1VZ3cH16VF-00iVHR for ; Sun, 05 Jan 2014 21:16:40 +0100 In-Reply-To: <52C9BA1E.2050001@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ndQE48pIqPEfBp93qs6SFKlC7wLrcQtL8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2014-01-05 21:01, Paolo Bonzini wrote: > Il 04/01/2014 18:47, Jan Kiszka ha scritto: >> From: Jan Kiszka >> >> Set guest activity state in L1's VMCS according to the VCPUs mp_state.= >> This ensures we report the correct state in case we L2 executed HLT or= >> if we put L2 into HLT state and it was now woken up by an event. >> >> Signed-off-by: Jan Kiszka >> --- >> arch/x86/kvm/vmx.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index bde8ddd..1245ff1 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -8223,6 +8223,10 @@ static void prepare_vmcs12(struct kvm_vcpu *vcp= u, struct vmcs12 *vmcs12, >> vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); >> vmcs12->guest_pending_dbg_exceptions =3D >> vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS); >> + if (vcpu->arch.mp_state =3D=3D KVM_MP_STATE_HALTED) >> + vmcs12->guest_activity_state =3D GUEST_ACTIVITY_HLT; >> + else >> + vmcs12->guest_activity_state =3D GUEST_ACTIVITY_ACTIVE; >> =20 >> if ((vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TI= MER) && >> (vmcs12->vm_exit_controls & VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)) >> >=20 > So, without this patch, CPU_BASED_HLT_EXITING should have been set in > nested_vmx_procbased_ctls_low (because disabling HLT exits means L2 can= > go "spontaneously" to KVM_MP_STATE_HALTED and without this patch it > would exit the HLT on a subsequent unrelated vmexit). I guess so. I've no hardware around that does not support GUEST_ACTIVITY_HLT, but it makes most sense that those machines enforced HLT_EXITING that way - so should have we. But that inconsistency is fixed now, hopefully. >=20 > I cannot think of any other control that we do not support disabling, > but perhaps I'm missing something. Yeah, I wouldn't be surprised to find a few more broken corner cases. As the number of hypervisor continue to increase, they may help to find them. Reminds me that I still want to run [1] over my queue. They claim to use the preemption timer extensively. Jan [1] http://muen.codelabs.ch/ --ndQE48pIqPEfBp93qs6SFKlC7wLrcQtL8 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.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlLJvaYACgkQitSsb3rl5xSrbwCg2bjaIgh2NyyVFj6OoLP3yRvP qeEAn3R41TT6ulGNnIMAGs7ThKRasnuZ =FOf6 -----END PGP SIGNATURE----- --ndQE48pIqPEfBp93qs6SFKlC7wLrcQtL8--