summary refs log tree commit diff
path: root/arch/parisc/kernel/cache.c
diff options
context:
space:
mode:
authorJohn David Anglin <dave.anglin@bell.net>2013-01-14 19:45:00 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-01-19 10:54:45 +0000
commit7139bc1579901b53db7e898789e916ee2fb52d78 (patch)
treec5030cb7afe83a347de96757c2a3b5490a9782e8 /arch/parisc/kernel/cache.c
parent5da1f88b8b727dc3a66c52d4513e871be6d43d19 (diff)
downloadlinux-7139bc1579901b53db7e898789e916ee2fb52d78.tar.gz
[PARISC] Purge existing TLB entries in set_pte_at and ptep_set_wrprotect
This patch goes a long way toward fixing the minifail bug, and
it  significantly improves the stability of SMP machines such as
the rp3440.  When write  protecting a page for COW, we need to
purge the existing translation.  Otherwise, the COW break
doesn't occur as expected because the TLB may still have a stale entry
which allows writes.

[jejb: fix up checkpatch errors]
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'arch/parisc/kernel/cache.c')
-rw-r--r--arch/parisc/kernel/cache.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 48e16dc20102..b89a85ab945e 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -419,6 +419,24 @@ void kunmap_parisc(void *addr)
 EXPORT_SYMBOL(kunmap_parisc);
 #endif
 
+void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
+{
+	unsigned long flags;
+
+	/* Note: purge_tlb_entries can be called at startup with
+	   no context.  */
+
+	/* Disable preemption while we play with %sr1.  */
+	preempt_disable();
+	mtsp(mm->context, 1);
+	purge_tlb_start(flags);
+	pdtlb(addr);
+	pitlb(addr);
+	purge_tlb_end(flags);
+	preempt_enable();
+}
+EXPORT_SYMBOL(purge_tlb_entries);
+
 void __flush_tlb_range(unsigned long sid, unsigned long start,
 		       unsigned long end)
 {