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] [PATCH] ept: Put locks around ept_get_entry

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] ept: Put locks around ept_get_entry
From: Christoph Egger <Christoph.Egger@xxxxxxx>
Date: Fri, 27 Aug 2010 13:38:30 +0200
Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Delivery-date: Fri, 27 Aug 2010 04:41:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <e17c8f37a2c2bce9cef6.1282908237@gdunlap-desktop>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <e17c8f37a2c2bce9cef6.1282908237@gdunlap-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.10
On Friday 27 August 2010 13:23:57 George Dunlap wrote:
> There's a subtle race in ept_get_entry, such that if tries to read an
> entry that ept_set_entry is modifying, it gets neither the old entry
> nor the new entry, but empty.  In the case of multi-cpu populate-on-demand
> guests, this manifests as a guest crash when one vcpu tries to read a
> page which another page is trying to populate, and ept_get_entry returns
> p2m_mmio_dm.
>
> This bug can also be fixed by making both ept_set_entry and ept_next_level
> access-once (i.e., ept_next_level reads full ept_entry and then works with
> local value; ept_set_entry construct the entry locally and then sets it
> in one write).  But there doesn't seem to be any major performance
> implications of just making ept_get_entry use locks; so the simpler, the
> better.
>
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

Please use p2m_get_hostp2m(d) instead of d->arch.p2m.

Christoph


> diff -r 3c4c3d48a835 -r e17c8f37a2c2 xen/arch/x86/mm/hap/p2m-ept.c
> --- a/xen/arch/x86/mm/hap/p2m-ept.c   Thu Aug 26 11:16:56 2010 +0100
> +++ b/xen/arch/x86/mm/hap/p2m-ept.c   Fri Aug 27 12:23:27 2010 +0100
> @@ -431,6 +431,10 @@
>      int i;
>      int ret = 0;
>      mfn_t mfn = _mfn(INVALID_MFN);
> +    int do_locking = !p2m_locked_by_me(d->arch.p2m);
> +
> +    if ( do_locking )
> +        p2m_lock(d->arch.p2m);
>
>      *t = p2m_mmio_dm;
>
> @@ -507,6 +511,8 @@
>      }
>
>  out:
> +    if ( do_locking )
> +        p2m_unlock(d->arch.p2m);
>      unmap_domain_page(table);
>      return mfn;
>  }
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632


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

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