[PATCH kvm-unit-tests v1 6/6] lib: s390x: smp: Convert remaining smp_sigp to _retry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A SIGP SENSE is used to determine if a CPU is stopped or operating,
and thus has a vested interest in ensuring it received a CC0 or CC1,
instead of a CC2 (BUSY). But, any order could receive a CC2 response,
and is probably ill-equipped to respond to it.

In practice, the order is likely to only encounter this when racing
with a SIGP STOP (AND STORE STATUS) or SIGP RESTART order, which are
unlikely. But, since it's not impossible, let's convert the library
calls that issue a SIGP to loop on CC2 so the callers do not need
to react to that possible outcome.

Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxx>
---
 lib/s390x/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index 85b046a5..2e476264 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -85,7 +85,7 @@ bool smp_cpu_stopped(uint16_t idx)
 
 bool smp_sense_running_status(uint16_t idx)
 {
-	if (smp_sigp(idx, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED)
+	if (smp_sigp_retry(idx, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED)
 		return true;
 	/* Status stored condition code is equivalent to cpu not running. */
 	return false;
@@ -169,7 +169,7 @@ static int smp_cpu_restart_nolock(uint16_t idx, struct psw *psw)
 	 * running after the restart.
 	 */
 	smp_cpu_stop_nolock(idx, false);
-	rc = smp_sigp(idx, SIGP_RESTART, 0, NULL);
+	rc = smp_sigp_retry(idx, SIGP_RESTART, 0, NULL);
 	if (rc)
 		return rc;
 	/*
-- 
2.32.0




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux