Commit 1a196c8a authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] make cpu_relax a barrier on all architectures

Make cpu_relax() on all architectures a gcc barrier to match x86.
parent 947ad94a
...@@ -74,7 +74,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -74,7 +74,7 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) \ #define KSTK_ESP(tsk) \
((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp) ((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#define ARCH_HAS_PREFETCH #define ARCH_HAS_PREFETCH
#define ARCH_HAS_PREFETCHW #define ARCH_HAS_PREFETCHW
......
...@@ -59,7 +59,7 @@ extern void release_thread(struct task_struct *); ...@@ -59,7 +59,7 @@ extern void release_thread(struct task_struct *);
unsigned long get_wchan(struct task_struct *p); unsigned long get_wchan(struct task_struct *p);
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* /*
* Create a new kernel thread * Create a new kernel thread
......
...@@ -142,6 +142,6 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t) ...@@ -142,6 +142,6 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t)
#define init_task (init_task_union.task) #define init_task (init_task_union.task)
#define init_stack (init_task_union.stack) #define init_stack (init_task_union.stack)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* __ASM_CRIS_PROCESSOR_H */ #endif /* __ASM_CRIS_PROCESSOR_H */
...@@ -616,7 +616,7 @@ ia64_set_lrr0 (unsigned long val) ...@@ -616,7 +616,7 @@ ia64_set_lrr0 (unsigned long val)
asm volatile ("mov cr.lrr0=%0;; srlz.d" :: "r"(val) : "memory"); asm volatile ("mov cr.lrr0=%0;; srlz.d" :: "r"(val) : "memory");
} }
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
static inline void static inline void
......
...@@ -137,6 +137,6 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -137,6 +137,6 @@ unsigned long get_wchan(struct task_struct *p);
eip; }) eip; })
#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif #endif
...@@ -259,7 +259,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -259,7 +259,7 @@ unsigned long get_wchan(struct task_struct *p);
#define init_task (init_task_union.task) #define init_task (init_task_union.task)
#define init_stack (init_task_union.stack) #define init_stack (init_task_union.stack)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* !defined (_LANGUAGE_ASSEMBLY) */ #endif /* !defined (_LANGUAGE_ASSEMBLY) */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -290,7 +290,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -290,7 +290,7 @@ unsigned long get_wchan(struct task_struct *p);
#define init_task (init_task_union.task) #define init_task (init_task_union.task)
#define init_stack (init_task_union.stack) #define init_stack (init_task_union.stack)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* !defined (_LANGUAGE_ASSEMBLY) */ #endif /* !defined (_LANGUAGE_ASSEMBLY) */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -333,7 +333,7 @@ extern inline unsigned long get_wchan(struct task_struct *p) ...@@ -333,7 +333,7 @@ extern inline unsigned long get_wchan(struct task_struct *p)
#define init_task (init_task_union.task) #define init_task (init_task_union.task)
#define init_stack (init_task_union.stack) #define init_stack (init_task_union.stack)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* __ASM_PARISC_PROCESSOR_H */ #endif /* __ASM_PARISC_PROCESSOR_H */
...@@ -771,7 +771,7 @@ void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); ...@@ -771,7 +771,7 @@ void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
#define have_of (_machine == _MACH_chrp || _machine == _MACH_Pmac) #define have_of (_machine == _MACH_chrp || _machine == _MACH_Pmac)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* /*
* Prefetch macros. * Prefetch macros.
......
...@@ -692,7 +692,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -692,7 +692,7 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0) #define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
#define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0) #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* /*
* Prefetch macros. * Prefetch macros.
......
...@@ -134,7 +134,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -134,7 +134,7 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr) #define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr)
#define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15]) #define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15])
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* /*
* Set of msr bits that gdb can change on behalf of a process. * Set of msr bits that gdb can change on behalf of a process.
......
...@@ -151,7 +151,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -151,7 +151,7 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr) #define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr)
#define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15]) #define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15])
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* /*
* Set of msr bits that gdb can change on behalf of a process. * Set of msr bits that gdb can change on behalf of a process.
......
...@@ -222,6 +222,6 @@ extern void free_task_struct(struct task_struct *); ...@@ -222,6 +222,6 @@ extern void free_task_struct(struct task_struct *);
#define init_task (init_task_union.task) #define init_task (init_task_union.task)
#define init_stack (init_task_union.stack) #define init_stack (init_task_union.stack)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* __ASM_SH_PROCESSOR_H */ #endif /* __ASM_SH_PROCESSOR_H */
...@@ -201,7 +201,7 @@ BTFIXUPDEF_CALL(void, get_task_struct, struct task_struct *) ...@@ -201,7 +201,7 @@ BTFIXUPDEF_CALL(void, get_task_struct, struct task_struct *)
#define init_task (init_task_union.task) #define init_task (init_task_union.task)
#define init_stack (init_task_union.stack) #define init_stack (init_task_union.stack)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif #endif
......
...@@ -225,7 +225,7 @@ __out: __ret; \ ...@@ -225,7 +225,7 @@ __out: __ret; \
#define KSTK_EIP(tsk) ((tsk)->thread_info->kregs->tpc) #define KSTK_EIP(tsk) ((tsk)->thread_info->kregs->tpc)
#define KSTK_ESP(tsk) ((tsk)->thread_info->kregs->u_regs[UREG_FP]) #define KSTK_ESP(tsk) ((tsk)->thread_info->kregs->u_regs[UREG_FP])
#define cpu_relax() udelay(1 + smp_processor_id()) #define cpu_relax() do { udelay(1 + smp_processor_id()); barrier(); } while (0)
#endif /* !(__ASSEMBLY__) */ #endif /* !(__ASSEMBLY__) */
......
...@@ -367,7 +367,7 @@ extern unsigned long get_wchan(struct task_struct *p); ...@@ -367,7 +367,7 @@ extern unsigned long get_wchan(struct task_struct *p);
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
extern inline void rep_nop(void) extern inline void rep_nop(void)
{ {
__asm__ __volatile__("rep;nop"); __asm__ __volatile__("rep;nop": : :"memory");
} }
#define cpu_has_fpu 1 #define cpu_has_fpu 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment