Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp907944rwi; Mon, 10 Oct 2022 08:41:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6063syX/GL7iSdM0Rrlq3tPFNOKvuqEWxkSHipl3IMIH3IBHQ8a1RTgKLi8ZOpyyIc2UKr X-Received: by 2002:a05:6402:4282:b0:459:befa:c79c with SMTP id g2-20020a056402428200b00459befac79cmr19002756edc.23.1665416480011; Mon, 10 Oct 2022 08:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665416480; cv=none; d=google.com; s=arc-20160816; b=vUjoHzhjAYxdd4h8oSmYs7ihOIxqwVMEFOeirOtqOk7+1HB4AMisjVNxMvnj9io1j+ z9KT0iyXpNwCgPkVPCW6mLaqwj15BnT0s4w34zeyNZeADDvPvdKh7oTFrqprkguENmC4 xLUCaV1qWQqUx8bXWLCzTIYlvosd3zFf6rssHQBM/Eg0xRmoCJaKCtjBHTmzBWGsi0wM vSVjK2QE5QDsmudEIsTe6mPJi6O8iIWhxhbpangCKdX5KcK9juIzK71frjnsftoh8qZH J3MaDDasKUl4PvDzohU2Jf6huS/rRpqAYReteiYDX4FieiNUNyuRCbG1DYHKfArwN226 yIbg== 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=LjPjXvrTuwMD+1Nim1iHWiG03uGzMFKy+1ks1EGM3C4=; b=dmnjaJize+666vNVi/CTbzl8dOi1Bk6UjpDCIge9lcfODCTxgmTpNTiOhxJreYGIaI s6RtFuUSlwoE1hSUhe2yiqTC9FmUfeuWran3i9sQMcTA9VtqGS+IVOiqdOEreDsErldP qWCs4cwt9jyO1OjeJAhC+6iJqf5uBfXsyvHZ4N79eOdLiBIKz4hw45CFJ/IK4i2jvlpw ZoAVAezw7YUY7HaEj5TKmcZI27F4iI+gpxAT1z0y3LNWgJfq0QjL1sKLjqvxinXmQWnO QyqTcHPuQOdtQbrXyY/KJu1Mv545BF1qAzVej/LrjSmwXPMJo0QX3F64ajFwgHY7g7It y+QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=PeWZpeek; 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 nc29-20020a1709071c1d00b0077eb65c41e5si10594561ejc.22.2022.10.10.08.40.53; Mon, 10 Oct 2022 08:41:19 -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=PeWZpeek; 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 S229981AbiJJOzZ (ORCPT + 99 others); Mon, 10 Oct 2022 10:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbiJJOyy (ORCPT ); Mon, 10 Oct 2022 10:54:54 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A351165AC; Mon, 10 Oct 2022 07:54:51 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29ADaSVx013410; Mon, 10 Oct 2022 14:54:50 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=LjPjXvrTuwMD+1Nim1iHWiG03uGzMFKy+1ks1EGM3C4=; b=PeWZpeekJ6iwgKAVAPbZvpm0x5ABaDomLKX9rXt8SCixqwtbFrcCkmFYNaPDQwK5OARW +dg5yzyhFTYKMt/AN9EbwNTgFPlxIbWzXAaTn9ub8QlL4PNI1aVhI3mfIrdmjV5V8bL6 AtINpw4y3s1xyX/N3tYRA7u+K7u3IkAUqdaQxvMSgbbJOa8MD9w3h/J2Rqk77lmI1IW7 DVfWWxkRVFfmoPjxpiSQjAc9HcAQcdk8jvVA+l1ANmYrO5aiTgegBWgHad1Z4+0SpQXR RBE7HULnQF9vwge+/SlX09QQDVTO0Fxyei3i/sMT7HUe3rt0sWHWIvw9/9y7a00+nbXS MQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k3k4k0uua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Oct 2022 14:54:50 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29AAmweb025231; Mon, 10 Oct 2022 14:54:50 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k3k4k0utj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Oct 2022 14:54:50 +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 29AEofx2006792; Mon, 10 Oct 2022 14:54:47 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 3k30u9a6en-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Oct 2022 14:54:47 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29AEsiPm47972642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Oct 2022 14:54:44 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FC845204F; Mon, 10 Oct 2022 14:54:44 +0000 (GMT) Received: from p-imbrenda.boeblingen.de.ibm.com (unknown [9.152.224.242]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2A16352050; Mon, 10 Oct 2022 14:54:44 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, scgl@linux.ibm.com, seiden@linux.ibm.com, nrb@linux.ibm.com Subject: [PATCH v15 4/6] KVM: s390: pv: avoid export before import if possible Date: Mon, 10 Oct 2022 16:54:40 +0200 Message-Id: <20221010145442.85867-5-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221010145442.85867-1-imbrenda@linux.ibm.com> References: <20221010145442.85867-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ox2kSf1F-k2VwNpcRpNHLNOLt9c-NTmd X-Proofpoint-ORIG-GUID: taVF21SZ3y1NVZlrhV0oyFUJWLuwJLOV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-10_08,2022-10-10_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210100086 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 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 If the appropriate UV feature bit is set, there is no need to perform an export before import. The misc feature indicates, among other things, that importing a shared page from a different protected VM will automatically also transfer its ownership. Signed-off-by: Claudio Imbrenda Reviewed-by: Nico Boehr Reviewed-by: Janosch Frank Reviewed-by: Steffen Eiden --- arch/s390/kernel/uv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c index f9810d2a267c..9f18a4af9c13 100644 --- a/arch/s390/kernel/uv.c +++ b/arch/s390/kernel/uv.c @@ -255,6 +255,13 @@ static int make_secure_pte(pte_t *ptep, unsigned long addr, */ static bool should_export_before_import(struct uv_cb_header *uvcb, struct mm_struct *mm) { + /* + * The misc feature indicates, among other things, that importing a + * shared page from a different protected VM will automatically also + * transfer its ownership. + */ + if (test_bit_inv(BIT_UV_FEAT_MISC, &uv_info.uv_feature_indications)) + return false; if (uvcb->cmd == UVC_CMD_UNPIN_PAGE_SHARED) return false; return atomic_read(&mm->context.protected_count) > 1; -- 2.37.3