public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Nico Boehr <nrb@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	Eric Farman <farman@linux.ibm.com>
Subject: [PATCH kvm-unit-tests v2 6/6] lib: s390x: smp: Remove smp_sigp_retry
Date: Fri, 11 Mar 2022 18:38:22 +0100	[thread overview]
Message-ID: <20220311173822.1234617-7-farman@linux.ibm.com> (raw)
In-Reply-To: <20220311173822.1234617-1-farman@linux.ibm.com>

The SIGP instruction presents a CC0 when an order is accepted,
though the work for the order may be performed asynchronously.
While any such work is outstanding, nearly any other SIGP order
sent to the same CPU will be returned with a CC2.

Currently, there are two library functions that perform a SIGP,
one which retries a SIGP that gets a CC2, and one which doesn't.
In practice, the users of this functionality want the CC2 to be
handled by the library itself, rather than determine whether it
needs to retry the request or not.

To avoid confusion, let's convert the smp_sigp() routine to
perform the sigp_retry() logic, and then convert any users of
smp_sigp_retry() to smp_sigp(). This of course means that the
external _retry() interface can be removed for simplicity.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 lib/s390x/smp.c | 14 ++++----------
 lib/s390x/smp.h |  1 -
 s390x/smp.c     |  4 ++--
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index 5be29d36..a0495cd9 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -40,12 +40,6 @@ int smp_query_num_cpus(void)
 }
 
 int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status)
-{
-	check_idx(idx);
-	return sigp(cpus[idx].addr, order, parm, status);
-}
-
-int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status)
 {
 	check_idx(idx);
 	return sigp_retry(cpus[idx].addr, order, parm, status);
@@ -78,7 +72,7 @@ bool smp_cpu_stopped(uint16_t idx)
 {
 	uint32_t status;
 
-	if (smp_sigp_retry(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED)
+	if (smp_sigp(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED)
 		return false;
 	return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED));
 }
@@ -99,7 +93,7 @@ static int smp_cpu_stop_nolock(uint16_t idx, bool store)
 	if (idx == 0)
 		return -1;
 
-	if (smp_sigp_retry(idx, order, 0, NULL))
+	if (smp_sigp(idx, order, 0, NULL))
 		return -1;
 
 	while (!smp_cpu_stopped(idx))
@@ -251,11 +245,11 @@ static int smp_cpu_setup_nolock(uint16_t idx, struct psw psw)
 	if (cpus[idx].active)
 		return -1;
 
-	smp_sigp_retry(idx, SIGP_INITIAL_CPU_RESET, 0, NULL);
+	smp_sigp(idx, SIGP_INITIAL_CPU_RESET, 0, NULL);
 
 	lc = alloc_pages_flags(1, AREA_DMA31);
 	cpus[idx].lowcore = lc;
-	smp_sigp_retry(idx, SIGP_SET_PREFIX, (unsigned long )lc, NULL);
+	smp_sigp(idx, SIGP_SET_PREFIX, (unsigned long )lc, NULL);
 
 	/* Copy all exception psws. */
 	memcpy(lc, cpus[0].lowcore, 512);
diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h
index 24a0e2e0..df184cb8 100644
--- a/lib/s390x/smp.h
+++ b/lib/s390x/smp.h
@@ -52,6 +52,5 @@ int smp_cpu_setup(uint16_t idx, struct psw psw);
 void smp_teardown(void);
 void smp_setup(void);
 int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
-int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
 
 #endif
diff --git a/s390x/smp.c b/s390x/smp.c
index 913da155..81e02195 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -266,7 +266,7 @@ static void test_reset_initial(void)
 	smp_cpu_start(1, psw);
 	wait_for_flag();
 
-	smp_sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL);
+	smp_sigp(1, SIGP_INITIAL_CPU_RESET, 0, NULL);
 	smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL);
 
 	report_prefix_push("clear");
@@ -316,7 +316,7 @@ static void test_reset(void)
 	smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL);
 	smp_cpu_start(1, psw);
 
-	smp_sigp_retry(1, SIGP_CPU_RESET, 0, NULL);
+	smp_sigp(1, SIGP_CPU_RESET, 0, NULL);
 	report(smp_cpu_stopped(1), "cpu stopped");
 
 	set_flag(0);
-- 
2.32.0


  parent reply	other threads:[~2022-03-11 17:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 17:38 [PATCH kvm-unit-tests v2 0/6] s390x SIGP fixes Eric Farman
2022-03-11 17:38 ` [PATCH kvm-unit-tests v2 1/6] lib: s390x: smp: Retry SIGP SENSE on CC2 Eric Farman
2022-03-24  8:08   ` Thomas Huth
2022-03-11 17:38 ` [PATCH kvm-unit-tests v2 2/6] s390x: smp: Test SIGP RESTART against stopped CPU Eric Farman
2022-03-24  8:15   ` Thomas Huth
2022-03-11 17:38 ` [PATCH kvm-unit-tests v2 3/6] s390x: smp: Fix checks for SIGP STOP STORE STATUS Eric Farman
2022-03-15  6:39   ` Nico Boehr
2022-03-15 17:39   ` Claudio Imbrenda
2022-03-11 17:38 ` [PATCH kvm-unit-tests v2 4/6] s390x: smp: Create and use a non-waiting CPU stop Eric Farman
2022-03-15  6:45   ` Nico Boehr
2022-03-11 17:38 ` [PATCH kvm-unit-tests v2 5/6] s390x: smp: Create and use a non-waiting CPU restart Eric Farman
2022-03-15  6:51   ` Nico Boehr
2022-03-21  7:43   ` Janosch Frank
2022-03-11 17:38 ` Eric Farman [this message]
2022-03-15  7:20   ` [PATCH kvm-unit-tests v2 6/6] lib: s390x: smp: Remove smp_sigp_retry Nico Boehr

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=20220311173822.1234617-7-farman@linux.ibm.com \
    --to=farman@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --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