diff mbox series

[RFC,v1] KVM: selftests: Compile s390 tests with -march=z10

Message ID 20230127174552.3370169-1-nsg@linux.ibm.com
State Accepted
Commit d7b9dc14031b7f8865aeedc90d8bc68a4bb16023
Headers show
Series [RFC,v1] KVM: selftests: Compile s390 tests with -march=z10 | expand

Commit Message

Nina Schoetterl-Glausch Jan. 27, 2023, 5:45 p.m. UTC
The guest used in s390 kvm selftests is not be set up to handle all
instructions the compiler might emit, i.e. vector instructions, leading
to crashes.
Limit what the compiler emits to the oldest machine model currently
supported by Linux.

Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
---


Should we also set -mtune?
Since it are vector instructions that caused the problem here, there
are some alternatives:
 * use -mno-vx
 * set the required guest control bit to enable vector instructions on
   models supporting them

-march=z10 might prevent similar issues with other instructions, but I
don't know if there actually exist other relevant instructions, so it
could be needlessly restricting.


 tools/testing/selftests/kvm/Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Janosch Frank Jan. 30, 2023, 9:25 a.m. UTC | #1
On 1/27/23 18:45, Nina Schoetterl-Glausch wrote:
> The guest used in s390 kvm selftests is not be set up to handle all
> instructions the compiler might emit, i.e. vector instructions, leading
> to crashes.
> Limit what the compiler emits to the oldest machine model currently
> supported by Linux.
> 
> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> ---

Technically it's a fix but as the tests have been running fine for years 
I'm inclined to put it into a full release rather than a fix rc.

Thanks for taking care of the fix:
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> Should we also set -mtune?
> Since it are vector instructions that caused the problem here, there
> are some alternatives:
>   * use -mno-vx
>   * set the required guest control bit to enable vector instructions on
>     models supporting them
> 
> -march=z10 might prevent similar issues with other instructions, but I
> don't know if there actually exist other relevant instructions, so it
> could be needlessly restricting.
> 
> 
>   tools/testing/selftests/kvm/Makefile | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index 1750f91dd936..df0989949eb5 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -200,6 +200,9 @@ CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
>   	-I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
>   	-I$(<D) -Iinclude/$(ARCH_DIR) -I ../rseq -I.. $(EXTRA_CFLAGS) \
>   	$(KHDR_INCLUDES)
> +ifeq ($(ARCH),s390)
> +	CFLAGS += -march=z10
> +endif
>   
>   no-pie-option := $(call try-run, echo 'int main(void) { return 0; }' | \
>           $(CC) -Werror $(CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 1750f91dd936..df0989949eb5 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -200,6 +200,9 @@  CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
 	-I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
 	-I$(<D) -Iinclude/$(ARCH_DIR) -I ../rseq -I.. $(EXTRA_CFLAGS) \
 	$(KHDR_INCLUDES)
+ifeq ($(ARCH),s390)
+	CFLAGS += -march=z10
+endif
 
 no-pie-option := $(call try-run, echo 'int main(void) { return 0; }' | \
         $(CC) -Werror $(CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)