Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1948483pxb; Wed, 30 Mar 2022 13:13:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOOV153CcUO3FfiDF3JJ/QNCxmsG7FPE3WHoMPW53WthdzSzw25Z1DnDLEJq791h+O/tzF X-Received: by 2002:a17:907:6092:b0:6db:ab31:96a2 with SMTP id ht18-20020a170907609200b006dbab3196a2mr1364399ejc.361.1648671189946; Wed, 30 Mar 2022 13:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648671189; cv=none; d=google.com; s=arc-20160816; b=reaoP6Zr2EE/4c4c27jOpvORHosEl83KEqaAklrx1ja5KKeEByNNUbWOwItSFaHdnl ihIj6aEy2B2I0UZYQQDREnIoX93zhB7kj0M2KNMV8yDvEt0IJ1I9sRj25iOlMVB+Ga4l AXyhusJjKmUCeqkAyMb226kxQoXzMXeuqUykSbm2clULsAEAENRHUZufAFf3jOdw55td 0QPghT+sad6BICsJGwNqGIYg0f4VgOoZqox9/N+RfYC76yHtmZOxyxqgPZjXY/tPzmvN xQ9uHEksbN9LEn/mTn+kjx97Wl4gNdZD021GDKubYP8u8bCuwmO7Ye+fSCEkJT+Dx9dx ZgiA== 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=zZfQZ9UUYBtogOFzYn+NCL2mF6e4PtSXUfIQU3pEt86XU6nE5BFXWg5XHsiL0JChXK zurG0x/z/AZhz9JGjp5qLv+YgPC1cU5SUCgp4FpJLAjka5llI9U5BKIvhh2Hp0NxWWKY mmHkCS9lp5zAo1IFs3B5Qt1PT7ZfRbEAW8Ob1vmnmjp92zBip5MqYMhbis7rlJw0hlFY 8EyzNahu96gQpYHRYhK+ATQ3wHVWgjqByNOFGMKXqeuADRBiRytFvUBDKsys7F5HHS8r ubUm1v6JQMSCNiAkV6sNETw6vbab0m+fWrr4OiFw5KFs7pV+kJABlv5geY5V4K/YLc1r Sw5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=iZO1gJ12; 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 b19-20020a056402279300b00418c2b5bf74si23309350ede.598.2022.03.30.13.12.32; Wed, 30 Mar 2022 13:13:09 -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=iZO1gJ12; 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 S1345382AbiC3Mkw (ORCPT + 99 others); Wed, 30 Mar 2022 08:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344595AbiC3Mh3 (ORCPT ); Wed, 30 Mar 2022 08:37:29 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1373450475; Wed, 30 Mar 2022 05:26:25 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22UBeV61012217; Wed, 30 Mar 2022 12:26:24 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=iZO1gJ12VB1ASFjDqNT2cDJ5wtU4eTqiq7vcBdxN6m5mejVu9zVQprUZy0ekpZFYZuXM kMXh/aSkGoCZL3/phyQ4QpgcWFElpuh/B3n6YplMCI72OmKpvXD4k4+ee1GIY4s9jy1g A13xvoAQi1d+JqfuZ0MpYI4pk5cBxlY58YE6yxxG76pEAOMOAl9+TXdZmdiJAu8JGXuu /cHLknVL5R5CJLa0LJIPE7Rh6j+QhnmTPyP4ztaaDRM5Lua1FaZr5OJHhM2g0uLe7Sl9 Qj2Nb+KIYTJp/rPO83oQ7+7YTQ8z4mIyaLdL8hkyrFhsog1btSPDN5mQBwhcSRem69gc Pg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f40c95bjw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Mar 2022 12:26:23 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22UBgKcf016845; Wed, 30 Mar 2022 12:26:23 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 3f40c95bje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Mar 2022 12:26:23 +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 22UCNMnl027007; Wed, 30 Mar 2022 12:26:21 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 3f3rs3khpc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Mar 2022 12:26:21 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22UCQIvE49545696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Mar 2022 12:26:18 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E61A11C054; Wed, 30 Mar 2022 12:26:18 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F38311C04A; Wed, 30 Mar 2022 12:26:18 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.13.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 30 Mar 2022 12:26:17 +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 v9 12/18] KVM: s390: pv: refactoring of kvm_s390_pv_deinit_vm Date: Wed, 30 Mar 2022 14:25:59 +0200 Message-Id: <20220330122605.247613-13-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220330122605.247613-1-imbrenda@linux.ibm.com> References: <20220330122605.247613-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0TOOcdlkdDdfbdcBM8du-YstLc4lY3q_ X-Proofpoint-GUID: xJPLx0k7_vemv0tCiJeJAFQFCZ970JFb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-30_04,2022-03-30_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxscore=0 spamscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203300062 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