Re: [PATCH] ppc64: Fix possible race with set_pte on a present PTE

Benjamin Herrenschmidt
2004-05-25T22:07:41Z

> static inline void ptep_update_dirty_accessed(pte_t *ptep, pte_t entry, int dirty)
> {
> unsigned long bits = pte_value(entry) & (_PAGE_DIRTY | _PAGE_ACCESSED);
> unsigned long tmp;
>
> __asm__ __volatile__(
> "1: lwarx %0,0,%3\n\
> or %0,%2,%0\n\
> stwcx. %0,0,%3\n\
> bne- 1b"
> :"=&r" (tmp), "=m" (*ptep)
> :"r" (bits), "r" (ptep)
> :"cc");
> }
>
> /* Make asm-generic/pgtable.h know about it.. */
> #define ptep_update_dirty_accessed ptep_update_dirty_accessed

That looks good on a first look, I need to re-read the whole discussion since
yesterday through to make sure I didn't miss anything. Note that I'd rather
call the function ptep_set_* than ptep_update_* to make clear that it can
only ever be used to _set_ those bits.

Ben.