From 3ab8835250b69514319969a97661b1d83814b637 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 19 Jan 2004 05:12:29 -0800 Subject: [PATCH] [PATCH] Alpha: make prefetch_spinlock() a no-op on UP From: Ivan Kokshaysky When CONFIG_SMP is not set, spinlock_t is an empty structure, so its address has arbitrary alignment. The prefetch instructions with unaligned address don't have visible side effects on alphas with SRM console (except performance degradation) - the PALcode handles unaligned traps caused by prefetch instructions internally. However, on old AlphaBIOS/MILO boxes unaligned prefetch leads to unhandled alignment trap and kernel panic. --- include/asm-alpha/processor.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index fe03e7309686c..3c750a362c445 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -78,6 +78,11 @@ unsigned long get_wchan(struct task_struct *p); #define ARCH_HAS_PREFETCHW #define ARCH_HAS_SPINLOCK_PREFETCH +#ifndef CONFIG_SMP +/* Nothing to prefetch. */ +#define spin_lock_prefetch(lock) do { } while (0) +#endif + #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) extern inline void prefetch(const void *ptr) { @@ -89,10 +94,13 @@ extern inline void prefetchw(const void *ptr) __builtin_prefetch(ptr, 1, 3); } +#ifdef CONFIG_SMP extern inline void spin_lock_prefetch(const void *ptr) { __builtin_prefetch(ptr, 1, 3); } +#endif + #else extern inline void prefetch(const void *ptr) { @@ -104,10 +112,13 @@ extern inline void prefetchw(const void *ptr) __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr)); } +#ifdef CONFIG_SMP extern inline void spin_lock_prefetch(const void *ptr) { __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr)); } +#endif + #endif /* GCC 3.1 */ #endif /* __ASM_ALPHA_PROCESSOR_H */ -- 2.53.0