ppc64 PTE hacks

Anton Blanchard anton at samba.org
Mon Jan 26 23:09:28 EST 2004


I noticed another thing that worries me:

static inline int ptep_test_and_clear_dirty(pte_t *ptep)
{
       unsigned long old;

       old = pte_update(ptep, _PAGE_DIRTY | _PAGE_HPTEFLAGS);
       if (old & _PAGE_HASHPTE)
               hpte_update(ptep, old, 0);
       return (old & _PAGE_DIRTY) != 0;
}

#define ptep_clear_flush_dirty(__vma, __address, __ptep)                \
({                                                                      \
        int __dirty = ptep_test_and_clear_dirty(__ptep);                \
        if (__dirty)                                                    \
                flush_tlb_page(__vma, __address);                       \
        __dirty;                                                        \
})

We call ptep_clear_flush_dirty in msync. Even if the pte was not dirty
ptep_test_and_clear_dirty will add the pte to the batch and zero hpteflags.
Notice how we only flush if the pte was dirty. So we can miss the flush...

We can fix this in a few ways.

- Code the flush into ptep_test_and_clear_dirty since msync is the only place
  that uses it.
- Fix the generic ptep_clear_flush_dirty code to always call flush_tlb_page
- Create our own version of ptep_clear_flush_dirty
- Fix hpte_update to not cast out the hpte on DIRTY bit transitions

Thoughts?

Anton

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list