aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-10-27 21:05:20 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-27 21:35:27 -0400
commit270c10e00a1e557e068803a22e0556281ceb1830 (patch)
tree14df99d0a7f35110d6d72687e6e8e588edce659b /arch/sparc
parent517ffce4e1a03aea979fe3a18a3dd1761a24fafb (diff)
sparc64: Fix cpu strand yielding.
For atomic backoff, we just loop over an exponentially backed off counter. This is extremely ineffective as it doesn't actually yield the cpu strand so that other competing strands can use the cpu core. In cpus previous to SPARC-T4 we have to do this in a slightly hackish way, by doing an operation with no side effects that also happens to mark the strand as unavailable. The mechanism we choose for this is three reads of the %ccr (condition-code) register into %g0 (the zero register). SPARC-T4 has an explicit "pause" instruction, and we'll make use of that in a subsequent commit. Yield strands also in cpu_relax(). We really should have done this a very long time ago. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/backoff.h5
-rw-r--r--arch/sparc/include/asm/processor_64.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/arch/sparc/include/asm/backoff.h b/arch/sparc/include/asm/backoff.h
index db3af0d30fb1..64b077b3b13b 100644
--- a/arch/sparc/include/asm/backoff.h
+++ b/arch/sparc/include/asm/backoff.h
@@ -13,7 +13,10 @@
13 13
14#define BACKOFF_SPIN(reg, tmp, label) \ 14#define BACKOFF_SPIN(reg, tmp, label) \
15 mov reg, tmp; \ 15 mov reg, tmp; \
1688: brnz,pt tmp, 88b; \ 1688: rd %ccr, %g0; \
17 rd %ccr, %g0; \
18 rd %ccr, %g0; \
19 brnz,pt tmp, 88b; \
17 sub tmp, 1, tmp; \ 20 sub tmp, 1, tmp; \
18 set BACKOFF_LIMIT, tmp; \ 21 set BACKOFF_LIMIT, tmp; \
19 cmp reg, tmp; \ 22 cmp reg, tmp; \
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index 4e5a483122a0..986563409469 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -196,7 +196,10 @@ extern unsigned long get_wchan(struct task_struct *task);
196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) 196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP]) 197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])
198 198
199#define cpu_relax() barrier() 199#define cpu_relax() asm volatile("rd %%ccr, %%g0\n\t" \
200 "rd %%ccr, %%g0\n\t" \
201 "rd %%ccr, %%g0" \
202 ::: "memory")
200 203
201/* Prefetch support. This is tuned for UltraSPARC-III and later. 204/* Prefetch support. This is tuned for UltraSPARC-III and later.
202 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has 205 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has