Skip to contentSkip to conversation

s390/percpu: Fix MVIY_PERCPU() with older binutils

PATCH Applied Karl Mehltretter 4 participants 4 messages Aug 12 – Aug 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/percpu: Fix MVIY_PERCPU() with older binutils

Commit a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations") introduced MVIY_PERCPU(), which stringifies arguments that are already C string literals. This generates an assembler macro invocation with whitespace-separated quoted arguments:

GEN_MVIY "459712" "%r3"

GNU as versions prior to binutils 2.39 drop the separating whitespace between quoted macro arguments during input scrubbing. They consequently parse the invocation as a single argument and emit repeated warnings:

Warning: missing closing `"'

The .ifc in GEN_MVIY never matches and GNU as exits successfully without emitting the mviy instruction. As a result, the interrupted per-CPU sequence is not marked in lowcore and the exception return path cannot repair the per-CPU address register after migration.

All MVIY_PERCPU() callers pass C string literals. Use them directly and separate the assembler macro arguments with an explicit comma. The resulting invocation is:

GEN_MVIY 459712, %r3

This form is unambiguous for GNU as and LLVM's integrated assembler. This behavior was fixed in GNU as from binutils 2.39, but Linux supports binutils 2.30.

Fixes a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations")
Assisted-by Codex:gpt-5.6-sol
---
 arch/s390/include/asm/percpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/percpu.h +2 -2
index 1d955dd0defa3..feb58acf87d69 100644
@@ -107,8 +107,8 @@
 	"	.endif\n"							\
 	".endr\n"								\
 	".endm\n"								\
-	ALTERNATIVE("GEN_MVIY " __stringify(disp)    " " __stringify(reg) "\n",	\
-		    "GEN_MVIY " __stringify(dispalt) " " __stringify(reg) "\n",	\
+	ALTERNATIVE("GEN_MVIY " disp    ", " reg "\n",				\
+		    "GEN_MVIY " dispalt ", " reg "\n",				\
 		    ALT_FEATURE(MFEATURE_LOWCORE))				\
 	".purgem GEN_MVIY\n"
 
Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 14 lines

Commit a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations") introduced MVIY_PERCPU(), which stringifies arguments that are already C string literals. This generates an assembler macro invocation with whitespace-separated quoted arguments:

GEN_MVIY "459712" "%r3"

GNU as versions prior to binutils 2.39 drop the separating whitespace between quoted macro arguments during input scrubbing. They consequently parse the invocation as a single argument and emit repeated warnings:

Warning: missing closing `"'

Quoted 7 lines

The .ifc in GEN_MVIY never matches and GNU as exits successfully [ ... ]
supports binutils 2.30.

Fixes a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations")
Assisted-by Codex:gpt-5.6-sol

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Karl Mehltretter
Quoted 29 lines · Karl Mehltretter

Commit a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations") introduced MVIY_PERCPU(), which stringifies arguments that are already C string literals. This generates an assembler macro invocation with whitespace-separated quoted arguments:

GEN_MVIY "459712" "%r3"

GNU as versions prior to binutils 2.39 drop the separating whitespace between quoted macro arguments during input scrubbing. They consequently parse the invocation as a single argument and emit repeated warnings:

Warning: missing closing `"'

The .ifc in GEN_MVIY never matches and GNU as exits successfully without emitting the mviy instruction. As a result, the interrupted per-CPU sequence is not marked in lowcore and the exception return path cannot repair the per-CPU address register after migration.

All MVIY_PERCPU() callers pass C string literals. Use them directly and separate the assembler macro arguments with an explicit comma. The resulting invocation is:

GEN_MVIY 459712, %r3

This form is unambiguous for GNU as and LLVM's integrated assembler. This behavior was fixed in GNU as from binutils 2.39, but Linux supports binutils 2.30.

Quoted 6 lines
Fixes a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations")
Assisted-by Codex:gpt-5.6-sol
---
 arch/s390/include/asm/percpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks a lot. I'm about to change this code anyway. It seems it should better error out instead of generating incorrect code (even if there is a warning).

Vasily, could you add

please?

maintainer Applied
#3 lore raw
In reply to Karl Mehltretter
Quoted 29 lines · Karl Mehltretter

Commit a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations") introduced MVIY_PERCPU(), which stringifies arguments that are already C string literals. This generates an assembler macro invocation with whitespace-separated quoted arguments:

GEN_MVIY "459712" "%r3"

GNU as versions prior to binutils 2.39 drop the separating whitespace between quoted macro arguments during input scrubbing. They consequently parse the invocation as a single argument and emit repeated warnings:

Warning: missing closing `"'

The .ifc in GEN_MVIY never matches and GNU as exits successfully without emitting the mviy instruction. As a result, the interrupted per-CPU sequence is not marked in lowcore and the exception return path cannot repair the per-CPU address register after migration.

All MVIY_PERCPU() callers pass C string literals. Use them directly and separate the assembler macro arguments with an explicit comma. The resulting invocation is:

GEN_MVIY 459712, %r3

This form is unambiguous for GNU as and LLVM's integrated assembler. This behavior was fixed in GNU as from binutils 2.39, but Linux supports binutils 2.30.

Quoted 6 lines
Fixes a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations")
Assisted-by Codex:gpt-5.6-sol
---
 arch/s390/include/asm/percpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thank you!