KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
Sean Christopherson
reviewerPATCH 1/1 KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
Force -march=x86-64-v2 to avoid SSE/AVX instructions if and only if the uarch definition is supported by the compiler, e.g. gcc 7.5 only supports x86-64.
---
My big ol' AVX enabling series ain't looking so bad now ;-)
tools/testing/selftests/kvm/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/Makefile +2 -0
@@ -249,8 +249,10 @@ ifeq ($(ARCH),s390) CFLAGS += -march=z10 endif ifeq ($(ARCH),x86) +ifeq ($(shell echo "void foo(void) { }" | $(CC) -march=x86-64-v2 -x c - -c -o /dev/null 2>/dev/null; echo "$$?"),0) CFLAGS += -march=x86-64-v2 endif +endif ifeq ($(ARCH),arm64) tools_dir := $(top_srcdir)/tools arm64_tools_dir := $(tools_dir)/arch/arm64/tools/
base-commit: 81983758430957d9a5cb3333fe324fd70cf63e7e
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Quoted 10 lines · Sean Christopherson
Force -march=x86-64-v2 to avoid SSE/AVX instructions if and only if the uarch definition is supported by the compiler, e.g. gcc 7.5 only supports x86-64.
Fixes 9a400068a158 ("KVM: selftests: x86: Avoid using SSE/AVX instructions")Cc Vitaly Kuznetsov <[email protected]>Signed-off-by Sean Christopherson <[email protected]>---
My big ol' AVX enabling series ain't looking so bad now ;-)
Smaller the change, bigger the troubles :-)
tools/testing/selftests/kvm/Makefile ifeq ($(ARCH),s390) · line 252
Quoted 13 lines
tools/testing/selftests/kvm/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/kvm/Makefile +1
-0@@ -249,8 +249,10 @@ ifeq ($(ARCH),s390) CFLAGS += -march=z10 endif ifeq ($(ARCH),x86) +ifeq ($(shell echo "void foo(void) { }" | $(CC) -march=x86-64-v2 -x c - -c -o /dev/null 2>/dev/null; echo "$$?"),0)
With this test, the outer "ifeq ($(ARCH),x86)" check is not really needed anymore I guess?
Quoted 8 lines
tools/testing/selftests/kvm/Makefile +1
-0CFLAGS += -march=x86-64-v2 endif +endif ifeq ($(ARCH),arm64) tools_dir := $(top_srcdir)/tools arm64_tools_dir := $(tools_dir)/arch/arm64/tools/base-commit:
81983758430957d9a5cb3333fe324fd70cf63e7e
Signature · 1 line
Vitaly
Sean Christopherson
reviewerQuoted 4 lines · Vitaly Kuznetsov
Quoted 4 lines
tools/testing/selftests/kvm/Makefile +0
-0
Quoted 8 lines
tools/testing/selftests/kvm/Makefile ifeq ($(ARCH),s390) · line 252
Quoted 5 lines
tools/testing/selftests/kvm/Makefile +1
-0@@ -249,8 +249,10 @@ ifeq ($(ARCH),s390) CFLAGS += -march=z10 endif ifeq ($(ARCH),x86) +ifeq ($(shell echo "void foo(void) { }" | $(CC) -march=x86-64-v2 -x c - -c -o /dev/null 2>/dev/null; echo "$$?"),0)With this test, the outer "ifeq ($(ARCH),x86)" check is not really needed anymore I guess?
Yeah, but at this point in the v6.12 cycle, I want to do the absolute bare minimum. In 6.13, after the AVX support lands, I think we can/should revert this restriction, i.e. it's a short-term wart.
Quoted 3 lines · Sean Christopherson
Force -march=x86-64-v2 to avoid SSE/AVX instructions if and only if the uarch definition is supported by the compiler, e.g. gcc 7.5 only supports x86-64.
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
https://github.com/kvm-x86/linux/commit/979956bc6811