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

From: Benjamin Herrenschmidt
Date: Tue May 25 2004 - 17:16:30 EST



> 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.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/