On Tue, 2007-07-17 at 14:42 -0700, Andrew Morton wrote:
> umm, OK, well what is the spec for this new interface which Martin
> is proposing to add?

Actually the interface is already there but so far it has been internal
to the generic tlb gather code and most architecture variants.

> It _seems_ to be that if the arch implements tlb_flush_mmu() then its
> tlb_finish_mmu() can (should) be a no-op?

Yes, tlb_flush_mmu() can be a no-op, it basically says that "now is a
good time to get rid of the tlbs / pages gathered in the tlb gather
structure so far". In case you have already freed everything
tlb_flush_mmu is naturally a no-op, e.g. for arm. 

> Or if the arch's tlb_finish_mmu() does a full mm "flush" (god I hate that
> term - here we meant writeback, and perhaps invalidate??)) then its
> tlb_flush_mmu() can (should) be a no-op.

This is one case where the architecture can flush at the beginning of
the tlb gather operation and tlb_flush_mmu turns into a nop.
There are four difference batched tlb operations:
1) change_protection does a number of ptep_get_and_clear()/set_pte_at()
calls followed by a flush_tlb_range().
2) dup_mmap/copy_page_range does ptep_set_wrprotect() on a choice of
ptes followed by a flush_tlb_mm().
3) unmap_region() and zap_page_range() use the tlb gatherer with
fullmm==0 which will make zap_pte_range() call ptep_get_and_clear_full()
with fullmm==0.
4) exit_map() uses the tlb gatherer with fullmm==1 which will make
zap_pte_range() call ptep_get_and_clear_full() with fullmm==1.

So we have the "full" flush, the partial flush, the wrprotect flush and
the change protection flush. I've been halfway through the code that
introduces the notion of these four different flush types before I gave
up because it resulted in too much code.

> Or something like that.  Martin, I'd suggest that an update to
> Documentation/cachetlb.txt is in order, spell this all out.

Ok, I will see what I can do.

> Doing this properly would require that Documentation/cachetlb.txt say
> something about tlb_gather_mmu() and tlb_finish_mmu() too, I guess.
> Please ;)

That is the sore spot, we (I?) have to write documentation for all the
primitives of the tlb gatherer.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.


-
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to