From: Johannes Stezenbach <js@convergence.de>
To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
"Kevin D. Kissell" <kevink@mips.com>,
linux-mips@linux-mips.org
Subject: Re: Once again: test_and_set for CPUs w/o LL/SC
Date: Wed, 16 Oct 2002 20:23:35 +0200 [thread overview]
Message-ID: <20021016182335.GA27216@convergence.de> (raw)
In-Reply-To: <20021016181135.GA26994@convergence.de>
[-- Attachment #1: Type: text/plain, Size: 133 bytes --]
On Wed, Oct 16, 2002 at 08:11:35PM +0200, Johannes Stezenbach wrote:
> Here's patch for the kernel.
Now with the patch...
Johannes
[-- Attachment #2: linux-mips-nollsc.patch --]
[-- Type: text/plain, Size: 5751 bytes --]
Index: Documentation/Configure.help
===================================================================
RCS file: /home/cvs/linux/Documentation/Attic/Configure.help,v
retrieving revision 1.109.2.9
diff -u -r1.109.2.9 Configure.help
--- Documentation/Configure.help 3 Oct 2002 01:27:58 -0000 1.109.2.9
+++ Documentation/Configure.help 16 Oct 2002 17:44:12 -0000
@@ -2349,6 +2349,20 @@
for better performance, N if you don't know. You must say Y here
for multiprocessor machines.
+Support userspace ll/sc emulation
+CONFIG_CPU_USERSPACE_LLSC_EMUL
+ Say Y here if your CPU does not have the Load Linked (ll)
+ and Store Conditional (sc) instructions, but supports
+ the Branch Likely instructions, e.g. the NEC VR41xx CPUs.
+ Then the kernel guarantees that the k1 register is 0 after
+ any transition from kernel to userspace, which enables an
+ optimized system library to implement a userspace-only
+ ll/sc emulation.
+
+ If you don't run multithreaded software or don't have a
+ matching libpthread, you don't need it.
+ If in doubt, say N.
+
lld and scd instructions available
CONFIG_CPU_HAS_LLDSCD
Say Y here if your CPU has the lld and scd instructions, the 64-bit
Index: arch/mips/config-shared.in
===================================================================
RCS file: /home/cvs/linux/arch/mips/config-shared.in,v
retrieving revision 1.1.2.23
diff -u -r1.1.2.23 config-shared.in
--- arch/mips/config-shared.in 6 Oct 2002 12:28:03 -0000 1.1.2.23
+++ arch/mips/config-shared.in 16 Oct 2002 17:44:12 -0000
@@ -547,6 +547,11 @@
dep_bool 'Override CPU Options' CONFIG_CPU_ADVANCED $CONFIG_MIPS32
if [ "$CONFIG_CPU_ADVANCED" = "y" ]; then
bool ' ll/sc Instructions available' CONFIG_CPU_HAS_LLSC
+ if [ "$CONFIG_CPU_HAS_LLSC" = "n" ]; then
+ bool ' Support userspace atomic ops for MIPS2 CPUs' CONFIG_CPU_USERSPACE_LLSC_EMUL
+ else
+ define_bool CONFIG_CPU_USERSPACE_LLSC_EMUL n
+ fi
bool ' lld/scd Instructions available' CONFIG_CPU_HAS_LLDSCD
bool ' Writeback Buffer available' CONFIG_CPU_HAS_WB
else
@@ -562,6 +567,11 @@
define_bool CONFIG_CPU_HAS_LLDSCD n
define_bool CONFIG_CPU_HAS_WB n
fi
+ if [ "$CONFIG_CPU_VR41XX" = "y" ]; then
+ define_bool CONFIG_CPU_USERSPACE_LLSC_EMUL y
+ else
+ define_bool CONFIG_CPU_USERSPACE_LLSC_EMUL n
+ fi
else
if [ "$CONFIG_CPU_MIPS32" = "y" ]; then
define_bool CONFIG_CPU_HAS_LLSC y
@@ -572,6 +582,7 @@
define_bool CONFIG_CPU_HAS_LLDSCD y
define_bool CONFIG_CPU_HAS_WB n
fi
+ define_bool CONFIG_CPU_USERSPACE_LLSC_EMUL n
fi
fi
if [ "$CONFIG_CPU_R3000" = "y" ]; then
Index: arch/mips/mm/tlbex-r4k.S
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/tlbex-r4k.S,v
retrieving revision 1.2.2.10
diff -u -r1.2.2.10 tlbex-r4k.S
--- arch/mips/mm/tlbex-r4k.S 2 Oct 2002 19:42:04 -0000 1.2.2.10
+++ arch/mips/mm/tlbex-r4k.S 16 Oct 2002 17:44:12 -0000
@@ -182,7 +182,11 @@
b 1f
tlbwr # write random tlb entry
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
eret # return from trap
END(except_vec0_r4000)
@@ -207,7 +211,11 @@
P_MTC0 k1, CP0_ENTRYLO1
nop
tlbwr
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
eret
END(except_vec0_r4600)
@@ -244,7 +252,11 @@
nop # QED specified nops
nop
tlbwr # write random tlb entry
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop # traditional nop
+#endif
eret # return from trap
END(except_vec0_nevada)
@@ -276,7 +288,12 @@
P_MTC0 k1, CP0_ENTRYLO1 # load it
b 1f
tlbwr # write random tlb entry
-1: nop
+1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
+ nop
+#endif
2: eret # return from trap
END(except_vec0_sb1_m3)
#endif /* BCM1250_M3_WAR */
@@ -308,7 +325,11 @@
bltzl k0, 1f
tlbwr
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
eret
END(except_vec0_r45k_bvahwbug)
@@ -340,7 +361,11 @@
bltzl k0, 1f
tlbwr
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
eret
END(except_vec0_r4k_mphwbug)
#endif
@@ -371,7 +396,11 @@
b 1f
tlbwr
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
eret
END(except_vec0_r4k_250MHZhwbug)
@@ -405,7 +434,11 @@
bltzl k0, 1f
tlbwr
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
eret
END(except_vec0_r4k_MP250MHZhwbug)
#endif
@@ -456,7 +489,11 @@
b 1f
tlbwi
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
.set mips3
eret
.set mips0
@@ -482,7 +519,11 @@
b 1f
tlbwi
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
.set mips3
eret
.set mips0
@@ -513,7 +554,11 @@
b 1f
tlbwi
1:
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+ move k1, zero
+#else
nop
+#endif
.set mips3
eret
.set mips0
Index: include/asm-mips/stackframe.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/stackframe.h,v
retrieving revision 1.18.2.2
diff -u -r1.18.2.2 stackframe.h
--- include/asm-mips/stackframe.h 5 Aug 2002 23:53:37 -0000 1.18.2.2
+++ include/asm-mips/stackframe.h 16 Oct 2002 17:44:13 -0000
@@ -201,8 +201,15 @@
lw $3, PT_R3(sp); \
lw $2, PT_R2(sp)
+#ifdef CONFIG_CPU_USERSPACE_LLSC_EMUL
+#define CLEAR_K1 move k1,$0;
+#else
+#define CLEAR_K1
+#endif
+
#define RESTORE_SP_AND_RET \
lw sp, PT_R29(sp); \
+ CLEAR_K1 \
.set mips3; \
eret; \
.set mips0
next prev parent reply other threads:[~2002-10-16 18:23 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-16 16:40 Once again: test_and_set for CPUs w/o LL/SC Johannes Stezenbach
2002-10-07 14:47 ` Johannes Stezenbach
2002-10-07 16:21 ` Kevin D. Kissell
2002-10-07 16:21 ` Kevin D. Kissell
2002-10-07 18:43 ` Johannes Stezenbach
2002-10-07 18:51 ` Daniel Jacobowitz
2002-10-15 17:52 ` Johannes Stezenbach
2002-10-08 7:38 ` Kevin D. Kissell
2002-10-08 7:38 ` Kevin D. Kissell
2002-10-15 15:36 ` Maciej W. Rozycki
2002-10-15 17:21 ` Johannes Stezenbach
2002-10-16 12:20 ` Maciej W. Rozycki
2002-10-16 12:52 ` Johannes Stezenbach
2002-10-16 16:30 ` Johannes Stezenbach
2002-10-17 9:47 ` Gleb O. Raiko
2002-10-17 12:02 ` Maciej W. Rozycki
2002-10-17 13:11 ` Johannes Stezenbach
2002-10-17 13:32 ` Gleb O. Raiko
2002-10-17 14:13 ` Johannes Stezenbach
2002-10-16 18:11 ` Johannes Stezenbach
2002-10-16 18:23 ` Johannes Stezenbach [this message]
2002-10-17 11:57 ` Maciej W. Rozycki
2002-10-17 13:25 ` Johannes Stezenbach
2002-10-15 15:17 ` Maciej W. Rozycki
2002-10-15 16:50 ` Johannes Stezenbach
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=20021016182335.GA27216@convergence.de \
--to=js@convergence.de \
--cc=kevink@mips.com \
--cc=linux-mips@linux-mips.org \
--cc=macro@ds2.pg.gda.pl \
/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.