From: Anton Blanchard <anton@samba.org>
To: akpm@osdl.org, torvalds@osdl.org
Cc: dwg@dropbear.id.au, paulus@samba.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [ppc64] Fix SLB castout issue
Date: Tue, 10 Aug 2004 06:44:15 +1000 [thread overview]
Message-ID: <20040809204415.GG24690@krispykreme> (raw)
Hi,
The SLB rewrite removed a fix for a hard to hit bug, but the SFS guys
managed to hit it straight away. We need to check both r1 and PACAKSAVE
or else we could cast our kernel segment out when on the irq or softirq
stack.
Anton
===== slb_low.S 1.1 vs edited =====
--- 1.1/arch/ppc64/mm/slb_low.S Mon Aug 2 18:00:41 2004
+++ edited/slb_low.S Tue Aug 10 05:06:32 2004
@@ -37,9 +37,6 @@
* a free slot first but that took too long. Unfortunately we
* dont have any LRU information to help us choose a slot.
*/
- srdi r9,r1,27
- ori r9,r9,1 /* mangle SP for later compare */
-
ld r10,PACASTABRR(r13)
3:
addi r10,r10,1
@@ -48,18 +45,32 @@
blt+ 4f
li r10,SLB_NUM_BOLTED
-4:
- slbmfee r11,r10
- /* Don't throw out the segment for our kernel stack. Since we
+
+ /*
+ * Never cast out the segment for our kernel stack. Since we
* dont invalidate the ERAT we could have a valid translation
- * for the kernel stack during the first part of exception
- * exit which gets invalidated due to a tlbie from another cpu
- * at a non recoverable point (after setting srr0/1) - Anton
- *
+ * for the kernel stack during the first part of exception exit
+ * which gets invalidated due to a tlbie from another cpu at a
+ * non recoverable point (after setting srr0/1) - Anton
+ */
+4: slbmfee r11,r10
+ srdi r11,r11,27
+ /*
+ * Use paca->ksave as the value of the kernel stack pointer,
+ * because this is valid at all times.
* The >> 27 (rather than >> 28) is so that the LSB is the
* valid bit - this way we check valid and ESID in one compare.
+ * In order to completely close the tiny race in the context
+ * switch (between updating r1 and updating paca->ksave),
+ * we check against both r1 and paca->ksave.
*/
- srdi r11,r11,27
+ srdi r9,r1,27
+ ori r9,r9,1 /* mangle SP for later compare */
+ cmpd r11,r9
+ beq- 3b
+ ld r9,PACAKSAVE(r13)
+ srdi r9,r9,27
+ ori r9,r9,1
cmpd r11,r9
beq- 3b
next reply other threads:[~2004-08-09 20:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-09 20:44 Anton Blanchard [this message]
2004-08-10 1:49 ` [PATCH] [ppc64] Fix SLB castout issue David Gibson
2004-08-10 2:07 ` Linus Torvalds
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=20040809204415.GG24690@krispykreme \
--to=anton@samba.org \
--cc=akpm@osdl.org \
--cc=dwg@dropbear.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox