diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2020-04-02 11:44:41 -0400 |
---|---|---|
committer | David Hildenbrand <david@redhat.com> | 2020-04-24 11:53:00 +0200 |
commit | 9753bf43fcd0d581356d62ae9289cdda8d61846a (patch) | |
tree | 260a4e745e8fdb78df9eb0677cdd3a05e34fe94c | |
parent | 6abbd4f0ed2ce1cdf092c11e108896e4a1517047 (diff) | |
download | kvm-unit-tests-9753bf43fcd0d581356d62ae9289cdda8d61846a.tar.gz |
s390x/smp: add minimal test for sigp sense running status
Two minimal tests:
- our own CPU should be running when we check ourselves
- a CPU should at least have some times with a not running
indication. To speed things up we stop CPU1
Also rename smp_cpu_running to smp_sense_running_status.
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20200402154441.13063-1-borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
-rw-r--r-- | lib/s390x/smp.c | 2 | ||||
-rw-r--r-- | lib/s390x/smp.h | 2 | ||||
-rw-r--r-- | s390x/smp.c | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 203792a..df8dcd9 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -58,7 +58,7 @@ bool smp_cpu_stopped(uint16_t addr) return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED)); } -bool smp_cpu_running(uint16_t addr) +bool smp_sense_running_status(uint16_t addr) { if (sigp(addr, SIGP_SENSE_RUNNING, 0, NULL) != SIGP_CC_STATUS_STORED) return true; diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index ce63a89..d66e39a 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -40,7 +40,7 @@ struct cpu_status { int smp_query_num_cpus(void); struct cpu *smp_cpu_from_addr(uint16_t addr); bool smp_cpu_stopped(uint16_t addr); -bool smp_cpu_running(uint16_t addr); +bool smp_sense_running_status(uint16_t addr); int smp_cpu_restart(uint16_t addr); int smp_cpu_start(uint16_t addr, struct psw psw); int smp_cpu_stop(uint16_t addr); diff --git a/s390x/smp.c b/s390x/smp.c index fa40753..1641979 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -182,6 +182,19 @@ static void test_emcall(void) report_prefix_pop(); } +static void test_sense_running(void) +{ + report_prefix_push("sense_running"); + /* we (CPU0) are running */ + report(smp_sense_running_status(0), "CPU0 sense claims running"); + /* stop the target CPU (CPU1) to speed up the not running case */ + smp_cpu_stop(1); + /* Make sure to have at least one time with a not running indication */ + while(smp_sense_running_status(1)); + report(true, "CPU1 sense claims not running"); + report_prefix_pop(); +} + static void test_reset_initial(void) { struct cpu_status *status = alloc_pages(0); @@ -251,6 +264,7 @@ int main(void) test_store_status(); test_ecall(); test_emcall(); + test_sense_running(); test_reset(); test_reset_initial(); smp_cpu_destroy(1); |