From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)
Date: Tue, 8 Dec 2009 22:40:14 +0800 [thread overview]
Message-ID: <20091208144014.GA15355@syang10-desktop> (raw)
In-Reply-To: <4B1E1E3B.3020704@redhat.com>
On Tue, Dec 08, 2009 at 11:36:59AM +0200, Avi Kivity wrote:
> On 12/08/2009 09:57 AM, Sheng Yang wrote:
> >vcpu->arch.cr0 = cr0;
> >>- vmx_set_cr4(vcpu, vcpu->arch.cr4);
> >>+ vmx_set_cr4(vcpu, kvm_read_cr4(vcpu));
> >> }
> >Another place accessed cr4 directly, in ept_update_paging_mode_cr4()
> >
>
> That one is called from vmx_set_cr4(); at that time CR4_READ_SHADOW
> is not up-to-date and vmx_decache_cr4_guest_bits() will actually
> corrupt vcpu->arch.cr4 (except it won't be called, since cr4.pae is
> never guest owned).
Yes, you are right...
>
> But you are right, I should have placed a comment. I'll add a patch
> that inlines ept_update_paging_mode_cr4 into its caller so it can
> access the cr4 parameter directly instead of vcpu->arch.cr4.
Just notice another thing, seems the cr4_guest_owned_bits' initial value is
wrong. It should be ~KVM_GUEST_CR4_MASK rather than KVM_GUEST_CR4_MASK in this
patch IIUC.
--
regards
Yang, Sheng
next prev parent reply other threads:[~2009-12-08 14:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-07 10:47 [PATCH 0/4] cr4 optimizations for vmx/ept Avi Kivity
2009-12-07 10:47 ` [PATCH 1/4] KVM: VMX: Move some cr[04] related constants to vmx.c Avi Kivity
2009-12-07 10:47 ` [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4) Avi Kivity
2009-12-08 7:57 ` Sheng Yang
2009-12-08 9:36 ` Avi Kivity
2009-12-08 14:40 ` Sheng Yang [this message]
2009-12-08 14:44 ` Avi Kivity
2009-12-07 10:47 ` [PATCH 3/4] KVM: VMX: Make guest cr4 mask more conservative Avi Kivity
2009-12-07 10:47 ` [PATCH 4/4] KVM: VMX: When using ept, allow the guest to own cr4.pge Avi Kivity
2009-12-15 10:44 ` [PATCH 0/4] cr4 optimizations for vmx/ept Avi Kivity
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=20091208144014.GA15355@syang10-desktop \
--to=sheng@linux.intel.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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.