From patchwork Fri Mar 11 17:38:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12778453 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 D4DF9C4321E for ; Fri, 11 Mar 2022 17:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350805AbiCKRjl (ORCPT ); Fri, 11 Mar 2022 12:39:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241879AbiCKRjj (ORCPT ); Fri, 11 Mar 2022 12:39:39 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 673B31AE67D; Fri, 11 Mar 2022 09:38:32 -0800 (PST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22BFgJqf010408; Fri, 11 Mar 2022 17:38:31 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=cyMrvpbJRr1Y7Zy1Xz1FzPCVdiOVKrn/yOo/sLqHjEg=; b=QWBJ3e20EWRM2qm4ihIarV+xfV6VDAbF92qj3bdV0/Tx7j1LIRMWH0aYqXOspF58iTKt l4IH1r3SgMt6EOA98a9HXupfIduy2sVr9D6TLsqq8B8oCByMXzr8BxshlmyhQsF20pI8 WVKs6e08dRnYEajhqR8fSVwG3MVyqQ6R58ZPhhgHPr1+1i5Ggvz0LJ6EE5WI/Bdxad0K eeMOHKm3onuRYKUxuhsZ/Wt1HcZDL7XraOJWSMQ8zobbYDG7H269ODA2GWC3ucmq20lE VX7X5IVFemqzHTL7RJBhtUMi7hfFwJGOSrM1KdppNRkWRJ+Ug103o8V0UZBf3rKi4NcN 2A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3er0p04jhy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Mar 2022 17:38:31 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22BHOH4K001620; Fri, 11 Mar 2022 17:38:31 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3er0p04jh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Mar 2022 17:38:31 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22BHYL0l027687; Fri, 11 Mar 2022 17:38:29 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06ams.nl.ibm.com with ESMTP id 3eqqf0a5h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Mar 2022 17:38:29 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22BHcQwL34669024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Mar 2022 17:38:26 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28FB6AE051; Fri, 11 Mar 2022 17:38:26 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 176E1AE04D; Fri, 11 Mar 2022 17:38:26 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 11 Mar 2022 17:38:26 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id C3601E128A; Fri, 11 Mar 2022 18:38:25 +0100 (CET) From: Eric Farman To: Thomas Huth , Janosch Frank , Claudio Imbrenda , Nico Boehr Cc: David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH kvm-unit-tests v2 1/6] lib: s390x: smp: Retry SIGP SENSE on CC2 Date: Fri, 11 Mar 2022 18:38:17 +0100 Message-Id: <20220311173822.1234617-2-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220311173822.1234617-1-farman@linux.ibm.com> References: <20220311173822.1234617-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ftYDFHe6QrdMGgqBvHYrWY2gFe9LKdqh X-Proofpoint-GUID: EGbYhHUbVMjYqJ2vqFJjhLbjPTeorUWV 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-11_07,2022-03-11_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203110086 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 Reviewed-by: Thomas Huth --- 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)); }