All of lore.kernel.org
 help / color / mirror / Atom feed
From: John David Anglin <dave.anglin@bell.net>
To: linux-parisc List <linux-parisc@vger.kernel.org>
Cc: Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>
Subject: [PATCH] parisc: Ensure volatile space register %sr1 is not clobbered
Date: Tue, 25 Jun 2013 19:10:04 -0400	[thread overview]
Message-ID: <BLU0-SMTP2112E5305CF38E7EA12B08978B0@phx.gbl> (raw)

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

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>
---


[-- Attachment #2: sr1.txt --]
[-- Type: text/plain, Size: 903 bytes --]

diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h
index 5273da9..9cdbc74 100644
--- a/arch/parisc/include/asm/tlbflush.h
+++ b/arch/parisc/include/asm/tlbflush.h
@@ -68,8 +68,8 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
 	/* For one page, it's not worth testing the split_tlb variable */
 
 	mb();
-	mtsp(vma->vm_mm->context,1);
 	purge_tlb_start(flags);
+	mtsp(vma->vm_mm->context,1);
 	pdtlb(addr);
 	pitlb(addr);
 	purge_tlb_end(flags);
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 65fb4cb..2e65aa5 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -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);

[-- Attachment #3: Type: text/plain, Size: 45 bytes --]



--
John David Anglin	dave.anglin@bell.net


                 reply	other threads:[~2013-06-25 23:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLU0-SMTP2112E5305CF38E7EA12B08978B0@phx.gbl \
    --to=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=jejb@parisc-linux.org \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.