linux/arch/powerpc/mm
Benjamin Herrenschmidt 8d30c14cab powerpc/mm: Rework I$/D$ coherency (v3)
This patch reworks the way we do I and D cache coherency on PowerPC.

The "old" way was split in 3 different parts depending on the processor type:

   - Hash with per-page exec support (64-bit and >= POWER4 only) does it
at hashing time, by preventing exec on unclean pages and cleaning pages
on exec faults.

   - Everything without per-page exec support (32-bit hash, 8xx, and
64-bit < POWER4) does it for all page going to user space in update_mmu_cache().

   - Embedded with per-page exec support does it from do_page_fault() on
exec faults, in a way similar to what the hash code does.

That leads to confusion, and bugs. For example, the method using update_mmu_cache()
is racy on SMP where another processor can see the new PTE and hash it in before
we have cleaned the cache, and then blow trying to execute. This is hard to hit but
I think it has bitten us in the past.

Also, it's inefficient for embedded where we always end up having to do at least
one more page fault.

This reworks the whole thing by moving the cache sync into two main call sites,
though we keep different behaviours depending on the HW capability. The call
sites are set_pte_at() which is now made out of line, and ptep_set_access_flags()
which joins the former in pgtable.c

The base idea for Embedded with per-page exec support, is that we now do the
flush at set_pte_at() time when coming from an exec fault, which allows us
to avoid the double fault problem completely (we can even improve the situation
more by implementing TLB preload in update_mmu_cache() but that's for later).

If for some reason we didn't do it there and we try to execute, we'll hit
the page fault, which will do a minor fault, which will hit ptep_set_access_flags()
to do things like update _PAGE_ACCESSED or _PAGE_DIRTY if needed, we just make
this guys also perform the I/D cache sync for exec faults now. This second path
is the catch all for things that weren't cleaned at set_pte_at() time.

For cpus without per-pag exec support, we always do the sync at set_pte_at(),
thus guaranteeing that when the PTE is visible to other processors, the cache
is clean.

For the 64-bit hash with per-page exec support case, we keep the old mechanism
for now. I'll look into changing it later, once I've reworked a bit how we
use _PAGE_EXEC.

This is also a first step for adding _PAGE_EXEC support for embedded platforms

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2009-02-11 16:00:10 +11:00
..
40x_mmu.c powerpc/40x: Limit allocable DRAM during early mapping 2008-11-13 10:10:56 -05:00
44x_mmu.c powerpc: rework 4xx PTE access and TLB miss 2008-07-09 13:36:17 -04:00
fault.c powerpc/mm: Rework I$/D$ coherency (v3) 2009-02-11 16:00:10 +11:00
fsl_booke_mmu.c Merge commit 'kumar/next' into next 2009-02-11 13:37:44 +11:00
gup.c powerpc: Get USE_STRICT_MM_TYPECHECKS working again 2008-10-14 10:35:27 +11:00
hash_low_32.S powerpc: Fix missing 'blr' in _tlbia() 2008-12-21 02:54:25 -07:00
hash_low_64.S powerpc: Free a PTE bit on ppc64 with 64K pages 2008-06-30 22:30:53 +10:00
hash_native_64.c [POWERPC] Use 1TB segments 2007-10-12 14:05:17 +10:00
hash_utils_64.c powerpc: Don't use a 16G page if beyond mem= limits 2008-10-22 15:01:21 +11:00
hugetlbpage.c mm: report the MMU pagesize in /proc/pid/smaps 2009-01-06 15:58:58 -08:00
init_32.c powerpc/32: Add the ability for a classic ppc kernel to be loaded at 32M 2008-12-23 15:13:29 +11:00
init_64.c powerpc: Get USE_STRICT_MM_TYPECHECKS working again 2008-10-14 10:35:27 +11:00
Makefile powerpc/mm: Split low level tlb invalidate for nohash processors 2008-12-21 14:21:16 +11:00
mem.c powerpc/mm: Rework I$/D$ coherency (v3) 2009-02-11 16:00:10 +11:00
mmap.c powerpc/mm: Move 64-bit unmapped_area to top of address space 2009-02-11 16:00:07 +11:00
mmu_context_hash32.c powerpc/mm: Split mmu_context handling 2008-12-21 14:21:15 +11:00
mmu_context_hash64.c powerpc/mm: Split mmu_context handling 2008-12-21 14:21:15 +11:00
mmu_context_nohash.c powerpc/mm: Runtime allocation of mmu context maps for nohash CPUs 2008-12-21 14:21:16 +11:00
mmu_decl.h Merge commit 'kumar/kumar-next' into next 2009-01-13 13:59:03 +11:00
numa.c powerpc/numa: Remove redundant find_cpu_node() 2009-02-11 13:37:59 +11:00
pgtable_32.c powerpc/fsl-booke: Fix mapping functions to use phys_addr_t 2009-02-09 21:11:55 -06:00
pgtable_64.c powerpc ioremap_prot 2008-07-24 10:47:15 -07:00
pgtable.c powerpc/mm: Rework I$/D$ coherency (v3) 2009-02-11 16:00:10 +11:00
ppc_mmu_32.c powerpc/mm: Fix handling of _PAGE_COHERENT in BAT setup code 2009-01-28 17:15:52 +11:00
slb_low.S [POWERPC] vmemmap fixes to use smaller pages 2008-05-15 20:49:25 +10:00
slb.c [POWERPC] vmemmap fixes to use smaller pages 2008-05-15 20:49:25 +10:00
slice.c powerpc: is_hugepage_only_range() must account for both 4kB and 64kB slices 2009-01-16 16:15:16 +11:00
stab.c powerpc: Change u64/s64 to a long long integer type 2009-01-13 14:47:59 +11:00
subpage-prot.c [POWERPC] Provide a way to protect 4k subpages when using 64k pages 2008-01-24 10:06:01 +11:00
tlb_hash32.c powerpc/mm: Add SMP support to no-hash TLB handling 2008-12-21 14:21:16 +11:00
tlb_hash64.c powerpc/mm: Rename tlb_32.c and tlb_64.c to tlb_hash32.c and tlb_hash64.c 2008-12-16 15:53:30 +11:00
tlb_nohash_low.S powerpc/44x: No need to mask MSR:CE, ME or DE in _tlbil_va on 440 2008-12-21 14:21:16 +11:00
tlb_nohash.c powerpc: Remove the redundant _tlbil_pid at SMP case 2009-01-08 16:25:13 +11:00