linux/arch/x86/kernel/acpi
Uros Bizjak 890a0794b3 x86/ACPI/boot: Use try_cmpxchg() in __acpi_{acquire,release}_global_lock()
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
__acpi_{acquire,release}_global_lock().  x86 CMPXCHG instruction returns
success in ZF flag, so this change saves a compare after CMPXCHG
(and related MOV instruction in front of CMPXCHG).

Also, try_cmpxchg() implicitly assigns old *ptr value to "old" when CMPXCHG
fails. There is no need to re-read the value in the loop.

Note that the value from *ptr should be read using READ_ONCE() to prevent
the compiler from merging, refetching or reordering the read.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20230116162522.4072-1-ubizjak@gmail.com
2023-01-26 11:49:40 +01:00
..
apei.c x86/mce, cper: Pass x86 CPER through the MCA handling chain 2020-11-21 12:05:41 +01:00
boot.c x86/ACPI/boot: Use try_cmpxchg() in __acpi_{acquire,release}_global_lock() 2023-01-26 11:49:40 +01:00
cppc.c ACPI: CPPC: Fix enabling CPPC on AMD systems with shared memory 2022-07-13 21:13:14 +02:00
cstate.c x86/acpi/cstate: Optimize ARB_DISABLE on Centaur CPUs 2022-11-11 09:42:05 -08:00
Makefile x86/ACPI: CPPC: Rename cppc_msr.c to cppc.c 2022-03-08 19:16:43 +01:00
sleep.c PM: hibernate: Honour ACPI hardware signature by default for virtual guests 2022-03-16 19:29:32 +01:00
sleep.h x86/acpi: make "asmlinkage" part first thing in the function definition 2020-03-14 10:29:07 +01:00
wakeup_32.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
wakeup_64.S kasan: remove redundant config option 2021-04-16 16:10:36 -07:00