The patch titled Create asm-x86_64/cmpxchg.h has been removed from the -mm tree. Its filename was create-asm-x86_64-cmpxchgh.patch This patch was dropped because it was folded into x86-create-asm-cmpxchgh.patch ------------------------------------------------------ Subject: Create asm-x86_64/cmpxchg.h From: Jeff Dike <jdike@xxxxxxxxxxx> This is the x86_64 movement of cmpxchg into its own header. atomic.h already included system.h, so this is changed to include cmpxchg.h. This is purely cleanup - it's not fixing any warnings - so if the x86_64 system.h isn't considered as cleanup-worthy as i386, then this can be dropped. It causes no noticable damage to the x86_64 build. Signed-off-by: Jeff Dike <jdike@xxxxxxxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxx> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-x86_64/atomic.h | 2 include/asm-x86_64/cmpxchg.h | 134 +++++++++++++++++++++++++++++++++ include/asm-x86_64/system.h | 130 -------------------------------- 3 files changed, 136 insertions(+), 130 deletions(-) diff -puN include/asm-x86_64/atomic.h~create-asm-x86_64-cmpxchgh include/asm-x86_64/atomic.h --- a/include/asm-x86_64/atomic.h~create-asm-x86_64-cmpxchgh +++ a/include/asm-x86_64/atomic.h @@ -2,7 +2,7 @@ #define __ARCH_X86_64_ATOMIC__ #include <asm/alternative.h> -#include <asm/system.h> +#include <asm/cmpxchg.h> /* atomic_t should be 32 bit signed type */ diff -puN /dev/null include/asm-x86_64/cmpxchg.h --- /dev/null +++ a/include/asm-x86_64/cmpxchg.h @@ -0,0 +1,134 @@ +#ifndef __ASM_CMPXCHG_H +#define __ASM_CMPXCHG_H + +#include <asm/alternative.h> /* Provides LOCK_PREFIX */ + +#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) + +#define __xg(x) ((volatile long *)(x)) + +static inline void set_64bit(volatile unsigned long *ptr, unsigned long val) +{ + *ptr = val; +} + +#define _set_64bit set_64bit + +/* + * Note: no "lock" prefix even on SMP: xchg always implies lock anyway + * Note 2: xchg has side effect, so that attribute volatile is necessary, + * but generally the primitive is invalid, *ptr is output argument. --ANK + */ +static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) +{ + switch (size) { + case 1: + __asm__ __volatile__("xchgb %b0,%1" + :"=q" (x) + :"m" (*__xg(ptr)), "0" (x) + :"memory"); + break; + case 2: + __asm__ __volatile__("xchgw %w0,%1" + :"=r" (x) + :"m" (*__xg(ptr)), "0" (x) + :"memory"); + break; + case 4: + __asm__ __volatile__("xchgl %k0,%1" + :"=r" (x) + :"m" (*__xg(ptr)), "0" (x) + :"memory"); + break; + case 8: + __asm__ __volatile__("xchgq %0,%1" + :"=r" (x) + :"m" (*__xg(ptr)), "0" (x) + :"memory"); + break; + } + return x; +} + +/* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#define __HAVE_ARCH_CMPXCHG 1 + +static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) +{ + unsigned long prev; + switch (size) { + case 1: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 2: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" + : "=a"(prev) + : "r"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 4: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" + : "=a"(prev) + : "r"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 8: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" + : "=a"(prev) + : "r"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + } + return old; +} + +static inline unsigned long __cmpxchg_local(volatile void *ptr, + unsigned long old, unsigned long new, int size) +{ + unsigned long prev; + switch (size) { + case 1: + __asm__ __volatile__("cmpxchgb %b1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 2: + __asm__ __volatile__("cmpxchgw %w1,%2" + : "=a"(prev) + : "r"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 4: + __asm__ __volatile__("cmpxchgl %k1,%2" + : "=a"(prev) + : "r"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 8: + __asm__ __volatile__("cmpxchgq %1,%2" + : "=a"(prev) + : "r"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + } + return old; +} + +#define cmpxchg(ptr,o,n)\ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ + (unsigned long)(n),sizeof(*(ptr)))) +#define cmpxchg_local(ptr,o,n)\ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ + (unsigned long)(n),sizeof(*(ptr)))) + +#endif diff -puN include/asm-x86_64/system.h~create-asm-x86_64-cmpxchgh include/asm-x86_64/system.h --- a/include/asm-x86_64/system.h~create-asm-x86_64-cmpxchgh +++ a/include/asm-x86_64/system.h @@ -3,7 +3,7 @@ #include <linux/kernel.h> #include <asm/segment.h> -#include <asm/alternative.h> +#include <asm/cmpxchg.h> #ifdef __KERNEL__ @@ -124,134 +124,6 @@ static inline void sched_cacheflush(void #define nop() __asm__ __volatile__ ("nop") -#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) - -#define __xg(x) ((volatile long *)(x)) - -static inline void set_64bit(volatile unsigned long *ptr, unsigned long val) -{ - *ptr = val; -} - -#define _set_64bit set_64bit - -/* - * Note: no "lock" prefix even on SMP: xchg always implies lock anyway - * Note 2: xchg has side effect, so that attribute volatile is necessary, - * but generally the primitive is invalid, *ptr is output argument. --ANK - */ -static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) -{ - switch (size) { - case 1: - __asm__ __volatile__("xchgb %b0,%1" - :"=q" (x) - :"m" (*__xg(ptr)), "0" (x) - :"memory"); - break; - case 2: - __asm__ __volatile__("xchgw %w0,%1" - :"=r" (x) - :"m" (*__xg(ptr)), "0" (x) - :"memory"); - break; - case 4: - __asm__ __volatile__("xchgl %k0,%1" - :"=r" (x) - :"m" (*__xg(ptr)), "0" (x) - :"memory"); - break; - case 8: - __asm__ __volatile__("xchgq %0,%1" - :"=r" (x) - :"m" (*__xg(ptr)), "0" (x) - :"memory"); - break; - } - return x; -} - -/* - * Atomic compare and exchange. Compare OLD with MEM, if identical, - * store NEW in MEM. Return the initial value in MEM. Success is - * indicated by comparing RETURN with OLD. - */ - -#define __HAVE_ARCH_CMPXCHG 1 - -static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, - unsigned long new, int size) -{ - unsigned long prev; - switch (size) { - case 1: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 2: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" - : "=a"(prev) - : "r"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 4: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" - : "=a"(prev) - : "r"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 8: - __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" - : "=a"(prev) - : "r"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - } - return old; -} - -static inline unsigned long __cmpxchg_local(volatile void *ptr, - unsigned long old, unsigned long new, int size) -{ - unsigned long prev; - switch (size) { - case 1: - __asm__ __volatile__("cmpxchgb %b1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 2: - __asm__ __volatile__("cmpxchgw %w1,%2" - : "=a"(prev) - : "r"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 4: - __asm__ __volatile__("cmpxchgl %k1,%2" - : "=a"(prev) - : "r"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 8: - __asm__ __volatile__("cmpxchgq %1,%2" - : "=a"(prev) - : "r"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - } - return old; -} - -#define cmpxchg(ptr,o,n)\ - ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ - (unsigned long)(n),sizeof(*(ptr)))) -#define cmpxchg_local(ptr,o,n)\ - ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ - (unsigned long)(n),sizeof(*(ptr)))) - #ifdef CONFIG_SMP #define smp_mb() mb() #define smp_rmb() rmb() _ Patches currently in -mm which might be from jdike@xxxxxxxxxxx are uml-delete-unused-code.patch uml-formatting-fixes.patch uml-host_info-tidying.patch uml-mark-tt-mode-code-for-future-removal.patch uml-print-coredump-limits.patch uml-handle-block-device-hotplug-errors.patch uml-driver-formatting-fixes.patch uml-driver-formatting-fixes-fix.patch uml-network-interface-hotplug-error-handling.patch array_size-check-for-type.patch uml-move-sigio-testing-to-sigioc.patch uml-create-archh.patch uml-create-as-layouth.patch uml-move-remaining-useful-contents-of-user_utilh.patch uml-remove-user_utilh.patch uml-add-missing-__init-declarations.patch remove-unused-header-file-arch-um-kernel-tt-include-mode_kern-tth.patch uml-speed-up-exec.patch uml-no-locking-needed-in-tlsc.patch uml-tidy-processc.patch uml-remove-page_size.patch uml-kernel_thread-shouldnt-panic.patch uml-tidy-fault-code.patch uml-kernel-segfaults-should-dump-proper-registers.patch uml-comment-early-boot-locking.patch uml-irq-locking-commentary.patch uml-delete-host_frame_size.patch uml-drivers-get-release-methods.patch uml-dump-registers-on-ptrace-or-wait-failure.patch uml-speed-up-page-table-walking.patch uml-remove-unused-x86_64-code.patch uml-start-fixing-os_read_file-and-os_write_file.patch uml-tidy-libc-code.patch uml-convert-libc-layer-to-call-read-and-write.patch uml-batch-i-o-requests.patch uml-send-pointers-instead-of-structures-to-i-o-thread.patch uml-send-pointers-instead-of-structures-to-i-o-thread-fix.patch uml-dump-core-on-panic.patch uml-dont-try-to-handle-signals-on-initial-process-stack.patch uml-change-remaining-callers-of-os_read_write_file.patch uml-formatting-fixes-around-os_read_write_file-callers.patch uml-remove-debugging-remnants.patch uml-rename-os_read_write_file_k-back-to-os_read_write_file.patch uml-aio-deadlock-avoidance.patch uml-speed-page-fault-path.patch uml-eliminate-a-piece-of-debugging-code.patch uml-more-page-fault-path-trimming.patch uml-only-flush-areas-covered-by-vma.patch uml-out-of-tmpfs-space-error-clarification.patch uml-virtualized-time-fix.patch uml-fix-prototypes.patch remove-tas.patch x86-create-asm-cmpxchgh.patch create-asm-x86_64-cmpxchgh.patch uml-forgot-asm-um-cmpxchgh.patch uml-network-and-pcap-cleanup.patch uml-pcap-devices-should-get-macs-from-command-line.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html