All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm390 mailing list <kvm390-list@tuxmaker.boeblingen.de.ibm.com>
Cc: thuth@redhat.com, david@redhat.com, borntraeger@de.ibm.com,
	imbrenda@linux.ibm.com, cohuck@redhat.com,
	linux-s390@vger.kernel.org
Subject: [kvm-unit-tests PATCH] s390x: Fix uv_call() exception behavior
Date: Mon, 18 Jan 2021 09:03:44 -0500	[thread overview]
Message-ID: <20210118140344.3074-1-frankja@linux.ibm.com> (raw)

On a program exception we usually skip the instruction that caused the
exception and continue. That won't work for UV calls since a "brc 3,0b"
will retry the instruction if the CC is > 1.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---

I know this isn't very pretty.
I'm open for suggestions.

---
 lib/s390x/asm/uv.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
index 4c2fc48..252f1a3 100644
--- a/lib/s390x/asm/uv.h
+++ b/lib/s390x/asm/uv.h
@@ -53,21 +53,23 @@ struct uv_cb_share {
 static inline int uv_call(unsigned long r1, unsigned long r2)
 {
 	int cc;
+	struct lowcore *lc = 0x0;
 
 	/*
-	 * The brc instruction will take care of the cc 2/3 case where
-	 * we need to continue the execution because we were
-	 * interrupted. The inline assembly will only return on
-	 * success/error i.e. cc 0/1.
-	*/
+	 * CC 2 and 3 tell us to re-execute because the instruction
+	 * hasn't yet finished.
+	 */
+	lc->pgm_int_code = 0;
+retry:
 	asm volatile(
 		"0:	.insn rrf,0xB9A40000,%[r1],%[r2],0,0\n"
-		"		brc	3,0b\n"
 		"		ipm	%[cc]\n"
 		"		srl	%[cc],28\n"
 		: [cc] "=d" (cc)
 		: [r1] "a" (r1), [r2] "a" (r2)
 		: "memory", "cc");
+	if (!lc->pgm_int_code && cc > 1)
+		goto retry;
 	return cc;
 }
 
-- 
2.25.1

             reply	other threads:[~2021-01-18 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 14:03 Janosch Frank [this message]
2021-01-18 14:40 ` [kvm-unit-tests PATCH] s390x: Fix uv_call() exception behavior Thomas Huth
2021-01-18 14:46   ` Janosch Frank
2021-01-18 15:09 ` [kvm-unit-tests PATCH v2] " Janosch Frank
2021-01-18 15:15   ` Thomas Huth
2021-01-19 16:28   ` Cornelia Huck

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=20210118140344.3074-1-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm390-list@tuxmaker.boeblingen.de.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.