Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3991107iog; Tue, 28 Jun 2022 07:00:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uUngWi8tIYPRoIdi9bL665nrY0qX7fmI97qkw8gq8jnxuraUEXGBgf3X7QRXX4Dlwxw23C X-Received: by 2002:a17:903:1108:b0:168:fa61:1456 with SMTP id n8-20020a170903110800b00168fa611456mr5042231plh.162.1656424833993; Tue, 28 Jun 2022 07:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656424833; cv=none; d=google.com; s=arc-20160816; b=bPMlkrpck5ea4LddTXuxxABHRsvOCbQjcJFSCcNqn+dfWRhGIwLPM14az/2FgzISy5 fV/DgzO1HltRZl0U9lCgL3NGNdOOnYulFtF1SRXE8pebelt9MaEGMOTmWaB48VpCqZBN a/qyCTZReO5KkOsXM0lmTFMrVlNNeKBQldb4H/9F6846GTs5mIh2XOx0zcQQZFREUD6f 0hgV78CAT16jekQpYyd3Bu4441FaDPjiOCFzdz5Pt7ztVaswPEz3Mw7s6S2pDfE/Fh55 sFtXCQbywuuu9+hEbu4ihRjE0IcWu24FH4MWEk+1uWt7V/pY4JLxnoodT5AEiLq2jgvg e+iw== 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=oXlWSVqsE3tT9VcEPgf1JzO7RQ9KXN2+H3A/PeO4GYg=; b=SvE7dWnjUbxuwKG7hAcuv8PCwZ6M1RBVPmu/61e52bhcFgTj47DTSgT4FQzKsO2hsn le3T7bL2FWV89vRDw1BC4sojjxzar2DH5xW+bAQ3z+3xNKp4Tu3SAdJgi9aTYu8G1n+0 Feyt0p5iN6t350vZl9jpDMsv4Op1glqICmqWHtduFVFNQow3gNV34I1UKrkp1Nz/QFcC NROwmdX69bXaRBicnjD6MrBYeaWGpstMKQKEtMmoyFSkddZZ04YGqw3LFbgmq7TGils7 dbaRPfyhq4z1+hvdZV1CeDnBn4B7rwj7R1U8dr8c1nAXTqvrMeeODkCN7tWoHtHkBy+q 4AQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NzAf1XSQ; 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 iw19-20020a170903045300b0015cdeea3a8dsi14844071plb.374.2022.06.28.07.00.19; Tue, 28 Jun 2022 07:00:33 -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=NzAf1XSQ; 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 S1346024AbiF1N67 (ORCPT + 99 others); Tue, 28 Jun 2022 09:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346936AbiF1N4c (ORCPT ); Tue, 28 Jun 2022 09:56:32 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3429B33887; Tue, 28 Jun 2022 06:56:31 -0700 (PDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SDlYP0004851; Tue, 28 Jun 2022 13:56:30 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=oXlWSVqsE3tT9VcEPgf1JzO7RQ9KXN2+H3A/PeO4GYg=; b=NzAf1XSQH8D0KkwMsc38nazZe1F93hUMjgtxhhgQtLIhrrffsIoMct/HZ46C5KJxwueo 9mfP0AHl99vFJAQlIPKkT8QeY24xCna0vjwQKoFyPzFOVJuenF2hKC9kbRICZld/fyO0 qZHJQ6SzOZz7PMOz2vbkDvEqion92m8/d6vKkreH7urKW/tuQaTdQPjs+dBD3RWggLSd CBsSIT+s2o7DnY8cR3el+5estA2bHRM4+KLTNgw+V3FFEFIH3kAez6zymMyy//q7nv83 Lh0Y1K90n5FbLRjRtgWXRqRzQSGC6HCPqduMOKQrmqFtmlR6FThY8YTWtz+whwL4hMwR 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3h02uc89cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jun 2022 13:56:30 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 25SDn3j0018920; Tue, 28 Jun 2022 13:56:29 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3h02uc89bk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jun 2022 13:56:29 +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 25SDq96I006317; Tue, 28 Jun 2022 13:56:28 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 3gwt093pdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jun 2022 13:56:27 +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 25SDuV1S33358182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jun 2022 13:56:31 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BAF7A4C044; Tue, 28 Jun 2022 13:56:24 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61EFE4C046; Tue, 28 Jun 2022 13:56:24 +0000 (GMT) Received: from p-imbrenda.boeblingen.de.ibm.com (unknown [9.152.224.40]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Jun 2022 13:56: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 v12 11/18] KVM: s390: pv: refactoring of kvm_s390_pv_deinit_vm Date: Tue, 28 Jun 2022 15:56:12 +0200 Message-Id: <20220628135619.32410-12-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628135619.32410-1-imbrenda@linux.ibm.com> References: <20220628135619.32410-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fMbnmaH_ORYTDK2cCjAVXv_4HM4ozabd X-Proofpoint-ORIG-GUID: 55jK-2wFiaBHzANoz7JhrPOPnBltyehD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-28_07,2022-06-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 malwarescore=0 impostorscore=0 spamscore=0 priorityscore=1501 bulkscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=963 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206280057 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,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 da1bae111fb1..a389555d62e7 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -175,17 +175,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.36.1