From patchwork Thu Mar 3 21:04:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12768127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A088C43219 for ; Thu, 3 Mar 2022 21:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236423AbiCCVFW (ORCPT ); Thu, 3 Mar 2022 16:05:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235403AbiCCVFU (ORCPT ); Thu, 3 Mar 2022 16:05:20 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F628954AB; Thu, 3 Mar 2022 13:04:33 -0800 (PST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 223JIrKT017700; Thu, 3 Mar 2022 21:04:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=GTmNGpl7gE00KNwgGmtP2Xqpg3CFrt+iiO3gyZizRuc=; b=F1MtN+zE9q3h9BdUxetX0+xflTxuXeKv/wKBrx22HrpUo/mL4wD8Ae81C12WrHJmNn5k 695G/be+ZXqgh6E62l1xY8lE16bD/zQxDUhsQ9PqahmUnA3aqAzCp+ECQSZBksxKRt6l YHXqFcASm2lsrdxSy8ZDJf/HXYGPRNPfxb5rr81a/rhQGGqIwim0Xe+r0TABjTQUXxvC 0gEpkeIYhiFUXBsOiv0tploHjgfQF2JltWUMTFv1/dh38I1vJ5LwRQkOx0LcesyjoKxy GKcwMe7ZsVsmXW/V0Swvke33eEcMvi9/gOvByRoMDjiOPMWqggYFsiVGINJt0wjDzXTT qA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek3qphtmb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:33 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 223Ktl5P005556; Thu, 3 Mar 2022 21:04:32 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek3qphtkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 223L2veI021324; Thu, 3 Mar 2022 21:04:30 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3ek4k402k0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:29 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 223L4QSe41746924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 21:04:26 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF8C411C04A; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDCAE11C054; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 7DC17E03B1; Thu, 3 Mar 2022 22:04:26 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v1 1/6] lib: s390x: smp: Retry SIGP SENSE on CC2 Date: Thu, 3 Mar 2022 22:04:20 +0100 Message-Id: <20220303210425.1693486-2-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220303210425.1693486-1-farman@linux.ibm.com> References: <20220303210425.1693486-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: JtdI-HSoOrUAxZBdj1ET2I7iRPs78YBJ X-Proofpoint-ORIG-GUID: R8JHdvL1EzsgU5Hw1ylUQnvhOptaJ8Z6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_09,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1015 suspectscore=0 spamscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2203030095 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The routine smp_cpu_stopped() issues a SIGP SENSE, and returns true if it received a CC1 (STATUS STORED) with the STOPPED or CHECK STOP bits enabled. Otherwise, it returns false. This is misleading, because a CC2 (BUSY) merely indicates that the order code could not be processed, not that the CPU is operating. It could be operating but in the process of being stopped. Convert the invocation of the SIGP SENSE to retry when a CC2 is received, so we get a more definitive answer. Signed-off-by: Eric Farman Reviewed-by: Janosch Frank Reviewed-by: Nico Boehr Reviewed-by: Claudio Imbrenda --- lib/s390x/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 46e1b022..368d6add 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -78,7 +78,7 @@ bool smp_cpu_stopped(uint16_t idx) { uint32_t status; - if (smp_sigp(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED) + if (smp_sigp_retry(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED) return false; return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED)); } From patchwork Thu Mar 3 21:04:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12768130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77DF6C433F5 for ; Thu, 3 Mar 2022 21:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236430AbiCCVFX (ORCPT ); Thu, 3 Mar 2022 16:05:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236409AbiCCVFU (ORCPT ); Thu, 3 Mar 2022 16:05:20 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F2598586; Thu, 3 Mar 2022 13:04:33 -0800 (PST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 223KVYON006232; Thu, 3 Mar 2022 21:04:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ovVSVHDwa/Fx6R4JucXdR1ubag0ugwqSwa8Bpuphbsw=; b=i3cIPnDzzDJg4RupcCsvyt9vucPdf6iau+eDlXGiFQikRBs5Ja3+/a21BmTnN8InM0wH zYKaqqM9rx8TZhkSetlsFMPLZ8nj+dbLrcjIFQ5tPS4amfVhRIGZ6Ec0Th5Hvqc71U7M st8nJ4k7l+1ff4zINCMSQ4Fz0IQpELJt2Tzb78+rLkMO2V8MHlOgKzpo6CfNTKHgGuOq AR6Pialsacx7uAzWrvAABEZrAAkISBE2UjlFOEKYT+rap54h1SLDjMc1ZQn43/IpX6LG EWnYYbkutaD3ue+gG2fvtg+kEZQArE5IwnefimqbXkk1NZbrILN2hbaeLgGhzENPUgxN HA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4srrjgj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:33 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 223L4WR2018162; Thu, 3 Mar 2022 21:04:32 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4srrjg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 223L3EY5018438; Thu, 3 Mar 2022 21:04:30 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma01fra.de.ibm.com with ESMTP id 3ek4k8023s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:29 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 223L4QRK45875606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 21:04:26 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4BCB4C04A; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C20304C040; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 802FDE03D1; Thu, 3 Mar 2022 22:04:26 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v1 2/6] s390x: smp: Test SIGP RESTART against stopped CPU Date: Thu, 3 Mar 2022 22:04:21 +0100 Message-Id: <20220303210425.1693486-3-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220303210425.1693486-1-farman@linux.ibm.com> References: <20220303210425.1693486-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uqBZg2-Nlzxzk9i33nlE2-MzyhxYuF7D X-Proofpoint-GUID: hUT0V94r16enns1K-boOYG95-jR0BNG6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_09,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203030095 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org test_restart() makes two smp_cpu_restart() calls against CPU 1. It claims to perform both of them against running (operating) CPUs, but the first invocation tries to achieve this by calling smp_cpu_stop() to CPU 0. This will be rejected by the library. Let's fix this by making the first restart operate on a stopped CPU, to ensure it gets test coverage instead of relying on other callers. Fixes: 166da884d ("s390x: smp: Add restart when running test") Signed-off-by: Eric Farman Reviewed-by: Janosch Frank Reviewed-by: Nico Boehr Reviewed-by: Claudio Imbrenda --- s390x/smp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/s390x/smp.c b/s390x/smp.c index 068ac74d..2f4af820 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -50,10 +50,6 @@ static void test_start(void) report_pass("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_idx(1); @@ -62,8 +58,8 @@ static void test_restart(void) 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); + /* Make sure cpu is stopped */ + smp_cpu_stop(1); set_flag(0); smp_cpu_restart(1); wait_for_flag(); From patchwork Thu Mar 3 21:04:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12768132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DFBAC4332F for ; Thu, 3 Mar 2022 21:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236409AbiCCVFY (ORCPT ); Thu, 3 Mar 2022 16:05:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236410AbiCCVFU (ORCPT ); Thu, 3 Mar 2022 16:05:20 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D40533E0B; Thu, 3 Mar 2022 13:04:33 -0800 (PST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 223KVbQs002043; Thu, 3 Mar 2022 21:04:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=Lc48QTlYLHqbrHJF44l5RCli08mGGu069fZ+31k/Ibo=; b=NUeYY/HXhUFRGhDbv6uBABzQPth15PmKlCOoKnovbyMglROPxeO3DcAePCTw7G1LYHoM mxykrRZqMOP034cTuPg82NZkgk3YSesTdRLH93NPngibaK3khWUgY12t2eGwW1TEEn2Y 2u/ZSMXyrwbc25XvjyJ02gTqIt7jEKO0QHAv+A11yX0L4AanlM+vB46c2iWp2iH0A/en Wb2BgVYgr3sjHvhNoIb/EJc9xuDRbweGj1hMAVz6JF/LXKtIdkx1otV4vaABhj5K2UE3 B24g0DK8Bp5TwFqI08jDSAZAtegmcQfMAZAqP9RlRIkjlzs7wtltL8XnQTMSeFOqAaf1 SA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4ss8h5n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:33 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 223KcSUf003677; Thu, 3 Mar 2022 21:04:32 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4ss8h53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 223L2wJA011800; Thu, 3 Mar 2022 21:04:30 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma02fra.de.ibm.com with ESMTP id 3ek4k4g235-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:30 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 223L4Qsh56426780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 21:04:26 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEFCA5204F; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id BCBAC52051; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 82A38E03FA; Thu, 3 Mar 2022 22:04:26 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v1 3/6] s390x: smp: Fix checks for SIGP STOP STORE STATUS Date: Thu, 3 Mar 2022 22:04:22 +0100 Message-Id: <20220303210425.1693486-4-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220303210425.1693486-1-farman@linux.ibm.com> References: <20220303210425.1693486-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: CMWIsP4mvnqSK9tU4tSpEc-kkXLKS139 X-Proofpoint-GUID: RGeEnErDVsyHAwP8dGIb-_PLvM9Ahepv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_09,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=785 phishscore=0 spamscore=0 priorityscore=1501 adultscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203030095 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org In the routine test_stop_store_status(), the "running" part of the test checks a few of the fields in lowcore (to verify the "STORE STATUS" part of the SIGP order), and then ensures that the CPU has stopped. But this is backwards, and leads to false errors. According to the Principles of Operation: The addressed CPU performs the stop function, fol- lowed by the store-status operation (see “Store Sta- tus” on page 4-82). By checking the results how they are today, the contents of the lowcore fields are unreliable until the CPU is stopped. Thus, check that the CPU is stopped first, before ensuring that the STORE STATUS was performed correctly. While here, add the same check to the second part of the test, even though the CPU is explicitly stopped prior to the SIGP. Fixes: fc67b07a4 ("s390x: smp: Test stop and store status on a running and stopped cpu") Signed-off-by: Eric Farman --- s390x/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/s390x/smp.c b/s390x/smp.c index 2f4af820..50811bd0 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -98,9 +98,9 @@ static void test_stop_store_status(void) lc->grs_sa[15] = 0; smp_cpu_stop_store_status(1); mb(); + report(smp_cpu_stopped(1), "cpu stopped"); report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); report(lc->grs_sa[15], "stack"); - report(smp_cpu_stopped(1), "cpu stopped"); report_prefix_pop(); report_prefix_push("stopped"); @@ -108,6 +108,7 @@ static void test_stop_store_status(void) lc->grs_sa[15] = 0; smp_cpu_stop_store_status(1); mb(); + report(smp_cpu_stopped(1), "cpu stopped"); report(lc->prefix_sa == (uint32_t)(uintptr_t)cpu->lowcore, "prefix"); report(lc->grs_sa[15], "stack"); report_prefix_pop(); From patchwork Thu Mar 3 21:04:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12768131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A450C433FE for ; Thu, 3 Mar 2022 21:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236410AbiCCVF0 (ORCPT ); Thu, 3 Mar 2022 16:05:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236421AbiCCVFV (ORCPT ); Thu, 3 Mar 2022 16:05:21 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E9033E0B; Thu, 3 Mar 2022 13:04:35 -0800 (PST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 223KVY72006253; Thu, 3 Mar 2022 21:04:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=qphB4V6ghH5ihf8YcpjejWUEfx+dmaU3LhwyYmKOpwU=; b=ekoPhZb6fY8/+blXp095rI4UR+ss1wgyLPAZwSbPHJeNSoN/NJN/VdYegnkZXjCwlmj6 rOmOKsp0VtgyBLxCOaPAviMTQ7L/lJyjoAkvM57CWZ/yTmWXikc/ePmVzdSryJp+gQJW t4dQ82lAKkJOc55vsPq5u4YRk5ep+DWUB5MASV0iImOrJjbnFWPl6bvkT4yi4vzdjNsM McbPHoWCw3gozfUywB/uqjdJNDGJwg9bRt7MSzEqqTZAy03S/CLw8Nvu+Y67mzS8HvbP ca6BvXiy77XU6RjFu5TUIzEWbmx3wuhMhVvMdblgCrB8pWbVQmRrgIL8Eqvskf13ZFbo Mg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4srrjha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:35 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 223KVjG5011045; Thu, 3 Mar 2022 21:04:35 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4srrjgr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:34 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 223L3CNS008174; Thu, 3 Mar 2022 21:04:32 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3ek4k40234-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 223L4Qam33030650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 21:04:27 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D443CAE056; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C347FAE051; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 3 Mar 2022 21:04:26 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 85157E0411; Thu, 3 Mar 2022 22:04:26 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v1 4/6] s390x: smp: Create and use a non-waiting CPU stop Date: Thu, 3 Mar 2022 22:04:23 +0100 Message-Id: <20220303210425.1693486-5-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220303210425.1693486-1-farman@linux.ibm.com> References: <20220303210425.1693486-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: N9z-U5wgNJrSCyrlx_SrvbYNnrPJS68I X-Proofpoint-GUID: zr4SejfKZ2ExF0lxPB0Pv6wkBP7IqotB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_09,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203030095 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When stopping a CPU, kvm-unit-tests serializes/waits for everything to finish, in order to get a consistent result whenever those functions are used. But to test the SIGP STOP itself, these additional measures could mask other problems. For example, did the STOP work, or is the CPU still operating? Let's create a non-waiting SIGP STOP and use it here, to ensure that the CPU is correctly stopped. A smp_cpu_stopped() call will still be used to see that the SIGP STOP has been processed, and the state of the CPU can be used to determine whether the test passes/fails. Signed-off-by: Eric Farman Reviewed-by: Claudio Imbrenda --- lib/s390x/smp.c | 25 +++++++++++++++++++++++++ lib/s390x/smp.h | 1 + s390x/smp.c | 10 ++-------- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 368d6add..84e536e8 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -119,6 +119,31 @@ int smp_cpu_stop(uint16_t idx) return rc; } +/* + * Functionally equivalent to smp_cpu_stop(), but without the + * elements that wait/serialize matters itself. + * Used to see if KVM itself is serialized correctly. + */ +int smp_cpu_stop_nowait(uint16_t idx) +{ + /* refuse to work on the boot CPU */ + if (idx == 0) + return -1; + + spin_lock(&lock); + + /* Don't suppress a CC2 with sigp_retry() */ + if (smp_sigp(idx, SIGP_STOP, 0, NULL)) { + spin_unlock(&lock); + return -1; + } + + cpus[idx].active = false; + spin_unlock(&lock); + + return 0; +} + int smp_cpu_stop_store_status(uint16_t idx) { int rc; diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index 1e69a7de..bae03dfd 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -44,6 +44,7 @@ bool smp_sense_running_status(uint16_t idx); int smp_cpu_restart(uint16_t idx); int smp_cpu_start(uint16_t idx, struct psw psw); int smp_cpu_stop(uint16_t idx); +int smp_cpu_stop_nowait(uint16_t idx); int smp_cpu_stop_store_status(uint16_t idx); int smp_cpu_destroy(uint16_t idx); int smp_cpu_setup(uint16_t idx, struct psw psw); diff --git a/s390x/smp.c b/s390x/smp.c index 50811bd0..11c2c673 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -76,14 +76,8 @@ static void test_restart(void) static void test_stop(void) { - smp_cpu_stop(1); - /* - * The smp library waits for the CPU to shut down, but let's - * also do it here, so we don't rely on the library - * implementation - */ - while (!smp_cpu_stopped(1)) {} - report_pass("stop"); + smp_cpu_stop_nowait(1); + report(smp_cpu_stopped(1), "stop"); } static void test_stop_store_status(void) From patchwork Thu Mar 3 21:04:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12768133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6BF3C433F5 for ; Thu, 3 Mar 2022 21:04:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236439AbiCCVF1 (ORCPT ); Thu, 3 Mar 2022 16:05:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236424AbiCCVFX (ORCPT ); Thu, 3 Mar 2022 16:05:23 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED4E21E3C9; Thu, 3 Mar 2022 13:04:36 -0800 (PST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 223KVeZI007486; Thu, 3 Mar 2022 21:04:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=8Qnp+7u/RoRqnZq6DkTcz52CR0pJ0rkXttTIoufRqBw=; b=QHtLbtC+J27oLDc0Uf6VsFa++81nuHa9T+QneNeP5AN7kBjiJ8Lbsh4+kjapK+wBxlz5 cGceklWD84rzN/V43dyqTRnHQUJJLYxIGvyeJijva2oI2qF6t2Is7YNp0UTFv8OLEVfh GvWoSFa16TDfWmQ7J3jyQ9yUDlKfvaq2HyQP6Hus4DFyKEC2EhOXPeQfMrx5ppSjJLZk AUCVX9O2jf/Lo5gU3/jZQRgaWerFmBfkPd/D7OOaLY0csy4XJZInHgvZkV3eadsHCfAW weTg6+DxKRWgIDg++08yLxHQbJl9hF4rJwEmqMM9JJplciXzHxCaEHpRoYsjr7/ukboA Cg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4ssrhvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:36 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 223Kh30X023192; Thu, 3 Mar 2022 21:04:35 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek4ssrhv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:35 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 223L3OE2011629; Thu, 3 Mar 2022 21:04:33 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 3ek4ka8248-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 223L4RZF42598812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 21:04:27 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 258AB11C064; Thu, 3 Mar 2022 21:04:27 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1418311C054; Thu, 3 Mar 2022 21:04:27 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 3 Mar 2022 21:04:27 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 87785E041D; Thu, 3 Mar 2022 22:04:26 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v1 5/6] s390x: smp: Create and use a non-waiting CPU restart Date: Thu, 3 Mar 2022 22:04:24 +0100 Message-Id: <20220303210425.1693486-6-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220303210425.1693486-1-farman@linux.ibm.com> References: <20220303210425.1693486-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: giwdTDTW5Pz5lGtP_RhZU28Vb-NATvni X-Proofpoint-GUID: LPowO8qmZTxO18F2a8lB8DoJbZRvIoG_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_09,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 phishscore=0 spamscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203030095 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The kvm-unit-tests infrastructure for a CPU restart waits for the SIGP RESTART to complete. In order to test the restart itself, create a variation that does not wait, and test the state of the CPU directly. While here, add some better report prefixes/messages, to clarify which condition is being examined (similar to test_stop_store_status()). Signed-off-by: Eric Farman --- lib/s390x/smp.c | 22 ++++++++++++++++++++++ lib/s390x/smp.h | 1 + s390x/smp.c | 18 +++++++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 84e536e8..85b046a5 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -192,6 +192,28 @@ int smp_cpu_restart(uint16_t idx) return rc; } +/* + * Functionally equivalent to smp_cpu_restart(), but without the + * elements that wait/serialize matters here in the test. + * Used to see if KVM itself is serialized correctly. + */ +int smp_cpu_restart_nowait(uint16_t idx) +{ + spin_lock(&lock); + + /* Don't suppress a CC2 with sigp_retry() */ + if (smp_sigp(idx, SIGP_RESTART, 0, NULL)) { + spin_unlock(&lock); + return -1; + } + + cpus[idx].active = true; + + spin_unlock(&lock); + + return 0; +} + int smp_cpu_start(uint16_t idx, struct psw psw) { int rc; diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h index bae03dfd..24a0e2e0 100644 --- a/lib/s390x/smp.h +++ b/lib/s390x/smp.h @@ -42,6 +42,7 @@ uint16_t smp_cpu_addr(uint16_t idx); bool smp_cpu_stopped(uint16_t idx); bool smp_sense_running_status(uint16_t idx); int smp_cpu_restart(uint16_t idx); +int smp_cpu_restart_nowait(uint16_t idx); int smp_cpu_start(uint16_t idx, struct psw psw); int smp_cpu_stop(uint16_t idx); int smp_cpu_stop_nowait(uint16_t idx); diff --git a/s390x/smp.c b/s390x/smp.c index 11c2c673..03160b80 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -55,23 +55,35 @@ static void test_restart(void) struct cpu *cpu = smp_cpu_from_idx(1); struct lowcore *lc = cpu->lowcore; + report_prefix_push("restart"); + report_prefix_push("stopped"); + lc->restart_new_psw.mask = extract_psw_mask(); lc->restart_new_psw.addr = (unsigned long)test_func; /* Make sure cpu is stopped */ smp_cpu_stop(1); set_flag(0); - smp_cpu_restart(1); + smp_cpu_restart_nowait(1); + report(!smp_cpu_stopped(1), "cpu started"); wait_for_flag(); + report_pass("test flag"); + + report_prefix_pop(); + report_prefix_push("running"); /* * Wait until cpu 1 has set the flag because it executed the * restart function. */ set_flag(0); - smp_cpu_restart(1); + smp_cpu_restart_nowait(1); + report(!smp_cpu_stopped(1), "cpu started"); wait_for_flag(); - report_pass("restart while running"); + report_pass("test flag"); + + report_prefix_pop(); + report_prefix_pop(); } static void test_stop(void) From patchwork Thu Mar 3 21:04:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12768129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 917E3C4167D for ; Thu, 3 Mar 2022 21:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236428AbiCCVFW (ORCPT ); Thu, 3 Mar 2022 16:05:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236412AbiCCVFU (ORCPT ); Thu, 3 Mar 2022 16:05:20 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8F71986D7; Thu, 3 Mar 2022 13:04:33 -0800 (PST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 223KZU8t020313; Thu, 3 Mar 2022 21:04:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=3ZH8MdghW/0bZQm9UWePe5VZGRdVrWK2R6PL6sAdecU=; b=sZpVKdlrbn11lDqG6xUG1Ac7jYqnBj+QuwrFAifrEsM4ExZ234LJ1XBtZwEDVi64bCNC valo4i7D9JyEHywoq4TPObw0lntq5lW/zfhA3AaStLkL//7k6Auy304tA8lKsvtvep8w kWOrmzx1UbnqwXQDrfSv1xyrIaVj8OX5dwfgn/NPbR74Jb64Fxy9ha4Jl8yP5PXX2xXz OzTzIq1v5PFvD4NVHb/6y6ayb4tXX3GTu/4iySCCrdDb0h1x4Aoz/Oob8S7DY7UeGyAP XELjLvy7Armhs4xTnkulv6f/UdkCqN+psmQk/tVq2mzsBjiqZKYv228MPUorxkU+JIcg cg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ek4uk8fm9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 223KgPrK020374; Thu, 3 Mar 2022 21:04:32 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ek4uk8fkp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:32 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 223L2wVR007966; Thu, 3 Mar 2022 21:04:30 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3ek4k40231-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Mar 2022 21:04:30 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 223KrSgf50266610 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Mar 2022 20:53:28 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B20542049; Thu, 3 Mar 2022 21:04:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1763142041; Thu, 3 Mar 2022 21:04:27 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 3 Mar 2022 21:04:27 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 89BE4E048E; Thu, 3 Mar 2022 22:04:26 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v1 6/6] lib: s390x: smp: Convert remaining smp_sigp to _retry Date: Thu, 3 Mar 2022 22:04:25 +0100 Message-Id: <20220303210425.1693486-7-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220303210425.1693486-1-farman@linux.ibm.com> References: <20220303210425.1693486-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BoWTKvWYIczb_Vagb8cEPQc_c4Biz-oL X-Proofpoint-ORIG-GUID: fr8QLmWkab7E53jue4vTnF47G35AfNXH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-03_09,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 clxscore=1011 phishscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203030095 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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; /*