Skip to content

Commit 4087e16

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/locking: Use ALT_OUTPUT_SP() for percpu_{,try_}cmpxchg{64,128}_op()
percpu_{,try_}cmpxchg{64,128}() macros use CALL instruction inside asm statement in one of their alternatives. Use ALT_OUTPUT_SP() macro to add required dependence on %esp register. ALT_OUTPUT_SP() implements the above dependence by adding ASM_CALL_CONSTRAINT to its arguments. This constraint should be used for any inline asm which has a CALL instruction, otherwise the compiler may schedule the asm before the frame pointer gets set up by the containing function, causing objtool to print a "call without frame pointer save/setup" warning. Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0ad2507 commit 4087e16

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

arch/x86/include/asm/percpu.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ do { \
350350
\
351351
asm qual (ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \
352352
"cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
353-
: [var] "+m" (__my_cpu_var(_var)), \
354-
"+a" (old__.low), \
355-
"+d" (old__.high) \
353+
: ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \
354+
"+a" (old__.low), \
355+
"+d" (old__.high)) \
356356
: "b" (new__.low), \
357357
"c" (new__.high), \
358358
"S" (&(_var)) \
@@ -381,10 +381,10 @@ do { \
381381
asm qual (ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \
382382
"cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
383383
CC_SET(z) \
384-
: CC_OUT(z) (success), \
385-
[var] "+m" (__my_cpu_var(_var)), \
386-
"+a" (old__.low), \
387-
"+d" (old__.high) \
384+
: ALT_OUTPUT_SP(CC_OUT(z) (success), \
385+
[var] "+m" (__my_cpu_var(_var)), \
386+
"+a" (old__.low), \
387+
"+d" (old__.high)) \
388388
: "b" (new__.low), \
389389
"c" (new__.high), \
390390
"S" (&(_var)) \
@@ -421,9 +421,9 @@ do { \
421421
\
422422
asm qual (ALTERNATIVE("call this_cpu_cmpxchg16b_emu", \
423423
"cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \
424-
: [var] "+m" (__my_cpu_var(_var)), \
425-
"+a" (old__.low), \
426-
"+d" (old__.high) \
424+
: ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \
425+
"+a" (old__.low), \
426+
"+d" (old__.high)) \
427427
: "b" (new__.low), \
428428
"c" (new__.high), \
429429
"S" (&(_var)) \
@@ -452,10 +452,10 @@ do { \
452452
asm qual (ALTERNATIVE("call this_cpu_cmpxchg16b_emu", \
453453
"cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \
454454
CC_SET(z) \
455-
: CC_OUT(z) (success), \
456-
[var] "+m" (__my_cpu_var(_var)), \
457-
"+a" (old__.low), \
458-
"+d" (old__.high) \
455+
: ALT_OUTPUT_SP(CC_OUT(z) (success), \
456+
[var] "+m" (__my_cpu_var(_var)), \
457+
"+a" (old__.low), \
458+
"+d" (old__.high)) \
459459
: "b" (new__.low), \
460460
"c" (new__.high), \
461461
"S" (&(_var)) \

0 commit comments

Comments
 (0)