Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: KVM <kvm@vger.kernel.org>, Janosch Frank <frankja@linux.ibm.com>,
	David Hildenbrand <david@kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Thomas Huth <thuth@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>
Subject: Re: [PATCH/RFC] KVM: s390: vsie: Avoid injecting machine check on signal
Date: Mon, 16 Mar 2026 12:56:18 +0100	[thread overview]
Message-ID: <20260316115618.17080B45-hca@linux.ibm.com> (raw)
In-Reply-To: <20260316103934.13368-1-borntraeger@linux.ibm.com>

On Mon, Mar 16, 2026 at 11:39:34AM +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.
> 
> Fixes: 2bd1337a1295e ("KVM: s390: Use generic VIRT_XFER_TO_GUEST_WORK functions")
> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
> ---
>  arch/s390/kvm/vsie.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

...

> -	if (rc == -EINTR) {
> +	if (!skipped && rc == -EINTR) {
>  		kvm_s390_reinject_machine_check(vcpu, &vsie_page->mcck_info);
>  		return 0;

As far as I can tell __SF_SIE_REASON is only used for passing -EINTR in case
of a machine check, otherwise it is unused (== zero)?

So the KVM_EXIT* codes don't work instead of -EINTR, since those are uapi, and
there is nothing that would match a machine check anyway. However I would
still propose to pass some unique positive number back via the stackframe
instead of some random negative error number which means nothing.

That is: change the machine check handler to pass e.g.

#define KVM_S390_SIE_EXIT_MCCK 1

		*((long *)(regs->gprs[15] + __SF_SIE_REASON)) = KVM_S390_SIE_EXIT_MCCK;

Which would make it much more obvious what happens, and which would also avoid
such strange bugs.

Just my 0.02.

  reply	other threads:[~2026-03-16 11:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 10:39 [PATCH/RFC] KVM: s390: vsie: Avoid injecting machine check on signal Christian Borntraeger
2026-03-16 11:56 ` Heiko Carstens [this message]
2026-03-16 12:00   ` Christian Borntraeger
2026-03-16 12:31   ` Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260316115618.17080B45-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox