From: Anthony Liguori <aliguori@linux.vnet.ibm.com>
To: Robert Phillips <rsp.vi.xen@gmail.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: vmcs GUEST_CR0 unused?
Date: Thu, 01 Feb 2007 16:06:11 -0600 [thread overview]
Message-ID: <45C26453.6080401@linux.vnet.ibm.com> (raw)
In-Reply-To: <fc060d960702011349w37c18be3j3791a19540fd5402@mail.gmail.com>
Robert Phillips wrote:
> Why does the vmx code maintain hvm_vmx.cpu_cr0?
The implementation of hvm_funcs.get_guest_ctrl_reg() would be awkward
since you would have make sure to load the vmcs for the VCPU you're
interested in on the current PCPU before attempting to vmread(GUEST_CR0).
Regards,
Anthony Liguori
> I see code in vmx.c that keeps v->arch.hvm_vmx.cpu_cr0 up to date, and
> each change is faithfully written to the vmcs using __vmwrite(GUEST_CR0,
> ...)
> I also see that the CR0_GUEST_HOST_MASK is always all ones (~0UL), set
> in construct_vmcs() and never modified.
>
> However according to section 2.6.6 of the VT specification the value in
> GUEST_CR0 is irrelevant if CR0_GUEST_HOST_MASK is all ones.
> When the guest reads CR0, the mask will force it to see only the bits in
> CR0_READ_SHADOW.
> When the guest modifies CR0, the mask will force a vmexit.
>
> So the vmcs value in GUEST_CR0 is never visible to the guest and never
> really needed by the host.
>
> It looks to me like the code that maintains hvm_vmx.cpu_cr0 and
> GUEST_CR0 is superfluous.
>
> The same argument applies to hvm_vmx.cup_cr4 and GUEST_CR4.
>
> Am I missing something?
>
> --
> --------------------------------------------------------------------
> Robert S. Phillips Virtual Iron Software
> rphillips@virtualiron.com
> <mailto:rphillips@virtualiron.com> Tower 1, Floor 2
> 978-849-1220 900 Chelmsford Street
> Lowell, MA 01851
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2007-02-01 22:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-01 21:49 vmcs GUEST_CR0 unused? Robert Phillips
2007-02-01 22:06 ` Anthony Liguori [this message]
2007-02-01 23:40 ` Keir Fraser
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=45C26453.6080401@linux.vnet.ibm.com \
--to=aliguori@linux.vnet.ibm.com \
--cc=rsp.vi.xen@gmail.com \
--cc=xen-devel@lists.xensource.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.