Message ID | 20220721161302.156182-37-imbrenda@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> 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 74B7BC433EF for <kvm@archiver.kernel.org>; Thu, 21 Jul 2022 16:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233846AbiGUQON (ORCPT <rfc822;kvm@archiver.kernel.org>); Thu, 21 Jul 2022 12:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233645AbiGUQNw (ORCPT <rfc822;kvm@vger.kernel.org>); Thu, 21 Jul 2022 12:13:52 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F9C87221; Thu, 21 Jul 2022 09:13:44 -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 26LG6dgZ005793; Thu, 21 Jul 2022 16:13:33 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 : content-transfer-encoding : mime-version; s=pp1; bh=7qWwji1FQJJvxBYEHqBis9Dz05p3o9ySW2Bhs6jt5pM=; b=hFn6LMT8Uhkl3r7zDshxP01L3THG8veuBM+I1fLQHSPNzO/JDxim98WLc/kHlcmD8jZe HBgJjhVii6qBmzooAz9CEFu/9qiW+FCspMonpnmk/Z3p6Xv4+rXFdhEWj4UhmE4O6aI0 782cdB6jQL7V6q+fQGfSeZ54rH3o47Cy+Lw2I5nfb+CcyrfyV6UfX8U5sMcYDMkmdbi4 GIlOOxSuc3uDO//3myTfAxn6PspSgzJunStw9Iwy2smIqs4BUOpwBxLhqQuy8c/R9rGx CbaDRtgxmFDJ2yRlSjK9bnjgu+yJNI6GNV42GtihPtdeBGk2uKVU4ClOaLyx3dHrJ2Nh Fw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hf9tfgfsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Jul 2022 16:13:32 +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 26LG6ojV006759; Thu, 21 Jul 2022 16:13:32 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hf9tfgfra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Jul 2022 16:13:32 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26LG7X3c018697; Thu, 21 Jul 2022 16:13:29 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3hbmy8ney0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Jul 2022 16:13:29 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26LGDQpb16580952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jul 2022 16:13:26 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C88CA405F; Thu, 21 Jul 2022 16:13:26 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2462A4054; Thu, 21 Jul 2022 16:13:25 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.4.232]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 21 Jul 2022 16:13:25 +0000 (GMT) From: Claudio Imbrenda <imbrenda@linux.ibm.com> To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, frankja@linux.ibm.com, borntraeger@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, thuth@redhat.com, david@redhat.com, Nico Boehr <nrb@linux.ibm.com> Subject: [GIT PULL 36/42] s390/mm: KVM: pv: when tearing down, try to destroy protected pages Date: Thu, 21 Jul 2022 18:12:56 +0200 Message-Id: <20220721161302.156182-37-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220721161302.156182-1-imbrenda@linux.ibm.com> References: <20220721161302.156182-1-imbrenda@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: EOXlYXWfwPJidT0LwLl9UDGuXSvPidCK X-Proofpoint-ORIG-GUID: KacDQka6e_BYWvNMQgXgYTBmOGIEzxhu Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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-07-21_22,2022-07-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 mlxlogscore=852 clxscore=1015 bulkscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207210064 Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org |
Series |
[GIT,PULL,01/42] s390/sclp: detect the zPCI load/store interpretation facility
|
expand
|
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index f16403ba81ec..cf81acf3879c 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -1182,9 +1182,22 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, } else { res = ptep_xchg_lazy(mm, addr, ptep, __pte(_PAGE_INVALID)); } - /* At this point the reference through the mapping is still present */ - if (mm_is_protected(mm) && pte_present(res)) - uv_convert_owned_from_secure(pte_val(res) & PAGE_MASK); + /* Nothing to do */ + if (!mm_is_protected(mm) || !pte_present(res)) + return res; + /* + * At this point the reference through the mapping is still present. + * The notifier should have destroyed all protected vCPUs at this + * point, so the destroy should be successful. + */ + if (full && !uv_destroy_owned_page(pte_val(res) & PAGE_MASK)) + return res; + /* + * If something went wrong and the page could not be destroyed, or + * if this is not a mm teardown, the slower export is used as + * fallback instead. + */ + uv_convert_owned_from_secure(pte_val(res) & PAGE_MASK); return res; }