Skip to contentSkip to conversation

x86: disable SSE on 32-bit hosts

PATCH In review Paolo Bonzini 2 participants 3 messages Jun 16, 2020 – Jun 23, 2020 KVM

lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 x86: disable SSE on 32-bit hosts

On 64-bit hosts we are disabling SSE and SSE2. Depending on the compiler however it may use movq instructions for 64-bit transfers even when targeting 32-bit processors; when CR4.OSFXSR is not set, this results in an undefined opcode exception, so tell the compiler to avoid those instructions on 32-bit hosts as well.

---
 x86/Makefile.i386 | 1 +
 1 file changed, 1 insertion(+)
x86/Makefile.i386 +1 -0
index d801b80..be9d6bc 100644
@@ -1,6 +1,7 @@
 cstart.o = $(TEST_DIR)/cstart.o
 bits = 32
 ldarch = elf32-i386
+COMMON_CFLAGS += -mno-sse -mno-sse2
 
 cflatobjs += lib/x86/setjmp32.o
 
Signature · 1 line
2.26.2
#1 lore raw
Quoted 16 lines · Paolo Bonzini

On 64-bit hosts we are disabling SSE and SSE2. Depending on the compiler however it may use movq instructions for 64-bit transfers even when targeting 32-bit processors; when CR4.OSFXSR is not set, this results in an undefined opcode exception, so tell the compiler to avoid those instructions on 32-bit hosts as well.

---
 x86/Makefile.i386 | 1 +
 1 file changed, 1 insertion(+)
x86/Makefile.i386 +0 -0
index d801b80..be9d6bc 100644

x86/Makefile.i386 line 4

Quoted 4 lines
x86/Makefile.i386 +1 -0
@@ -1,6 +1,7 @@
 cstart.o = $(TEST_DIR)/cstart.o
 bits = 32
 ldarch = elf32-i386
+COMMON_CFLAGS += -mno-sse -mno-sse2

That's likely a good idea, but it still does not fix the problem in the gitlab-ci:

https://gitlab.com/huth/kvm-unit-tests/-/jobs/597747782#L1934

?

Thomas

author maintainer
#2 lore raw
Quoted 25 lines · Thomas Huth
Quoted 16 lines · Paolo Bonzini

On 64-bit hosts we are disabling SSE and SSE2. Depending on the compiler however it may use movq instructions for 64-bit transfers even when targeting 32-bit processors; when CR4.OSFXSR is not set, this results in an undefined opcode exception, so tell the compiler to avoid those instructions on 32-bit hosts as well.

---
 x86/Makefile.i386 | 1 +
 1 file changed, 1 insertion(+)
x86/Makefile.i386 +0 -0
index d801b80..be9d6bc 100644

x86/Makefile.i386 line 4

Quoted 4 lines
x86/Makefile.i386 +1 -0
@@ -1,6 +1,7 @@
 cstart.o = $(TEST_DIR)/cstart.o
 bits = 32
 ldarch = elf32-i386
+COMMON_CFLAGS += -mno-sse -mno-sse2

That's likely a good idea, but it still does not fix the problem in the gitlab-ci:

Quoted 1 line

https://gitlab.com/huth/kvm-unit-tests/-/jobs/597747782#L1934

Hmm, it does fix everything here. How does one go debugging what's happening in the CI?

Paolo