direct-io.hg

changeset 10129:d2f6e3d70f22

[IA64] pte_xchg added

pte_xchg added to atomically exchange pte.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Wed May 17 16:31:46 2006 -0600 (2006-05-17)
parents bd714da877c7
children 2fa8573b248f
files xen/arch/ia64/xen/domain.c xen/include/asm-ia64/linux-xen/asm/pgtable.h
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Wed May 17 15:53:14 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Wed May 17 16:31:46 2006 -0600
     1.3 @@ -746,6 +746,7 @@ struct page_info *
     1.4      set_pte(pte, pfn_pte(maddr >> PAGE_SHIFT,
     1.5                           __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
     1.6  
     1.7 +    mb ();
     1.8      //XXX CONFIG_XEN_IA64_DOM0_VP
     1.9      //    TODO racy
    1.10      set_gpfn_from_mfn(page_to_mfn(p), mpaddr >> PAGE_SHIFT);
    1.11 @@ -803,6 +804,7 @@ void
    1.12          set_pte(pte,
    1.13                  pfn_pte(physaddr >> PAGE_SHIFT,
    1.14                          __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
    1.15 +        mb ();
    1.16      } else
    1.17          printk("%s: mpaddr %lx already mapped!\n", __func__, mpaddr);
    1.18  }
    1.19 @@ -1123,13 +1125,13 @@ assign_domain_page_replace(struct domain
    1.20      struct mm_struct *mm = &d->arch.mm;
    1.21      pte_t* pte;
    1.22      pte_t old_pte;
    1.23 +    pte_t npte;
    1.24  
    1.25      pte = lookup_alloc_domain_pte(d, mpaddr);
    1.26  
    1.27      // update pte
    1.28 -    old_pte = ptep_get_and_clear(mm, mpaddr, pte);
    1.29 -    set_pte(pte, pfn_pte(mfn,
    1.30 -                         __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
    1.31 +    npte = pfn_pte(mfn, __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX));
    1.32 +    old_pte = ptep_xchg(mm, mpaddr, pte, npte);
    1.33      if (!pte_none(old_pte)) {
    1.34          unsigned long old_mfn;
    1.35          struct page_info* old_page;
     2.1 --- a/xen/include/asm-ia64/linux-xen/asm/pgtable.h	Wed May 17 15:53:14 2006 -0600
     2.2 +++ b/xen/include/asm-ia64/linux-xen/asm/pgtable.h	Wed May 17 16:31:46 2006 -0600
     2.3 @@ -397,6 +397,18 @@ ptep_get_and_clear(struct mm_struct *mm,
     2.4  #endif
     2.5  }
     2.6  
     2.7 +static inline pte_t
     2.8 +ptep_xchg(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t npte)
     2.9 +{
    2.10 +#ifdef CONFIG_SMP
    2.11 +	return __pte(xchg((long *) ptep, pte_val(npte)));
    2.12 +#else
    2.13 +	pte_t pte = *ptep;
    2.14 +	set_pte (ptep, npte);
    2.15 +	return pte;
    2.16 +#endif
    2.17 +}
    2.18 +
    2.19  #ifndef XEN
    2.20  static inline void
    2.21  ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)