Re: [PATCH] KVM: selftests: x86: Avoid using SSE/AVX instructions

Mark Brown
2024-10-21T20:33:59Z

[-- Attachment #1: Type: text/plain, Size: 2331 bytes --]

On Mon, Oct 21, 2024 at 07:32:17PM +0100, Mark Brown wrote:
> On Fri, Sep 20, 2024 at 05:44:22PM +0200, Vitaly Kuznetsov wrote:
>
> > Some distros switched gcc to '-march=x86-64-v3' by default and while it's
> > hard to find a CPU which doesn't support it today, many KVM selftests fail
> > with
>
> This patch, which is queued in -next as 9a400068a1586bc4 targeted as a
> fix, breaks the build on non-x86 architectures:

This patch is now in Linus' tree, having been applied on Sunday and as a
result appeared in -next today.

>
> aarch64-linux-gnu-gcc -D_GNU_SOURCE= -Wall -Wstrict-prototypes -Wuninitialized
> -O2 -g -std=gnu99 -Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT
> -fno-builtin-memcmp -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-strnlen -fno-stack-protector -fno-PIE -I/build/stage/linux/tools/testing/selftests/../../../tools/include -I/build/stage/linux/tools/testing/selftests/../../../tools/arch/arm64/include -I/build/stage/linux/tools/testing/selftests/../../../usr/include/ -Iinclude -Iaarch64 -Iinclude/aarch64 -I ../rseq -I.. -march=x86-64-v2 -isystem /build/stage/build-work/usr/include -I/build/stage/linux/tools/testing/selftests/../../../tools/arch/arm64/include/generated/ -c aarch64/aarch32_id_regs.c -o /build/stage/build-work/kselftest/kvm/aarch64/aarch32_id_regs.o
> cc1: error: unknown value ‘x86-64-v2’ for ‘-march’
>
> This is because:
>
> > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> > index 48d32c5aa3eb..3f1b24ed7245 100644
> > --- a/tools/testing/selftests/kvm/Makefile
> > +++ b/tools/testing/selftests/kvm/Makefile
> > @@ -238,6 +238,7 @@ CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
> > -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
> > -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
> > -I$(<D) -Iinclude/$(ARCH_DIR) -I ../rseq -I.. $(EXTRA_CFLAGS) \
> > + -march=x86-64-v2 \
> > $(KHDR_INCLUDES)
> > ifeq ($(ARCH),s390)
> > CFLAGS += -march=z10
>
> unconditionally sets an architecture specific flag which is obviously
> not going to work on anything except x86. This should be set under an
> architecture check like the similar S/390 flag that can be seen in the
> context for the diff.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]