From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:21136 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727780AbgD2Ofi (ORCPT ); Wed, 29 Apr 2020 10:35:38 -0400 From: Janosch Frank Subject: [PATCH v3 09/10] s390x: smp: Add restart when running test Date: Wed, 29 Apr 2020 10:35:17 -0400 Message-Id: <20200429143518.1360468-10-frankja@linux.ibm.com> In-Reply-To: <20200429143518.1360468-1-frankja@linux.ibm.com> References: <20200429143518.1360468-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-s390-owner@vger.kernel.org List-ID: To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com Let's make sure we can restart a cpu that is already running. Restarting it if it is stopped is implicitely tested by the the other restart calls in the smp test. Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand --- s390x/smp.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/s390x/smp.c b/s390x/smp.c index bad2131..e6db8f0 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -52,6 +52,34 @@ static void test_start(void) report(1, "start"); } +/* + * Does only test restart when the target is running. + * The other tests do restarts when stopped multiple times already. + */ +static void test_restart(void) +{ + struct cpu *cpu = smp_cpu_from_addr(1); + struct lowcore *lc = cpu->lowcore; + + lc->restart_new_psw.mask = extract_psw_mask(); + lc->restart_new_psw.addr = (unsigned long)test_func; + + /* Make sure cpu is running */ + smp_cpu_stop(0); + set_flag(0); + smp_cpu_restart(1); + wait_for_flag(); + + /* + * Wait until cpu 1 has set the flag because it executed the + * restart function. + */ + set_flag(0); + smp_cpu_restart(1); + wait_for_flag(); + report(1, "restart while running"); +} + static void test_stop(void) { smp_cpu_stop(1); @@ -300,6 +328,7 @@ int main(void) smp_cpu_stop(1); test_start(); + test_restart(); test_stop(); test_stop_store_status(); test_store_status(); -- 2.25.1