Skip to contentSkip to conversation

x86: restore semicolon after explicit DS prefix

PATCH In review Jan Beulich 2 participants 4 messages Oct 8, 2024 – Oct 9, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: restore semicolon after explicit DS prefix

It's not unnecessary (as the earlier commit claimed): The integrated assembler of Clang up to 11 complains about an "invalid operand for instruction".

Fixes b42cf31d1165 ("x86: use alternative_input() in cache_flush()")
xen/arch/x86/flushtlb.c +1 -1
@@ -286,7 +286,7 @@ void cache_flush(const void *addr, unsig
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_input("ds clflush %[p]",
+        alternative_input("ds; clflush %[p]",
                           "data16 clflush %[p]", /* clflushopt */
                            X86_FEATURE_CLFLUSHOPT,
                            [p] "m" (*(const char *)(addr)));
#1 lore raw
Quoted 10 lines · Jan Beulich

It's not unnecessary (as the earlier commit claimed): The integrated assembler of Clang up to 11 complains about an "invalid operand for instruction".

Fixes b42cf31d1165 ("x86: use alternative_input() in cache_flush()")

xen/arch/x86/flushtlb.c void cache_flush(const void *addr, unsig · line 289

Quoted 5 lines
xen/arch/x86/flushtlb.c +1 -1
@@ -286,7 +286,7 @@ void cache_flush(const void *addr, unsig
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_input("ds clflush %[p]",
+        alternative_input("ds; clflush %[p]",

/* Clang-IAS < 12 needs the semicolon */  which can probably fit on the end of the line.

Or we stop supporting such old versions of Clang/LLVM.

~Andrew

#2 lore raw
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Jan Beulich

It's not unnecessary (as the earlier commit claimed): The integrated assembler of Clang up to 11 complains about an "invalid operand for instruction".

Fixes b42cf31d1165 ("x86: use alternative_input() in cache_flush()")
Quoted 11 lines

xen/arch/x86/flushtlb.c void cache_flush(const void *addr, unsig · line 289

Quoted 8 lines
xen/arch/x86/flushtlb.c +1 -1
@@ -286,7 +286,7 @@ void cache_flush(const void *addr, unsig
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_input("ds clflush %[p]",
+        alternative_input("ds; clflush %[p]",

/* Clang-IAS < 12 needs the semicolon */  which can probably fit on the end of the line.

I've made it "Semicolon for Clang-IAS < 12" to actually fit on the line.

I wonder whether I can take the reply as "ack with that change"?

Quoted 1 line

Or we stop supporting such old versions of Clang/LLVM.

As indicated in reply to Roger's proposal, that would leave me without any way to test with at least some Clang versions (unless I got into the business of also building my own Clang binaries). IOW - I could live with such a move, but I'd prefer us not to be overly aggressive there.

Jan

Acked-by
#3 lore raw
Quoted 19 lines · Jan Beulich
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Jan Beulich

It's not unnecessary (as the earlier commit claimed): The integrated assembler of Clang up to 11 complains about an "invalid operand for instruction".

Fixes b42cf31d1165 ("x86: use alternative_input() in cache_flush()")
Quoted 10 lines

xen/arch/x86/flushtlb.c void cache_flush(const void *addr, unsig · line 289

Quoted 8 lines
xen/arch/x86/flushtlb.c +1 -1
@@ -286,7 +286,7 @@ void cache_flush(const void *addr, unsig
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_input("ds clflush %[p]",
+        alternative_input("ds; clflush %[p]",

/* Clang-IAS < 12 needs the semicolon */  which can probably fit on the end of the line.

Quoted 3 lines

I've made it "Semicolon for Clang-IAS < 12" to actually fit on the line.

I wonder whether I can take the reply as "ack with that change"?

Yeah, that's good enough.

Quoted 5 lines
Quoted 2 lines

Or we stop supporting such old versions of Clang/LLVM.

As indicated in reply to Roger's proposal, that would leave me without any way to test with at least some Clang versions (unless I got into the business of also building my own Clang binaries).

Or using the upstream provided builds.  (Seriously - this is something the LLVM community completely outshine the GCC/Binutils community.)

Or using Gitlab CI.

~Andrew