sparc64: Use pause instruction when available.
In atomic backoff and cpu_relax(), use the pause instruction found on SPARC-T4 and later. It makes the cpu strand unselectable for the given number of cycles, unless an intervening disrupting trap occurs. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -11,19 +11,25 @@
|
||||
#define BACKOFF_LABEL(spin_label, continue_label) \
|
||||
spin_label
|
||||
|
||||
#define BACKOFF_SPIN(reg, tmp, label) \
|
||||
mov reg, tmp; \
|
||||
88: rd %ccr, %g0; \
|
||||
rd %ccr, %g0; \
|
||||
rd %ccr, %g0; \
|
||||
brnz,pt tmp, 88b; \
|
||||
sub tmp, 1, tmp; \
|
||||
set BACKOFF_LIMIT, tmp; \
|
||||
cmp reg, tmp; \
|
||||
bg,pn %xcc, label; \
|
||||
nop; \
|
||||
ba,pt %xcc, label; \
|
||||
sllx reg, 1, reg;
|
||||
#define BACKOFF_SPIN(reg, tmp, label) \
|
||||
mov reg, tmp; \
|
||||
88: rd %ccr, %g0; \
|
||||
rd %ccr, %g0; \
|
||||
rd %ccr, %g0; \
|
||||
.section .pause_patch,"ax"; \
|
||||
.word 88b; \
|
||||
sllx tmp, 7, tmp; \
|
||||
wr tmp, 0, %asr27; \
|
||||
clr tmp; \
|
||||
.previous; \
|
||||
brnz,pt tmp, 88b; \
|
||||
sub tmp, 1, tmp; \
|
||||
set BACKOFF_LIMIT, tmp; \
|
||||
cmp reg, tmp; \
|
||||
bg,pn %xcc, label; \
|
||||
nop; \
|
||||
ba,pt %xcc, label; \
|
||||
sllx reg, 1, reg;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user