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

[Xen-changelog] [IA64] pte_xchg added



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID d2f6e3d70f223f37ef468ffe7a5dcaa82cfc7c1e
# Parent  bd714da877c73e03a26fc3d25d3ff58e923fff78
[IA64] pte_xchg added

pte_xchg added to atomically exchange pte.

Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx>
---
 xen/arch/ia64/xen/domain.c                   |    8 +++++---
 xen/include/asm-ia64/linux-xen/asm/pgtable.h |   12 ++++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff -r bd714da877c7 -r d2f6e3d70f22 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Wed May 17 15:53:14 2006 -0600
+++ b/xen/arch/ia64/xen/domain.c        Wed May 17 16:31:46 2006 -0600
@@ -746,6 +746,7 @@ __assign_new_domain_page(struct domain *
     set_pte(pte, pfn_pte(maddr >> PAGE_SHIFT,
                          __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
 
+    mb ();
     //XXX CONFIG_XEN_IA64_DOM0_VP
     //    TODO racy
     set_gpfn_from_mfn(page_to_mfn(p), mpaddr >> PAGE_SHIFT);
@@ -803,6 +804,7 @@ __assign_domain_page(struct domain *d,
         set_pte(pte,
                 pfn_pte(physaddr >> PAGE_SHIFT,
                         __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
+        mb ();
     } else
         printk("%s: mpaddr %lx already mapped!\n", __func__, mpaddr);
 }
@@ -1123,13 +1125,13 @@ assign_domain_page_replace(struct domain
     struct mm_struct *mm = &d->arch.mm;
     pte_t* pte;
     pte_t old_pte;
+    pte_t npte;
 
     pte = lookup_alloc_domain_pte(d, mpaddr);
 
     // update pte
-    old_pte = ptep_get_and_clear(mm, mpaddr, pte);
-    set_pte(pte, pfn_pte(mfn,
-                         __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
+    npte = pfn_pte(mfn, __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX));
+    old_pte = ptep_xchg(mm, mpaddr, pte, npte);
     if (!pte_none(old_pte)) {
         unsigned long old_mfn;
         struct page_info* old_page;
diff -r bd714da877c7 -r d2f6e3d70f22 
xen/include/asm-ia64/linux-xen/asm/pgtable.h
--- a/xen/include/asm-ia64/linux-xen/asm/pgtable.h      Wed May 17 15:53:14 
2006 -0600
+++ b/xen/include/asm-ia64/linux-xen/asm/pgtable.h      Wed May 17 16:31:46 
2006 -0600
@@ -397,6 +397,18 @@ ptep_get_and_clear(struct mm_struct *mm,
 #endif
 }
 
+static inline pte_t
+ptep_xchg(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t npte)
+{
+#ifdef CONFIG_SMP
+       return __pte(xchg((long *) ptep, pte_val(npte)));
+#else
+       pte_t pte = *ptep;
+       set_pte (ptep, npte);
+       return pte;
+#endif
+}
+
 #ifndef XEN
 static inline void
 ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)

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


 


Rackspace

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