From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755693AbbJ1IK6 (ORCPT ); Wed, 28 Oct 2015 04:10:58 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:34977 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755411AbbJ1IKV convert rfc822-to-8bit (ORCPT ); Wed, 28 Oct 2015 04:10:21 -0400 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) Subject: Re: [PATCH] KVM: x86: fix eflags state following processor init/reset From: Nadav Amit In-Reply-To: Date: Wed, 28 Oct 2015 10:10:34 +0200 Cc: Paolo Bonzini , kvm list , Linux Kernel Mailing List Content-Transfer-Encoding: 8BIT Message-Id: <287435CB-DC24-4E59-9320-A8F75DAA5555@gmail.com> References: To: Wanpeng Li X-Mailer: Apple Mail (2.3096.5) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here are my 5 cents. Note that vmx_vcpu_reset calls: vmcs_writel(GUEST_RFLAGS, 0x02); (And the RFLAGS value is not cached by KVM, so no consistency problem should occur.) You may want to change the value into constant or call a wrapper function for setting RFLAGS, but I don’t see something broken in the functionality. Regards, Nadav Wanpeng Li wrote: > Ping, :-) > On 10/21/15 2:28 PM, Wanpeng Li wrote: >> Reference SDM 3.4.3: >> >> Following initialization of the processor (either by asserting the >> RESET pin or the INIT pin), the state of the EFLAGS register is >> 00000002H. >> >> However, the eflags fixed bit is not set and other bits are also not >> cleared during the init/reset in kvm. >> >> This patch fix it by set eflags register to 00000002H following >> initialization of the processor. >> >> Signed-off-by: Wanpeng Li >> --- >> arch/x86/kvm/vmx.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index b680c2e..326f6ea 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -4935,6 +4935,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) >> vmx_set_efer(vcpu, 0); >> vmx_fpu_activate(vcpu); >> update_exception_bitmap(vcpu); >> + vmx_set_rflags(vcpu, X86_EFLAGS_FIXED); >> vpid_sync_context(vmx->vpid); >> } > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html