aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/pda.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-11-14 10:57:46 -0500
committerAndi Kleen <andi@basil.nowhere.org>2006-11-14 10:57:46 -0500
commit9446868b5383eb87f76b2d4389dea4bb968a6657 (patch)
treed253d9a0ae99c77f43ca271019fcbdbfd349b665 /include/asm-x86_64/pda.h
parent8c131af1db510793f87dc43edbc8950a35370df3 (diff)
[PATCH] x86-64: Fix race in exit_idle
When another interrupt happens in exit_idle the exit idle notifier could be called an incorrect number of times. Add a test_and_clear_bit_pda and use it handle the bit atomically against interrupts to avoid this. Pointed out by Stephane Eranian Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'include/asm-x86_64/pda.h')
-rw-r--r--include/asm-x86_64/pda.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index 14996d962bac..5642634843c4 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -109,6 +109,15 @@ extern struct x8664_pda _proxy_pda;
109#define sub_pda(field,val) pda_to_op("sub",field,val) 109#define sub_pda(field,val) pda_to_op("sub",field,val)
110#define or_pda(field,val) pda_to_op("or",field,val) 110#define or_pda(field,val) pda_to_op("or",field,val)
111 111
112/* This is not atomic against other CPUs -- CPU preemption needs to be off */
113#define test_and_clear_bit_pda(bit,field) ({ \
114 int old__; \
115 asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \
116 : "=r" (old__), "+m" (_proxy_pda.field) \
117 : "dIr" (bit), "i" (pda_offset(field)) : "memory"); \
118 old__; \
119})
120
112#endif 121#endif
113 122
114#define PDA_STACKOFFSET (5*8) 123#define PDA_STACKOFFSET (5*8)