* [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10
@ 2023-01-27 17:45 Nina Schoetterl-Glausch
2023-01-27 18:12 ` Thomas Huth
2023-01-30 9:25 ` Janosch Frank
0 siblings, 2 replies; 4+ messages in thread
From: Nina Schoetterl-Glausch @ 2023-01-27 17:45 UTC (permalink / raw)
To: Paolo Bonzini, Shuah Khan, Janosch Frank, Claudio Imbrenda
Cc: Nina Schoetterl-Glausch, kvm, linux-kselftest, linux-kernel,
Thomas Huth
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(+)
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)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10
2023-01-27 17:45 [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10 Nina Schoetterl-Glausch
@ 2023-01-27 18:12 ` Thomas Huth
2023-01-27 18:37 ` Nina Schoetterl-Glausch
2023-01-30 9:25 ` Janosch Frank
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2023-01-27 18:12 UTC (permalink / raw)
To: Nina Schoetterl-Glausch, Paolo Bonzini, Shuah Khan, Janosch Frank,
Claudio Imbrenda
Cc: kvm, linux-kselftest, linux-kernel
On 27/01/2023 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>
> ---
>
> Should we also set -mtune?
I don't think it's really necessary
> 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.
FWIW, the vector instructions have been introduced with the z13 ... so
limiting to the zEC12 could be enough.
> 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
Starting with z10 sounds sane to me, we still can adjust later if necessary.
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10
2023-01-27 18:12 ` Thomas Huth
@ 2023-01-27 18:37 ` Nina Schoetterl-Glausch
0 siblings, 0 replies; 4+ messages in thread
From: Nina Schoetterl-Glausch @ 2023-01-27 18:37 UTC (permalink / raw)
To: Thomas Huth, Paolo Bonzini, Shuah Khan, Janosch Frank,
Claudio Imbrenda
Cc: kvm, linux-kselftest, linux-kernel
On Fri, 2023-01-27 at 19:12 +0100, Thomas Huth wrote:
> On 27/01/2023 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>
> > ---
> >
> > Should we also set -mtune?
>
> I don't think it's really necessary
>
> > 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.
>
> FWIW, the vector instructions have been introduced with the z13 ... so
> limiting to the zEC12 could be enough.
Yes, however, if we only want to fix the issue with regards to vector instructions,
one of the alternatives would be a better solution, IMO.
With regards to the second, I'm not sure what happens on old models if we
unconditionally enable the control bit, I'm guessing it'd be fine.
The question is how likely similar issues are and if we're fine with possibly running into them.
For what it's worth, finding the cause here was easy, tracing kvm-s390 events showed the faulting
instruction.
>
> > 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
>
> Starting with z10 sounds sane to me, we still can adjust later if necessary.
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10
2023-01-27 17:45 [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10 Nina Schoetterl-Glausch
2023-01-27 18:12 ` Thomas Huth
@ 2023-01-30 9:25 ` Janosch Frank
1 sibling, 0 replies; 4+ messages in thread
From: Janosch Frank @ 2023-01-30 9:25 UTC (permalink / raw)
To: Nina Schoetterl-Glausch, Paolo Bonzini, Shuah Khan,
Claudio Imbrenda
Cc: kvm, linux-kselftest, linux-kernel, Thomas Huth
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)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-30 10:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-27 17:45 [RFC PATCH v1] KVM: selftests: Compile s390 tests with -march=z10 Nina Schoetterl-Glausch
2023-01-27 18:12 ` Thomas Huth
2023-01-27 18:37 ` Nina Schoetterl-Glausch
2023-01-30 9:25 ` Janosch Frank
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox