From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 10/12] KVM: nVMX: Update guest activity state field on L2 exits Date: Sun, 05 Jan 2014 21:01:34 +0100 Message-ID: <52C9BA1E.2050001@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , Marcelo Tosatti , kvm To: Jan Kiszka Return-path: Received: from mail-ea0-f175.google.com ([209.85.215.175]:57249 "EHLO mail-ea0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbaAEUBj (ORCPT ); Sun, 5 Jan 2014 15:01:39 -0500 Received: by mail-ea0-f175.google.com with SMTP id z10so7585500ead.34 for ; Sun, 05 Jan 2014 12:01:37 -0800 (PST) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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 *vcpu, struct vmcs12 *vmcs12, > vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); > vmcs12->guest_pending_dbg_exceptions = > vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS); > + if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED) > + vmcs12->guest_activity_state = GUEST_ACTIVITY_HLT; > + else > + vmcs12->guest_activity_state = GUEST_ACTIVITY_ACTIVE; > > if ((vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER) && > (vmcs12->vm_exit_controls & VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)) > 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 cannot think of any other control that we do not support disabling, but perhaps I'm missing something. Paolo