]> err.no Git - linux-2.6/commitdiff
[PATCH] x86_64: Remove alternative_smp
authorAndi Kleen <ak@suse.de>
Wed, 30 Aug 2006 17:37:13 +0000 (19:37 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 30 Aug 2006 23:05:15 +0000 (16:05 -0700)
The .fill causes miscompilations with some binutils version.

Instead just patch the lock prefix in the lock constructs. That is the
majority of the cost and should be good enough.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-x86_64/alternative.h
include/asm-x86_64/spinlock.h

index 709ad3f0d354dac4ceec6a1d881bfe08c350678e..a584826cc570f6aa6415b62d255a789feb8b22a6 100644 (file)
@@ -103,9 +103,6 @@ static inline void alternatives_smp_switch(int smp) {}
 /*
  * Alternative inline assembly for SMP.
  *
- * alternative_smp() takes two versions (SMP first, UP second) and is
- * for more complex stuff such as spinlocks.
- *
  * The LOCK_PREFIX macro defined here replaces the LOCK and
  * LOCK_PREFIX macros used everywhere in the source tree.
  *
@@ -125,21 +122,6 @@ static inline void alternatives_smp_switch(int smp) {}
  */
 
 #ifdef CONFIG_SMP
-#define alternative_smp(smpinstr, upinstr, args...)                    \
-       asm volatile ("661:\n\t" smpinstr "\n662:\n"                    \
-                     ".section .smp_altinstructions,\"a\"\n"           \
-                     "  .align 8\n"                                    \
-                     "  .quad 661b\n"            /* label */           \
-                     "  .quad 663f\n"            /* new instruction */ \
-                     "  .byte " __stringify(X86_FEATURE_UP) "\n"       \
-                     "  .byte 662b-661b\n"       /* sourcelen */       \
-                     "  .byte 664f-663f\n"       /* replacementlen */  \
-                     ".previous\n"                                     \
-                     ".section .smp_altinstr_replacement,\"awx\"\n"    \
-                     "663:\n\t" upinstr "\n"     /* replacement */     \
-                     "664:\n\t.fill 662b-661b,1,0x42\n" /* space for original */ \
-                     ".previous" : args)
-
 #define LOCK_PREFIX \
                ".section .smp_locks,\"a\"\n"   \
                "  .align 8\n"                  \
@@ -148,8 +130,6 @@ static inline void alternatives_smp_switch(int smp) {}
                "661:\n\tlock; "
 
 #else /* ! CONFIG_SMP */
-#define alternative_smp(smpinstr, upinstr, args...) \
-       asm volatile (upinstr : args)
 #define LOCK_PREFIX ""
 #endif
 
index 8d3421996f949a0983f6b26680ee1f3cf5a7759d..248a79f0eaffcd306968be3e29980e95aece7940 100644 (file)
@@ -21,7 +21,7 @@
 
 #define __raw_spin_lock_string \
        "\n1:\t" \
-       "lock ; decl %0\n\t" \
+       LOCK_PREFIX " ; decl %0\n\t" \
        "js 2f\n" \
        LOCK_SECTION_START("") \
        "2:\t" \
 
 static inline void __raw_spin_lock(raw_spinlock_t *lock)
 {
-       alternative_smp(
-               __raw_spin_lock_string,
-               __raw_spin_lock_string_up,
-               "=m" (lock->slock) : : "memory");
+       asm volatile(__raw_spin_lock_string : "=m" (lock->slock) : : "memory");
 }
 
 #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
@@ -125,12 +122,12 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
 
 static inline void __raw_read_unlock(raw_rwlock_t *rw)
 {
-       asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory");
+       asm volatile(LOCK_PREFIX " ; incl %0" :"=m" (rw->lock) : : "memory");
 }
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
-       asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0"
+       asm volatile(LOCK_PREFIX " ; addl $" RW_LOCK_BIAS_STR ",%0"
                                : "=m" (rw->lock) : : "memory");
 }