Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1672803pxb; Thu, 14 Apr 2022 11:18:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmCkyhvaAtUdJ1HFq83BONUsUEWNRJ3wS+j2Lp3n1hPi2Ke1XIzSfpfDzVG5ajYmmKVu9s X-Received: by 2002:a05:6402:3046:b0:420:120e:ef2c with SMTP id bs6-20020a056402304600b00420120eef2cmr4427435edb.160.1649960318172; Thu, 14 Apr 2022 11:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649960318; cv=none; d=google.com; s=arc-20160816; b=d2DwEG8uT/KVTQp4LeULq7wTiGm9+TjBwWbXLn4alLpiIsR3zfPLh+a0xyH6uVXMWn e5ir5wk7ihUYAL9x2Y6QvBrfT378T+UaFGCz68CZmhhWXw3sQvOtsl0UnYRi/veCj+4E 77CxCFpOHBRlXcI5kZJVlr2ViqgXAfg+qeDS2GqGMz3zCxd/ekSTGQ/zbWkwIZ/vgE/u jTm+59CYYMbYQbS7pwNgYkAks3WUIxxNbj+CFqmQ+tMKT7RTeYulPtKxL5etJ0kub4EO s9rw38lKKIeYlTZw+Ta29BRZPf5zg0ePfMeHlnIUVP3VM/6NP8AmG6hgsOUWWXoFuXwC 8R7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GNm57nIHmvnIF4jojN/Gffaspu3Os3PHR9VM1RclCtM=; b=lgRc5ZccwztiWjT3KdroTh/U2OfdZ2eqLh41I1utKAuF+kOd/io5zKWWJ5OOqAblDO WHguN1mGchbtkQZqhXPZ5oIHjKeuQu2zkIFoGISF5jsShfkHHYuGkQfhikKBZ5cxev8d 3p++nEQVu/hTHSMsUeRfaO46TDFy/Pd54609AZT99Antw4ccY67R3RpthzCYDd/VkF+V I15s0Xy+mLqyeCgVnFuqAuzrkOa2AH3kzunFOeKcZIRQxdyVTLzuNWBMusI7Gpj0SEPU GuoG2EqMEO5ZqnUv+9oGUeYjqqMVLHtiz7STvcHCZL1cdiQHHQO5rwqjcOcHG+FxJxIe f8Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ad65Y4GT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lt21-20020a170906fa9500b006df76385e8fsi1647730ejb.815.2022.04.14.11.18.13; Thu, 14 Apr 2022 11:18:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ad65Y4GT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241093AbiDNIHs (ORCPT + 99 others); Thu, 14 Apr 2022 04:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240762AbiDNIF4 (ORCPT ); Thu, 14 Apr 2022 04:05:56 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51AE74CD70; Thu, 14 Apr 2022 01:03:32 -0700 (PDT) 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 23E7kc8d011978; Thu, 14 Apr 2022 08:03:32 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=GNm57nIHmvnIF4jojN/Gffaspu3Os3PHR9VM1RclCtM=; b=ad65Y4GTHxjFUdWtqVPLbeeyoScJUiw2EOqWEMmWUEnS8SL8/K7nsURec+Jx5/QoNK1x nGurNhf4OkAGvyOCuO8Xp1sry/diiS1vSl/jIdWoGS+3soFFBqwH1ZV1H/vForBZ1NZT wRBUMqZ19qsqHQPgk3XodmNHGAVBaW2Gw6nKXKPlAkfDelzFkGjrENw5yXRFmdvAkx9F K1BExRxUzABC3wVU3j6IZAIQXUjjoYyZj86Wcn2sFZcVlVk2xUIOuI8UrM+tEoxBho/l Ib14ODNeJ9jW4JjOpXmwVykQbJYKO423bv7MHGhAm6EGMJMOD0TF/VVmoqzX8/nxf9jR Rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fefh5084y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Apr 2022 08:03:31 +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 23E7oYcW001920; Thu, 14 Apr 2022 08:03:31 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fefh50844-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Apr 2022 08:03:31 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23E7m5NV011853; Thu, 14 Apr 2022 08:03:27 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04fra.de.ibm.com with ESMTP id 3fb1s8xfvb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Apr 2022 08:03:27 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23E83YM826018176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Apr 2022 08:03:34 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1485AE04D; Thu, 14 Apr 2022 08:03:24 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 202B5AE059; Thu, 14 Apr 2022 08:03:24 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.1.140]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Apr 2022 08:03:24 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, david@redhat.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, scgl@linux.ibm.com, mimu@linux.ibm.com, nrb@linux.ibm.com Subject: [PATCH v10 12/19] KVM: s390: pv: refactoring of kvm_s390_pv_deinit_vm Date: Thu, 14 Apr 2022 10:03:03 +0200 Message-Id: <20220414080311.1084834-13-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220414080311.1084834-1-imbrenda@linux.ibm.com> References: <20220414080311.1084834-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: J-L2pXYd6hvAU7aZBCdFt60_hKTXjIy4 X-Proofpoint-ORIG-GUID: yrQK6MeyiLTRECdXG6jPzOWJ48lKApNZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-14_02,2022-04-13_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204140040 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactor kvm_s390_pv_deinit_vm to improve readability and simplify the improvements that are coming in subsequent patches. No functional change intended. [note: this can potentially be squashed into the next patch, I factored it out to simplify the review process] Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank --- arch/s390/kvm/pv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index 788b96b36931..be3b467f8feb 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -180,17 +180,17 @@ int kvm_s390_pv_deinit_vm(struct kvm *kvm, u16 *rc, u16 *rrc) cc = uv_cmd_nodata(kvm_s390_pv_get_handle(kvm), UVC_CMD_DESTROY_SEC_CONF, rc, rrc); WRITE_ONCE(kvm->arch.gmap->guest_handle, 0); - if (!cc) - atomic_dec(&kvm->mm->context.protected_count); - KVM_UV_EVENT(kvm, 3, "PROTVIRT DESTROY VM: rc %x rrc %x", *rc, *rrc); - WARN_ONCE(cc, "protvirt destroy vm failed rc %x rrc %x", *rc, *rrc); - /* Intended memory leak on "impossible" error */ if (!cc) { + atomic_dec(&kvm->mm->context.protected_count); kvm_s390_pv_dealloc_vm(kvm); - return 0; + } else { + /* Intended memory leak on "impossible" error */ + s390_replace_asce(kvm->arch.gmap); } - s390_replace_asce(kvm->arch.gmap); - return -EIO; + KVM_UV_EVENT(kvm, 3, "PROTVIRT DESTROY VM: rc %x rrc %x", *rc, *rrc); + WARN_ONCE(cc, "protvirt destroy vm failed rc %x rrc %x", *rc, *rrc); + + return cc ? -EIO : 0; } static void kvm_s390_pv_mmu_notifier_release(struct mmu_notifier *subscription, -- 2.34.1