aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-08-19 01:53:26 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 01:53:26 -0400
commit0f58189d4a3ca96d7959501ecb203177efdbc5bd (patch)
treeb5ad2f63da4c1caa5d20487cf370d51e4392111c /arch/sparc
parent6ec274750c99448c3412bbc10c97ce0c993f8a4e (diff)
sparc64: Make lock backoff really a NOP on UP builds.
As noticed by Mikulas Patocka, the backoff macros don't completely nop out for UP builds, we still get a branch always and a delay slot nop. Fix this by making the branch to the backoff spin loop selective, then we can nop out the spin loop completely. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/backoff.h11
-rw-r--r--arch/sparc/lib/atomic_64.S16
-rw-r--r--arch/sparc/lib/bitops.S12
3 files changed, 22 insertions, 17 deletions
diff --git a/arch/sparc/include/asm/backoff.h b/arch/sparc/include/asm/backoff.h
index fa1fdf67e350..db3af0d30fb1 100644
--- a/arch/sparc/include/asm/backoff.h
+++ b/arch/sparc/include/asm/backoff.h
@@ -8,6 +8,9 @@
8#define BACKOFF_SETUP(reg) \ 8#define BACKOFF_SETUP(reg) \
9 mov 1, reg 9 mov 1, reg
10 10
11#define BACKOFF_LABEL(spin_label, continue_label) \
12 spin_label
13
11#define BACKOFF_SPIN(reg, tmp, label) \ 14#define BACKOFF_SPIN(reg, tmp, label) \
12 mov reg, tmp; \ 15 mov reg, tmp; \
1388: brnz,pt tmp, 88b; \ 1688: brnz,pt tmp, 88b; \
@@ -22,9 +25,11 @@
22#else 25#else
23 26
24#define BACKOFF_SETUP(reg) 27#define BACKOFF_SETUP(reg)
25#define BACKOFF_SPIN(reg, tmp, label) \ 28
26 ba,pt %xcc, label; \ 29#define BACKOFF_LABEL(spin_label, continue_label) \
27 nop; 30 continue_label
31
32#define BACKOFF_SPIN(reg, tmp, label)
28 33
29#endif 34#endif
30 35
diff --git a/arch/sparc/lib/atomic_64.S b/arch/sparc/lib/atomic_64.S
index 703c9c3935b7..59186e0fcf39 100644
--- a/arch/sparc/lib/atomic_64.S
+++ b/arch/sparc/lib/atomic_64.S
@@ -21,7 +21,7 @@ atomic_add: /* %o0 = increment, %o1 = atomic_ptr */
21 add %g1, %o0, %g7 21 add %g1, %o0, %g7
22 cas [%o1], %g1, %g7 22 cas [%o1], %g1, %g7
23 cmp %g1, %g7 23 cmp %g1, %g7
24 bne,pn %icc, 2f 24 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
25 nop 25 nop
26 retl 26 retl
27 nop 27 nop
@@ -36,7 +36,7 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
36 sub %g1, %o0, %g7 36 sub %g1, %o0, %g7
37 cas [%o1], %g1, %g7 37 cas [%o1], %g1, %g7
38 cmp %g1, %g7 38 cmp %g1, %g7
39 bne,pn %icc, 2f 39 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
40 nop 40 nop
41 retl 41 retl
42 nop 42 nop
@@ -51,7 +51,7 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
51 add %g1, %o0, %g7 51 add %g1, %o0, %g7
52 cas [%o1], %g1, %g7 52 cas [%o1], %g1, %g7
53 cmp %g1, %g7 53 cmp %g1, %g7
54 bne,pn %icc, 2f 54 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
55 add %g1, %o0, %g1 55 add %g1, %o0, %g1
56 retl 56 retl
57 sra %g1, 0, %o0 57 sra %g1, 0, %o0
@@ -66,7 +66,7 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
66 sub %g1, %o0, %g7 66 sub %g1, %o0, %g7
67 cas [%o1], %g1, %g7 67 cas [%o1], %g1, %g7
68 cmp %g1, %g7 68 cmp %g1, %g7
69 bne,pn %icc, 2f 69 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
70 sub %g1, %o0, %g1 70 sub %g1, %o0, %g1
71 retl 71 retl
72 sra %g1, 0, %o0 72 sra %g1, 0, %o0
@@ -81,7 +81,7 @@ atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */
81 add %g1, %o0, %g7 81 add %g1, %o0, %g7
82 casx [%o1], %g1, %g7 82 casx [%o1], %g1, %g7
83 cmp %g1, %g7 83 cmp %g1, %g7
84 bne,pn %xcc, 2f 84 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
85 nop 85 nop
86 retl 86 retl
87 nop 87 nop
@@ -96,7 +96,7 @@ atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
96 sub %g1, %o0, %g7 96 sub %g1, %o0, %g7
97 casx [%o1], %g1, %g7 97 casx [%o1], %g1, %g7
98 cmp %g1, %g7 98 cmp %g1, %g7
99 bne,pn %xcc, 2f 99 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
100 nop 100 nop
101 retl 101 retl
102 nop 102 nop
@@ -111,7 +111,7 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
111 add %g1, %o0, %g7 111 add %g1, %o0, %g7
112 casx [%o1], %g1, %g7 112 casx [%o1], %g1, %g7
113 cmp %g1, %g7 113 cmp %g1, %g7
114 bne,pn %xcc, 2f 114 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
115 nop 115 nop
116 retl 116 retl
117 add %g1, %o0, %o0 117 add %g1, %o0, %o0
@@ -126,7 +126,7 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
126 sub %g1, %o0, %g7 126 sub %g1, %o0, %g7
127 casx [%o1], %g1, %g7 127 casx [%o1], %g1, %g7
128 cmp %g1, %g7 128 cmp %g1, %g7
129 bne,pn %xcc, 2f 129 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
130 nop 130 nop
131 retl 131 retl
132 sub %g1, %o0, %o0 132 sub %g1, %o0, %o0
diff --git a/arch/sparc/lib/bitops.S b/arch/sparc/lib/bitops.S
index 2b7228cb8c22..3dc61d5537c0 100644
--- a/arch/sparc/lib/bitops.S
+++ b/arch/sparc/lib/bitops.S
@@ -22,7 +22,7 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
22 or %g7, %o2, %g1 22 or %g7, %o2, %g1
23 casx [%o1], %g7, %g1 23 casx [%o1], %g7, %g1
24 cmp %g7, %g1 24 cmp %g7, %g1
25 bne,pn %xcc, 2f 25 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
26 and %g7, %o2, %g2 26 and %g7, %o2, %g2
27 clr %o0 27 clr %o0
28 movrne %g2, 1, %o0 28 movrne %g2, 1, %o0
@@ -45,7 +45,7 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
45 andn %g7, %o2, %g1 45 andn %g7, %o2, %g1
46 casx [%o1], %g7, %g1 46 casx [%o1], %g7, %g1
47 cmp %g7, %g1 47 cmp %g7, %g1
48 bne,pn %xcc, 2f 48 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
49 and %g7, %o2, %g2 49 and %g7, %o2, %g2
50 clr %o0 50 clr %o0
51 movrne %g2, 1, %o0 51 movrne %g2, 1, %o0
@@ -68,7 +68,7 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
68 xor %g7, %o2, %g1 68 xor %g7, %o2, %g1
69 casx [%o1], %g7, %g1 69 casx [%o1], %g7, %g1
70 cmp %g7, %g1 70 cmp %g7, %g1
71 bne,pn %xcc, 2f 71 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
72 and %g7, %o2, %g2 72 and %g7, %o2, %g2
73 clr %o0 73 clr %o0
74 movrne %g2, 1, %o0 74 movrne %g2, 1, %o0
@@ -91,7 +91,7 @@ set_bit: /* %o0=nr, %o1=addr */
91 or %g7, %o2, %g1 91 or %g7, %o2, %g1
92 casx [%o1], %g7, %g1 92 casx [%o1], %g7, %g1
93 cmp %g7, %g1 93 cmp %g7, %g1
94 bne,pn %xcc, 2f 94 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
95 nop 95 nop
96 retl 96 retl
97 nop 97 nop
@@ -112,7 +112,7 @@ clear_bit: /* %o0=nr, %o1=addr */
112 andn %g7, %o2, %g1 112 andn %g7, %o2, %g1
113 casx [%o1], %g7, %g1 113 casx [%o1], %g7, %g1
114 cmp %g7, %g1 114 cmp %g7, %g1
115 bne,pn %xcc, 2f 115 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
116 nop 116 nop
117 retl 117 retl
118 nop 118 nop
@@ -133,7 +133,7 @@ change_bit: /* %o0=nr, %o1=addr */
133 xor %g7, %o2, %g1 133 xor %g7, %o2, %g1
134 casx [%o1], %g7, %g1 134 casx [%o1], %g7, %g1
135 cmp %g7, %g1 135 cmp %g7, %g1
136 bne,pn %xcc, 2f 136 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
137 nop 137 nop
138 retl 138 retl
139 nop 139 nop