summary refs log tree commit diff
path: root/include/asm-powerpc/mmu.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@au1.ibm.com>2006-05-30 14:14:19 +1000
committerPaul Mackerras <paulus@samba.org>2006-06-09 21:20:59 +1000
commitc5cf0e30bf3d8cb56758abb612827647c0a821cf (patch)
tree54a471818e91204db11f14544df0bb38bd03058f /include/asm-powerpc/mmu.h
parenta5bba930d802009c259e56c8d53086d96f63813b (diff)
downloadlinux-c5cf0e30bf3d8cb56758abb612827647c0a821cf.tar.gz
[PATCH] powerpc: Fix buglet with MMU hash management
Our MMU hash management code would not set the "C" bit (changed bit) in
the hardware PTE when updating a RO PTE into a RW PTE. That would cause
the hardware to possibly to a write back to the hash table to set it on
the first store access, which in addition to being a performance issue,
might also hit a bug when running with native hash management (non-HV)
as our code is specifically optimized for the case where no write back
happens.

Thus there is a very small therocial window were a hash PTE can become
corrupted if that HPTE has just been upgraded to read write, a store
access happens on it, and that races with another processor evicting
that same slot. Since eviction (caused by an almost full hash) is
extremely rare, the bug is very unlikely to happen fortunately.

This fixes by allowing the updating of the protection bits in the native
hash handling to also set (but not clear) the "C" bit, and, in order to
also improve performances in the general case, by always setting that
bit on newly inserted hash PTE so that writeback really never happens.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/mmu.h')
-rw-r--r--include/asm-powerpc/mmu.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 96e47d1ce979..885397420104 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -96,6 +96,8 @@ extern char initial_stab[];
 #define HPTE_R_FLAGS		ASM_CONST(0x00000000000003ff)
 #define HPTE_R_PP		ASM_CONST(0x0000000000000003)
 #define HPTE_R_N		ASM_CONST(0x0000000000000004)
+#define HPTE_R_C		ASM_CONST(0x0000000000000080)
+#define HPTE_R_R		ASM_CONST(0x0000000000000100)
 
 /* Values for PP (assumes Ks=0, Kp=1) */
 /* pp0 will always be 0 for linux     */