Commit f6dc8c5b authored by Chase Venters's avatar Chase Venters Committed by Linus Torvalds

[PATCH] Make cpu_relax() imply barrier() on all arches

During the recent discussion of taking 'volatile' off of the spinlock, I
noticed that while most arches #define cpu_relax() such that it implies
barrier(), some arches define cpu_relax() to be empty.

This patch changes the definition of cpu_relax() for frv, h8300, m68knommu,
sh, sh64, v850 and xtensa from an empty while(0) to the compiler barrier().
Signed-off-by: default avatarChase Venters <chase.venters@clientec.com>
Acked-by: default avatarArjan van de Ven <arjan@Linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0f749646
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#define current_text_addr() ({ __label__ _l; _l: &&_l;}) #define current_text_addr() ({ __label__ _l; _l: &&_l;})
#include <linux/compiler.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/segment.h> #include <asm/segment.h>
...@@ -139,7 +140,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -139,7 +140,7 @@ unsigned long get_wchan(struct task_struct *p);
extern struct task_struct *alloc_task_struct(void); extern struct task_struct *alloc_task_struct(void);
extern void free_task_struct(struct task_struct *p); extern void free_task_struct(struct task_struct *p);
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* data cache prefetch */ /* data cache prefetch */
#define ARCH_HAS_PREFETCH #define ARCH_HAS_PREFETCH
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#define current_text_addr() ({ __label__ _l; _l: &&_l;}) #define current_text_addr() ({ __label__ _l; _l: &&_l;})
#include <linux/compiler.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
...@@ -129,6 +130,6 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -129,6 +130,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
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#define current_text_addr() ({ __label__ _l; _l: &&_l;}) #define current_text_addr() ({ __label__ _l; _l: &&_l;})
#include <linux/compiler.h>
#include <linux/threads.h> #include <linux/threads.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/segment.h> #include <asm/segment.h>
...@@ -137,6 +138,6 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -137,6 +138,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
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define __ASM_SH_PROCESSOR_H #define __ASM_SH_PROCESSOR_H
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/compiler.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/cache.h> #include <asm/cache.h>
...@@ -263,7 +264,7 @@ extern unsigned long get_wchan(struct task_struct *p); ...@@ -263,7 +264,7 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) ((tsk)->thread.sp) #define KSTK_ESP(tsk) ((tsk)->thread.sp)
#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASM_SH_PROCESSOR_H */ #endif /* __ASM_SH_PROCESSOR_H */
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <asm/cache.h> #include <asm/cache.h>
#include <asm/registers.h> #include <asm/registers.h>
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/compiler.h>
/* /*
* Default implementation of macro that returns current * Default implementation of macro that returns current
...@@ -279,7 +280,7 @@ extern unsigned long get_wchan(struct task_struct *p); ...@@ -279,7 +280,7 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) ((tsk)->thread.pc) #define KSTK_EIP(tsk) ((tsk)->thread.pc)
#define KSTK_ESP(tsk) ((tsk)->thread.sp) #define KSTK_ESP(tsk) ((tsk)->thread.sp)
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __ASM_SH64_PROCESSOR_H */ #endif /* __ASM_SH64_PROCESSOR_H */
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/thread_info.h> #include <linux/thread_info.h>
#endif #endif
#include <linux/compiler.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/entry.h> #include <asm/entry.h>
...@@ -106,7 +107,7 @@ unsigned long get_wchan (struct task_struct *p); ...@@ -106,7 +107,7 @@ unsigned long get_wchan (struct task_struct *p);
#define KSTK_ESP(task) task_sp (task) #define KSTK_ESP(task) task_sp (task)
#define cpu_relax() ((void)0) #define cpu_relax() barrier()
#else /* __ASSEMBLY__ */ #else /* __ASSEMBLY__ */
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <xtensa/config/tie.h> #include <xtensa/config/tie.h>
#include <xtensa/config/system.h> #include <xtensa/config/system.h>
#include <linux/compiler.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/coprocessor.h> #include <asm/coprocessor.h>
...@@ -191,7 +192,7 @@ extern unsigned long get_wchan(struct task_struct *p); ...@@ -191,7 +192,7 @@ extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1]) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
#define cpu_relax() do { } while (0) #define cpu_relax() barrier()
/* Special register access. */ /* Special register access. */
......
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