]> Pileus Git - ~andy/linux/commitdiff
parisc: Ensure volatile space register %sr1 is not clobbered
authorJohn David Anglin <dave.anglin@bell.net>
Sat, 29 Jun 2013 20:42:12 +0000 (16:42 -0400)
committerHelge Deller <deller@gmx.de>
Tue, 9 Jul 2013 20:09:22 +0000 (22:09 +0200)
I still see the occasional random segv on rp3440.  Looking at one of
these (a code 15), it appeared the problem must be with the cache
handling of anonymous pages.  Reviewing this, I noticed that the space
register %sr1 might be being clobbered when we flush an anonymous page.

Register %sr1 is used for TLB purges in a couple of places.  These
purges are needed on PA8800 and PA8900 processors to ensure cache
consistency of flushed cache lines.

The solution here is simply to move the %sr1 load into the TLB lock
region needed to ensure that one purge executes at a time on SMP
systems.  This was already the case for one use.  After a few days of
operation, I haven't had a random segv on my rp3440.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: <stable@vger.kernel.org> # 3.10
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/include/asm/tlbflush.h
arch/parisc/kernel/cache.c

index 5273da991e062c841ac40efdb0f3174a4df8cde3..9d086a599fa05f56a13cbd6b214b466ad4b43a12 100644 (file)
@@ -63,13 +63,14 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
 static inline void flush_tlb_page(struct vm_area_struct *vma,
        unsigned long addr)
 {
-       unsigned long flags;
+       unsigned long flags, sid;
 
        /* For one page, it's not worth testing the split_tlb variable */
 
        mb();
-       mtsp(vma->vm_mm->context,1);
+       sid = vma->vm_mm->context;
        purge_tlb_start(flags);
+       mtsp(sid, 1);
        pdtlb(addr);
        pitlb(addr);
        purge_tlb_end(flags);
index 65fb4cbc3a0ffd88f7f100870e8b0c952de573e7..2e65aa54bd101b7dc5600297858929687e90d549 100644 (file)
@@ -440,8 +440,8 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
        else {
                unsigned long flags;
 
-               mtsp(sid, 1);
                purge_tlb_start(flags);
+               mtsp(sid, 1);
                if (split_tlb) {
                        while (npages--) {
                                pdtlb(start);