WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Not call paging_update_cr3(v) when guest reads from CR3?

To: "Li, Xin B" <xin.b.li@xxxxxxxxx>
Subject: Re: [Xen-devel] Not call paging_update_cr3(v) when guest reads from CR3?
From: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
Date: Wed, 11 Apr 2007 17:05:11 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 11 Apr 2007 09:03:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <B30DA1341B0CFA4893EF8A36B40B5C5D01001223@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <B30DA1341B0CFA4893EF8A36B40B5C5D01001223@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
At 23:57 +0800 on 11 Apr (1176335861), Li, Xin B wrote:
> Hi Tim, 
> I think it's not necessary to call paging_update_cr3(v) when guest reads
> from CR3, am I right?

Reading CR3 is safe, but when the guest writes the same value to CR3
twice in a row (which is the code your patch touches) we do need the
call.  CR3 writes have side-effects apart from changing the top of the
pagetable tree -- e.g., on PAE systems, we must re-read the four
top-level entries.

Cheers,

Tim

> Thanks
> -Xin
> 
> 
> diff -r 38204c93428e xen/arch/x86/hvm/vmx/vmx.c
> --- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Apr 11 16:08:35 2007 +0100
> +++ b/xen/arch/x86/hvm/vmx/vmx.c        Wed Apr 11 22:27:35 2007 +0800
> @@ -2103,16 +2103,14 @@ static int mov_to_cr(int gp, int cr, str
>          /*
>           * We make a new one if the shadow does not exist.
>           */
> -        if (value == v->arch.hvm_vmx.cpu_cr3) {
> +        if ( value == v->arch.hvm_vmx.cpu_cr3 ) {
>              /*
>               * This is simple TLB flush, implying the guest has
>               * removed some translation or changed page attributes.
> -             * We simply invalidate the shadow.
>               */
>              mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
>              if (mfn != pagetable_get_pfn(v->arch.guest_table))
>                  goto bad_cr3;
> -            paging_update_cr3(v);
>          } else {
>              /*
>               * If different, make a shadow. Check if the PDBR is valid
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, XenSource UK Limited
Registered office c/o EC2Y 5EB, UK; company number 05334508

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>