mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

two locking commits in the locking tree, part of the locking-core-2025-03-22 pull request. ] x86 CPU features support: - Generate the <asm/cpufeaturemasks.h> header based on build config (H. Peter Anvin, Xin Li) - x86 CPUID parsing updates and fixes (Ahmed S. Darwish) - Introduce the 'setcpuid=' boot parameter (Brendan Jackman) - Enable modifying CPU bug flags with '{clear,set}puid=' (Brendan Jackman) - Utilize CPU-type for CPU matching (Pawan Gupta) - Warn about unmet CPU feature dependencies (Sohil Mehta) - Prepare for new Intel Family numbers (Sohil Mehta) Percpu code: - Standardize & reorganize the x86 percpu layout and related cleanups (Brian Gerst) - Convert the stackprotector canary to a regular percpu variable (Brian Gerst) - Add a percpu subsection for cache hot data (Brian Gerst) - Unify __pcpu_op{1,2}_N() macros to __pcpu_op_N() (Uros Bizjak) - Construct __percpu_seg_override from __percpu_seg (Uros Bizjak) MM: - Add support for broadcast TLB invalidation using AMD's INVLPGB instruction (Rik van Riel) - Rework ROX cache to avoid writable copy (Mike Rapoport) - PAT: restore large ROX pages after fragmentation (Kirill A. Shutemov, Mike Rapoport) - Make memremap(MEMREMAP_WB) map memory as encrypted by default (Kirill A. Shutemov) - Robustify page table initialization (Kirill A. Shutemov) - Fix flush_tlb_range() when used for zapping normal PMDs (Jann Horn) - Clear _PAGE_DIRTY for kernel mappings when we clear _PAGE_RW (Matthew Wilcox) KASLR: - x86/kaslr: Reduce KASLR entropy on most x86 systems, to support PCI BAR space beyond the 10TiB region (CONFIG_PCI_P2PDMA=y) (Balbir Singh) CPU bugs: - Implement FineIBT-BHI mitigation (Peter Zijlstra) - speculation: Simplify and make CALL_NOSPEC consistent (Pawan Gupta) - speculation: Add a conditional CS prefix to CALL_NOSPEC (Pawan Gupta) - RFDS: Exclude P-only parts from the RFDS affected list (Pawan Gupta) System calls: - Break up entry/common.c (Brian Gerst) - Move sysctls into arch/x86 (Joel Granados) Intel LAM support updates: (Maciej Wieczor-Retman) - selftests/lam: Move cpu_has_la57() to use cpuinfo flag - selftests/lam: Skip test if LAM is disabled - selftests/lam: Test get_user() LAM pointer handling AMD SMN access updates: - Add SMN offsets to exclusive region access (Mario Limonciello) - Add support for debugfs access to SMN registers (Mario Limonciello) - Have HSMP use SMN through AMD_NODE (Yazen Ghannam) Power management updates: (Patryk Wlazlyn) - Allow calling mwait_play_dead with an arbitrary hint - ACPI/processor_idle: Add FFH state handling - intel_idle: Provide the default enter_dead() handler - Eliminate mwait_play_dead_cpuid_hint() Bootup: Build system: - Raise the minimum GCC version to 8.1 (Brian Gerst) - Raise the minimum LLVM version to 15.0.0 (Nathan Chancellor) Kconfig: (Arnd Bergmann) - Add cmpxchg8b support back to Geode CPUs - Drop 32-bit "bigsmp" machine support - Rework CONFIG_GENERIC_CPU compiler flags - Drop configuration options for early 64-bit CPUs - Remove CONFIG_HIGHMEM64G support - Drop CONFIG_SWIOTLB for PAE - Drop support for CONFIG_HIGHPTE - Document CONFIG_X86_INTEL_MID as 64-bit-only - Remove old STA2x11 support - Only allow CONFIG_EISA for 32-bit Headers: - Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI and non-UAPI headers (Thomas Huth) Assembly code & machine code patching: - x86/alternatives: Simplify alternative_call() interface (Josh Poimboeuf) - x86/alternatives: Simplify callthunk patching (Peter Zijlstra) - KVM: VMX: Use named operands in inline asm (Josh Poimboeuf) - x86/hyperv: Use named operands in inline asm (Josh Poimboeuf) - x86/traps: Cleanup and robustify decode_bug() (Peter Zijlstra) - x86/kexec: Merge x86_32 and x86_64 code using macros from <asm/asm.h> (Uros Bizjak) - Use named operands in inline asm (Uros Bizjak) - Improve performance by using asm_inline() for atomic locking instructions (Uros Bizjak) Earlyprintk: - Harden early_serial (Peter Zijlstra) NMI handler: - Add an emergency handler in nmi_desc & use it in nmi_shootdown_cpus() (Waiman Long) Miscellaneous fixes and cleanups: - by Ahmed S. Darwish, Andy Shevchenko, Ard Biesheuvel, Artem Bityutskiy, Borislav Petkov, Brendan Jackman, Brian Gerst, Dan Carpenter, Dr. David Alan Gilbert, H. Peter Anvin, Ingo Molnar, Josh Poimboeuf, Kevin Brodsky, Mike Rapoport, Lukas Bulwahn, Maciej Wieczor-Retman, Max Grobecker, Patryk Wlazlyn, Pawan Gupta, Peter Zijlstra, Philip Redkin, Qasim Ijaz, Rik van Riel, Thomas Gleixner, Thorsten Blum, Tom Lendacky, Tony Luck, Uros Bizjak, Vitaly Kuznetsov, Xin Li, liuye. Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmfenkQRHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1g1FRAAi6OFTSn/5aeLMI0IMNBxJ6ddQiFc3imd 7+C/vU5nul4CyDs8mKyj/+f/DDrbkG9lKz3VG631Yl237lXHjD8XWcVMeC/1z/q0 3zInDIloE9/nBHRPkF6F7fARBLBZ0LFgaBsGrCo7mwpGybiQdqGcqcxllvTbtXaw OHta4q6ok+lBDNlfc0v6H4cRnzhmmlKu6Ng0j6UI3V7uFhi3vtxas32ltDQtzorq 2+jbV6/+kbrrv+xPC+jlzOFhTEKRupNPQXmvyQteoQg6G3kqAKMDvBthGXd1rHuX Qa+BoDIifE/2NiVeRwNrhoqYH/pHCzUzDREW5IW8+ca+4XNKuzAC6EuC8CeCzyK1 q8ZjZjooQW4zEeVFeJYllHONzJYfxfSH5CLsnbcuhq99yfGlrQhF1qL72/Omn1w/ DfPJM8Zt5zyKvLqUg3Md+fkVCO2wyDNhB61QPzRgHF+yD+rvuDpoqvUWir+w7cSn fwEDVZGXlFx6dumtSrqRaTd1nvFt80s8yP2ll09DMvGQ8D/yruS7hndGAmmJVCSW NAfd8pSjq5v2+ux2UR92/Cc3VF3SjaUqHBOp/Nq9rESya18ZVa3cJpHhVYYtPIVf THW0h07RIkGVKs1uq+5ekLCr/8uAZg58UPIqmhTuW0ttymRHCNfohR45FQZzy+0M tJj1oc2TIZw= =Dcb3 -----END PGP SIGNATURE----- Merge tag 'x86-core-2025-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull core x86 updates from Ingo Molnar: "x86 CPU features support: - Generate the <asm/cpufeaturemasks.h> header based on build config (H. Peter Anvin, Xin Li) - x86 CPUID parsing updates and fixes (Ahmed S. Darwish) - Introduce the 'setcpuid=' boot parameter (Brendan Jackman) - Enable modifying CPU bug flags with '{clear,set}puid=' (Brendan Jackman) - Utilize CPU-type for CPU matching (Pawan Gupta) - Warn about unmet CPU feature dependencies (Sohil Mehta) - Prepare for new Intel Family numbers (Sohil Mehta) Percpu code: - Standardize & reorganize the x86 percpu layout and related cleanups (Brian Gerst) - Convert the stackprotector canary to a regular percpu variable (Brian Gerst) - Add a percpu subsection for cache hot data (Brian Gerst) - Unify __pcpu_op{1,2}_N() macros to __pcpu_op_N() (Uros Bizjak) - Construct __percpu_seg_override from __percpu_seg (Uros Bizjak) MM: - Add support for broadcast TLB invalidation using AMD's INVLPGB instruction (Rik van Riel) - Rework ROX cache to avoid writable copy (Mike Rapoport) - PAT: restore large ROX pages after fragmentation (Kirill A. Shutemov, Mike Rapoport) - Make memremap(MEMREMAP_WB) map memory as encrypted by default (Kirill A. Shutemov) - Robustify page table initialization (Kirill A. Shutemov) - Fix flush_tlb_range() when used for zapping normal PMDs (Jann Horn) - Clear _PAGE_DIRTY for kernel mappings when we clear _PAGE_RW (Matthew Wilcox) KASLR: - x86/kaslr: Reduce KASLR entropy on most x86 systems, to support PCI BAR space beyond the 10TiB region (CONFIG_PCI_P2PDMA=y) (Balbir Singh) CPU bugs: - Implement FineIBT-BHI mitigation (Peter Zijlstra) - speculation: Simplify and make CALL_NOSPEC consistent (Pawan Gupta) - speculation: Add a conditional CS prefix to CALL_NOSPEC (Pawan Gupta) - RFDS: Exclude P-only parts from the RFDS affected list (Pawan Gupta) System calls: - Break up entry/common.c (Brian Gerst) - Move sysctls into arch/x86 (Joel Granados) Intel LAM support updates: (Maciej Wieczor-Retman) - selftests/lam: Move cpu_has_la57() to use cpuinfo flag - selftests/lam: Skip test if LAM is disabled - selftests/lam: Test get_user() LAM pointer handling AMD SMN access updates: - Add SMN offsets to exclusive region access (Mario Limonciello) - Add support for debugfs access to SMN registers (Mario Limonciello) - Have HSMP use SMN through AMD_NODE (Yazen Ghannam) Power management updates: (Patryk Wlazlyn) - Allow calling mwait_play_dead with an arbitrary hint - ACPI/processor_idle: Add FFH state handling - intel_idle: Provide the default enter_dead() handler - Eliminate mwait_play_dead_cpuid_hint() Build system: - Raise the minimum GCC version to 8.1 (Brian Gerst) - Raise the minimum LLVM version to 15.0.0 (Nathan Chancellor) Kconfig: (Arnd Bergmann) - Add cmpxchg8b support back to Geode CPUs - Drop 32-bit "bigsmp" machine support - Rework CONFIG_GENERIC_CPU compiler flags - Drop configuration options for early 64-bit CPUs - Remove CONFIG_HIGHMEM64G support - Drop CONFIG_SWIOTLB for PAE - Drop support for CONFIG_HIGHPTE - Document CONFIG_X86_INTEL_MID as 64-bit-only - Remove old STA2x11 support - Only allow CONFIG_EISA for 32-bit Headers: - Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI and non-UAPI headers (Thomas Huth) Assembly code & machine code patching: - x86/alternatives: Simplify alternative_call() interface (Josh Poimboeuf) - x86/alternatives: Simplify callthunk patching (Peter Zijlstra) - KVM: VMX: Use named operands in inline asm (Josh Poimboeuf) - x86/hyperv: Use named operands in inline asm (Josh Poimboeuf) - x86/traps: Cleanup and robustify decode_bug() (Peter Zijlstra) - x86/kexec: Merge x86_32 and x86_64 code using macros from <asm/asm.h> (Uros Bizjak) - Use named operands in inline asm (Uros Bizjak) - Improve performance by using asm_inline() for atomic locking instructions (Uros Bizjak) Earlyprintk: - Harden early_serial (Peter Zijlstra) NMI handler: - Add an emergency handler in nmi_desc & use it in nmi_shootdown_cpus() (Waiman Long) Miscellaneous fixes and cleanups: - by Ahmed S. Darwish, Andy Shevchenko, Ard Biesheuvel, Artem Bityutskiy, Borislav Petkov, Brendan Jackman, Brian Gerst, Dan Carpenter, Dr. David Alan Gilbert, H. Peter Anvin, Ingo Molnar, Josh Poimboeuf, Kevin Brodsky, Mike Rapoport, Lukas Bulwahn, Maciej Wieczor-Retman, Max Grobecker, Patryk Wlazlyn, Pawan Gupta, Peter Zijlstra, Philip Redkin, Qasim Ijaz, Rik van Riel, Thomas Gleixner, Thorsten Blum, Tom Lendacky, Tony Luck, Uros Bizjak, Vitaly Kuznetsov, Xin Li, liuye" * tag 'x86-core-2025-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (211 commits) zstd: Increase DYNAMIC_BMI2 GCC version cutoff from 4.8 to 11.0 to work around compiler segfault x86/asm: Make asm export of __ref_stack_chk_guard unconditional x86/mm: Only do broadcast flush from reclaim if pages were unmapped perf/x86/intel, x86/cpu: Replace Pentium 4 model checks with VFM ones perf/x86/intel, x86/cpu: Simplify Intel PMU initialization x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-UAPI headers x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers x86/locking/atomic: Improve performance by using asm_inline() for atomic locking instructions x86/asm: Use asm_inline() instead of asm() in clwb() x86/asm: Use CLFLUSHOPT and CLWB mnemonics in <asm/special_insns.h> x86/hweight: Use asm_inline() instead of asm() x86/hweight: Use ASM_CALL_CONSTRAINT in inline asm() x86/hweight: Use named operands in inline asm() x86/stackprotector/64: Only export __ref_stack_chk_guard on CONFIG_SMP x86/head/64: Avoid Clang < 17 stack protector in startup code x86/kexec: Merge x86_32 and x86_64 code using macros from <asm/asm.h> x86/runtime-const: Add the RUNTIME_CONST_PTR assembly macro x86/cpu/intel: Limit the non-architectural constant_tsc model checks x86/mm/pat: Replace Intel x86_model checks with VFM ones x86/cpu/intel: Fix fast string initialization for extended Families ...
248 lines
7.4 KiB
C
248 lines
7.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef ASM_X86_CMPXCHG_H
|
|
#define ASM_X86_CMPXCHG_H
|
|
|
|
#include <linux/compiler.h>
|
|
#include <asm/cpufeatures.h>
|
|
#include <asm/alternative.h> /* Provides LOCK_PREFIX */
|
|
|
|
/*
|
|
* Non-existent functions to indicate usage errors at link time
|
|
* (or compile-time if the compiler implements __compiletime_error().
|
|
*/
|
|
extern void __xchg_wrong_size(void)
|
|
__compiletime_error("Bad argument size for xchg");
|
|
extern void __cmpxchg_wrong_size(void)
|
|
__compiletime_error("Bad argument size for cmpxchg");
|
|
extern void __xadd_wrong_size(void)
|
|
__compiletime_error("Bad argument size for xadd");
|
|
extern void __add_wrong_size(void)
|
|
__compiletime_error("Bad argument size for add");
|
|
|
|
/*
|
|
* Constants for operation sizes. On 32-bit, the 64-bit size it set to
|
|
* -1 because sizeof will never return -1, thereby making those switch
|
|
* case statements guaranteed dead code which the compiler will
|
|
* eliminate, and allowing the "missing symbol in the default case" to
|
|
* indicate a usage error.
|
|
*/
|
|
#define __X86_CASE_B 1
|
|
#define __X86_CASE_W 2
|
|
#define __X86_CASE_L 4
|
|
#ifdef CONFIG_64BIT
|
|
#define __X86_CASE_Q 8
|
|
#else
|
|
#define __X86_CASE_Q -1 /* sizeof will never return -1 */
|
|
#endif
|
|
|
|
/*
|
|
* An exchange-type operation, which takes a value and a pointer, and
|
|
* returns the old value.
|
|
*/
|
|
#define __xchg_op(ptr, arg, op, lock) \
|
|
({ \
|
|
__typeof__ (*(ptr)) __ret = (arg); \
|
|
switch (sizeof(*(ptr))) { \
|
|
case __X86_CASE_B: \
|
|
asm_inline volatile (lock #op "b %b0, %1" \
|
|
: "+q" (__ret), "+m" (*(ptr)) \
|
|
: : "memory", "cc"); \
|
|
break; \
|
|
case __X86_CASE_W: \
|
|
asm_inline volatile (lock #op "w %w0, %1" \
|
|
: "+r" (__ret), "+m" (*(ptr)) \
|
|
: : "memory", "cc"); \
|
|
break; \
|
|
case __X86_CASE_L: \
|
|
asm_inline volatile (lock #op "l %0, %1" \
|
|
: "+r" (__ret), "+m" (*(ptr)) \
|
|
: : "memory", "cc"); \
|
|
break; \
|
|
case __X86_CASE_Q: \
|
|
asm_inline volatile (lock #op "q %q0, %1" \
|
|
: "+r" (__ret), "+m" (*(ptr)) \
|
|
: : "memory", "cc"); \
|
|
break; \
|
|
default: \
|
|
__ ## op ## _wrong_size(); \
|
|
} \
|
|
__ret; \
|
|
})
|
|
|
|
/*
|
|
* Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
|
|
* Since this is generally used to protect other memory information, we
|
|
* use "asm volatile" and "memory" clobbers to prevent gcc from moving
|
|
* information around.
|
|
*/
|
|
#define arch_xchg(ptr, v) __xchg_op((ptr), (v), xchg, "")
|
|
|
|
/*
|
|
* 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 __raw_cmpxchg(ptr, old, new, size, lock) \
|
|
({ \
|
|
__typeof__(*(ptr)) __ret; \
|
|
__typeof__(*(ptr)) __old = (old); \
|
|
__typeof__(*(ptr)) __new = (new); \
|
|
switch (size) { \
|
|
case __X86_CASE_B: \
|
|
{ \
|
|
volatile u8 *__ptr = (volatile u8 *)(ptr); \
|
|
asm_inline volatile(lock "cmpxchgb %2, %1" \
|
|
: "=a" (__ret), "+m" (*__ptr) \
|
|
: "q" (__new), "0" (__old) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
case __X86_CASE_W: \
|
|
{ \
|
|
volatile u16 *__ptr = (volatile u16 *)(ptr); \
|
|
asm_inline volatile(lock "cmpxchgw %2, %1" \
|
|
: "=a" (__ret), "+m" (*__ptr) \
|
|
: "r" (__new), "0" (__old) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
case __X86_CASE_L: \
|
|
{ \
|
|
volatile u32 *__ptr = (volatile u32 *)(ptr); \
|
|
asm_inline volatile(lock "cmpxchgl %2, %1" \
|
|
: "=a" (__ret), "+m" (*__ptr) \
|
|
: "r" (__new), "0" (__old) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
case __X86_CASE_Q: \
|
|
{ \
|
|
volatile u64 *__ptr = (volatile u64 *)(ptr); \
|
|
asm_inline volatile(lock "cmpxchgq %2, %1" \
|
|
: "=a" (__ret), "+m" (*__ptr) \
|
|
: "r" (__new), "0" (__old) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
default: \
|
|
__cmpxchg_wrong_size(); \
|
|
} \
|
|
__ret; \
|
|
})
|
|
|
|
#define __cmpxchg(ptr, old, new, size) \
|
|
__raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
|
|
|
|
#define __sync_cmpxchg(ptr, old, new, size) \
|
|
__raw_cmpxchg((ptr), (old), (new), (size), "lock ")
|
|
|
|
#define __cmpxchg_local(ptr, old, new, size) \
|
|
__raw_cmpxchg((ptr), (old), (new), (size), "")
|
|
|
|
#ifdef CONFIG_X86_32
|
|
# include <asm/cmpxchg_32.h>
|
|
#else
|
|
# include <asm/cmpxchg_64.h>
|
|
#endif
|
|
|
|
#define arch_cmpxchg(ptr, old, new) \
|
|
__cmpxchg(ptr, old, new, sizeof(*(ptr)))
|
|
|
|
#define arch_sync_cmpxchg(ptr, old, new) \
|
|
__sync_cmpxchg(ptr, old, new, sizeof(*(ptr)))
|
|
|
|
#define arch_cmpxchg_local(ptr, old, new) \
|
|
__cmpxchg_local(ptr, old, new, sizeof(*(ptr)))
|
|
|
|
|
|
#define __raw_try_cmpxchg(_ptr, _pold, _new, size, lock) \
|
|
({ \
|
|
bool success; \
|
|
__typeof__(_ptr) _old = (__typeof__(_ptr))(_pold); \
|
|
__typeof__(*(_ptr)) __old = *_old; \
|
|
__typeof__(*(_ptr)) __new = (_new); \
|
|
switch (size) { \
|
|
case __X86_CASE_B: \
|
|
{ \
|
|
volatile u8 *__ptr = (volatile u8 *)(_ptr); \
|
|
asm_inline volatile(lock "cmpxchgb %[new], %[ptr]" \
|
|
CC_SET(z) \
|
|
: CC_OUT(z) (success), \
|
|
[ptr] "+m" (*__ptr), \
|
|
[old] "+a" (__old) \
|
|
: [new] "q" (__new) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
case __X86_CASE_W: \
|
|
{ \
|
|
volatile u16 *__ptr = (volatile u16 *)(_ptr); \
|
|
asm_inline volatile(lock "cmpxchgw %[new], %[ptr]" \
|
|
CC_SET(z) \
|
|
: CC_OUT(z) (success), \
|
|
[ptr] "+m" (*__ptr), \
|
|
[old] "+a" (__old) \
|
|
: [new] "r" (__new) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
case __X86_CASE_L: \
|
|
{ \
|
|
volatile u32 *__ptr = (volatile u32 *)(_ptr); \
|
|
asm_inline volatile(lock "cmpxchgl %[new], %[ptr]" \
|
|
CC_SET(z) \
|
|
: CC_OUT(z) (success), \
|
|
[ptr] "+m" (*__ptr), \
|
|
[old] "+a" (__old) \
|
|
: [new] "r" (__new) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
case __X86_CASE_Q: \
|
|
{ \
|
|
volatile u64 *__ptr = (volatile u64 *)(_ptr); \
|
|
asm_inline volatile(lock "cmpxchgq %[new], %[ptr]" \
|
|
CC_SET(z) \
|
|
: CC_OUT(z) (success), \
|
|
[ptr] "+m" (*__ptr), \
|
|
[old] "+a" (__old) \
|
|
: [new] "r" (__new) \
|
|
: "memory"); \
|
|
break; \
|
|
} \
|
|
default: \
|
|
__cmpxchg_wrong_size(); \
|
|
} \
|
|
if (unlikely(!success)) \
|
|
*_old = __old; \
|
|
likely(success); \
|
|
})
|
|
|
|
#define __try_cmpxchg(ptr, pold, new, size) \
|
|
__raw_try_cmpxchg((ptr), (pold), (new), (size), LOCK_PREFIX)
|
|
|
|
#define __sync_try_cmpxchg(ptr, pold, new, size) \
|
|
__raw_try_cmpxchg((ptr), (pold), (new), (size), "lock ")
|
|
|
|
#define __try_cmpxchg_local(ptr, pold, new, size) \
|
|
__raw_try_cmpxchg((ptr), (pold), (new), (size), "")
|
|
|
|
#define arch_try_cmpxchg(ptr, pold, new) \
|
|
__try_cmpxchg((ptr), (pold), (new), sizeof(*(ptr)))
|
|
|
|
#define arch_sync_try_cmpxchg(ptr, pold, new) \
|
|
__sync_try_cmpxchg((ptr), (pold), (new), sizeof(*(ptr)))
|
|
|
|
#define arch_try_cmpxchg_local(ptr, pold, new) \
|
|
__try_cmpxchg_local((ptr), (pold), (new), sizeof(*(ptr)))
|
|
|
|
/*
|
|
* xadd() adds "inc" to "*ptr" and atomically returns the previous
|
|
* value of "*ptr".
|
|
*
|
|
* xadd() is locked when multiple CPUs are online
|
|
*/
|
|
#define __xadd(ptr, inc, lock) __xchg_op((ptr), (inc), xadd, lock)
|
|
#define xadd(ptr, inc) __xadd((ptr), (inc), LOCK_PREFIX)
|
|
|
|
#endif /* ASM_X86_CMPXCHG_H */
|