Re: ptep_establish/establish_pte needs set_pte_atomic and all set_pte must be written in asm

From: Andrea Arcangeli
Date: Sat Sep 25 2004 - 19:37:02 EST


On Sat, Sep 25, 2004 at 07:44:05PM -0400, Rik van Riel wrote:
> On Sat, 25 Sep 2004, Andrea Arcangeli wrote:
>
> > set_pte), while something like this should be fine:
> >
> > ptep_get_and_clear
> > set_pte
> > flush_tlb
>
> Almost. Think of software TLB refills, especially HPTE.
> The order needs to be:
>
> ptep_get_and_clear
> flush_tlb
> set_pte

Interesting point. I sure agree it's saner to have the flush_tlb in
between ptep_get_and_clear and set_pte, I said the other version just
because I'm thinking hardware TLB and it shouldn't make any difference
on hardware TLB anyways, does it?

> Any page faults happening "in the middle" will end up as
> virtual no-ops once they grab the page_table_lock.

I'm not very fond on software TLBs and their internal locking, but
exactly because of what you said ("they grab the page_table_lock."), how
can the software TLB ever care about the flush_tlb in between
ptep_get_and_clear and set_pte?

ptep_establish is obviously always called with the page_table_lock hold.
Nobody is allowed to call ptep_establish without it. So a larger code
sequence of my version expands to:

spin_lock(&page_table_lock)
ptep_establish() {
ptep_get_and_clear
set_pte
flush_tlb
}
spin_unlock(&page_table_lock)

How can a software TLB care about a tlb flush in between two pieces of
code that are anyways under the page_table_lock?
-
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/