* [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
@ 2024-10-31 4:53 Sean Christopherson
2024-10-31 11:57 ` Vitaly Kuznetsov
2024-11-05 5:56 ` Sean Christopherson
0 siblings, 2 replies; 4+ messages in thread
From: Sean Christopherson @ 2024-10-31 4:53 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Vitaly Kuznetsov, 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 <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
My big ol' AVX enabling series ain't looking so bad now ;-)
tools/testing/selftests/kvm/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 156fbfae940f..5fa282643cff 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -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
--
2.47.0.163.g1226f6d8fa-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
2024-10-31 4:53 [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported Sean Christopherson
@ 2024-10-31 11:57 ` Vitaly Kuznetsov
2024-10-31 17:07 ` Sean Christopherson
2024-11-05 5:56 ` Sean Christopherson
1 sibling, 1 reply; 4+ messages in thread
From: Vitaly Kuznetsov @ 2024-10-31 11:57 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
Sean Christopherson <seanjc@google.com> writes:
> 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 <vkuznets@redhat.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>
> My big ol' AVX enabling series ain't looking so bad now ;-)
Smaller the change, bigger the troubles :-)
>
> tools/testing/selftests/kvm/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index 156fbfae940f..5fa282643cff 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -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?
> 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
Reviewed-and-tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
--
Vitaly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
2024-10-31 11:57 ` Vitaly Kuznetsov
@ 2024-10-31 17:07 ` Sean Christopherson
0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2024-10-31 17:07 UTC (permalink / raw)
To: Vitaly Kuznetsov; +Cc: Paolo Bonzini, kvm, linux-kernel
On Thu, Oct 31, 2024, Vitaly Kuznetsov wrote:
> > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> > index 156fbfae940f..5fa282643cff 100644
> > --- a/tools/testing/selftests/kvm/Makefile
> > +++ b/tools/testing/selftests/kvm/Makefile
> > @@ -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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
2024-10-31 4:53 [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported Sean Christopherson
2024-10-31 11:57 ` Vitaly Kuznetsov
@ 2024-11-05 5:56 ` Sean Christopherson
1 sibling, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2024-11-05 5:56 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Vitaly Kuznetsov
On Wed, 30 Oct 2024 21:53:33 -0700, Sean Christopherson wrote:
> 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
--
https://github.com/kvm-x86/linux/tree/next
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-05 5:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 4:53 [PATCH] KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported Sean Christopherson
2024-10-31 11:57 ` Vitaly Kuznetsov
2024-10-31 17:07 ` Sean Christopherson
2024-11-05 5:56 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox