Re: [PATCH v3] KVM: s390: vsie: Avoid injecting machine check on signal

Heiko Carstens
2026-03-16T13:14:11Z

On Mon, Mar 16, 2026 at 02:09:47PM +0100, Christian Borntraeger wrote:
> The recent XFER_TO_GUEST_WORK change resulted in a situation, where the
> vsie code would interpret a signal during work as a machine check during
> SIE as both use the EINTR return code.
> The exit_reason of the sie64a function has nothing to do with the
> kvm_run exit_reason. Rename it and define a specific code for machine
> checks instead of abusing -EINTR.
> rename exit_reason into sie_return to avoid the naming conflict
> and change the code flow in vsie.c to have a separate variable for rc
> and sie_return.
>
> Fixes: 2bd1337a1295e ("KVM: s390: Use generic VIRT_XFER_TO_GUEST_WORK functions")
> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
> ---
> v1->v2:
> instead of a band-aid, make the machine check more direct
> v2->v3:
> avoid overloading the rc variable in vsie.c
>
> arch/s390/include/asm/kvm_host.h | 3 +++
> arch/s390/include/asm/stacktrace.h | 2 +-
> arch/s390/kernel/asm-offsets.c | 2 +-
> arch/s390/kernel/entry.S | 4 ++--
> arch/s390/kernel/nmi.c | 4 ++--
> arch/s390/kvm/kvm-s390.c | 15 ++++++++-------
> arch/s390/kvm/vsie.c | 7 +++++--
> 7 files changed, 22 insertions(+), 15 deletions(-)

...

> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index c0d36afd4023..42c53134e0b8 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -1123,6 +1123,7 @@ static int do_vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, struc
> struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
> struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
> int guest_bp_isolation;
> + int sie_return = SIE64_RETURN_NORMAL;
> int rc = 0;

Move that one line up to keep the reverse x-mas style?

> + WARN_ON(sie_return != SIE64_RETURN_NORMAL);

And as written in the previous version: both should be WARN_ON_ONCE() I guess.

Anyway:

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>