From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Nadav Amit <nadav.amit@gmail.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86: Reset RFLAGS state following processor init/reset
Date: Tue, 3 Nov 2015 12:54:56 +0100 [thread overview]
Message-ID: <5638A090.9040606@redhat.com> (raw)
In-Reply-To: <BLU437-SMTP23899BC8258756A9326950802B0@phx.gbl>
On 03/11/2015 12:40, Wanpeng Li wrote:
> Reference SDM Volume 1 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 reset eflags register to 00000002H following initialization
> of the processor.
>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> v1 -> v2:
> * use vmcs_writel
>
> 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..1a95ef7 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);
> + vmcs_writel(GUEST_RFLAGS, X86_EFLAGS_FIXED);
>
> vpid_sync_context(vmx->vpid);
> }
>
No, this is doing exactly the same thing that is already done elsewhere
in vmx_vcpu_reset (which Nadav pointed out to you). So it's not just a
pointless addition with no effect at all; it's wrong, because it
introduces duplication.
Please answer this question: is there a bug or not?
If yes, then using kvm_set_rflags as in v1 is the right thing. However,
you have to remove the _existing_ vmcs_writel call in vmx_vcpu_reset.
Also, if there is a bug you have to explain it in the commit message and
provide a testcase. By the way, I am still waiting for the VPID test cases.
If no, then this is a cleanup, we can still do the change but you have
to explain this in the commit message.
Paolo
prev parent reply other threads:[~2015-11-03 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 11:40 [PATCH v2] KVM: x86: Reset RFLAGS state following processor init/reset Wanpeng Li
2015-11-03 11:54 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5638A090.9040606@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nadav.amit@gmail.com \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.