[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.