[kvm-unit-tests PATCH v2 2/9] s390x: smp: stop already stopped CPU

Nico Boehr
2022-03-23T17:03:37Z

As per the PoP, the SIGP STOP order is only effective when the CPU is in
the operating state. Hence, we should have a test which tries to stop an
already stopped CPU.

Even though the SIGP order might be processed asynchronously, we assert
the CPU stays stopped.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
---
s390x/smp.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/s390x/smp.c b/s390x/smp.c
index 911a26c51b10..e5a16eb5a46a 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -129,6 +129,11 @@ static void test_stop(void)
*/
while (!smp_cpu_stopped(1)) {}
report_pass("stop");
+
+ report_prefix_push("stop stopped CPU");
+ report(!smp_cpu_stop(1), "STOP succeeds");
+ report(smp_cpu_stopped(1), "CPU is stopped");
+ report_prefix_pop();
}

static void test_stop_store_status(void)
--
2.31.1