From patchwork Thu Mar 28 04:55:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51CFBC54E67 for ; Thu, 28 Mar 2024 04:56:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD6E46B007B; Thu, 28 Mar 2024 00:56:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B86F66B0082; Thu, 28 Mar 2024 00:56:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A27336B0083; Thu, 28 Mar 2024 00:56:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 849D86B007B for ; Thu, 28 Mar 2024 00:56:56 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 44BF7160BE0 for ; Thu, 28 Mar 2024 04:56:56 +0000 (UTC) X-FDA: 81945238032.10.7792799 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf28.hostedemail.com (Postfix) with ESMTP id D2D28C0005 for ; Thu, 28 Mar 2024 04:56:53 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="g3/vLH9W"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711601814; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=c2Uy3YzkHEkdm5FrTXEJIDYr7sMUlYwD1FCPraQ9ds0=; b=Ti7jazJdJaawBIKz80+OyAxTUu35JCIs/fVzCczov62+GfWKz+PZLu3BoUCNkowrvRdnTp g+sjft6y50dIARp752zfRiaFsY/v0HwRiK0epxwQU7FWPwlefkeuYM1gzM/yjtRmOHT7YS i9Cut8/YnupB2DB080LL01O7NUw1c64= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="g3/vLH9W"; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711601814; a=rsa-sha256; cv=none; b=BG/XNdMgtyPFZ2exhG7/BpNQsKCIhA8DKi8as9CSuG0oYHkz7Ldk4L86XeVoh+Bxck2V4Z BeNMnn6hVN4KAXRBqJX3Tj8JgNQ/wSzVP+Qva14cs3ey2YmbQJOj2HRtm16FcNS78v0DX7 J7ltw9ypeo9kMdxd8ulb0MzAfWuVIQs= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4OZe9008372; Thu, 28 Mar 2024 04:56:43 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=c2Uy3YzkHEkdm5FrTXEJIDYr7sMUlYwD1FCPraQ9ds0=; b=g3/vLH9W/fHcUOTVWss65Wjn6Txr1eGBfsZFF/L1I2wwdf1gpT4yqvRbumjOFiiHHRyN 2rX9B2oSlcFQvOe4jHaT57CUJaCSFkTEB2K5wlju2yNW3BVLZTn+rWl9LKg/fHZMulCn ASkqm+86CZoCKatA7y3X0TD+RU9R3EnIaOsWKVbEi+XjLLZiLDVIBN3QACjwjNoKCwzI kHQSypumkv/jAN4oARaRB3+zOJPngJnPn/DzcfbEstOSWdk456jnQWjAFUkAhT+xCu3q RhEVFVMgrqhL9Tlc9bgXiVkLZGDS/hLEGtGpR++WDGnl3ZoOciD6J11L4DJYh78wOILC nA== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x509tg7eu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:56:43 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4HltX012975; Thu, 28 Mar 2024 04:56:42 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x29t0uh7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:56:41 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4ubpT16712156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:56:40 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D36382004D; Thu, 28 Mar 2024 04:56:37 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1CFC2005A; Thu, 28 Mar 2024 04:56:36 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:56:36 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 8739660112; Thu, 28 Mar 2024 15:56:31 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 01/11] Revert "mm/page_table_check: remove unused parameter in [__]page_table_check_pud_set" Date: Thu, 28 Mar 2024 15:55:21 +1100 Message-ID: <20240328045535.194800-4-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: B6cD-WxQSYwj4zCRMDVW89aycbQqggi3 X-Proofpoint-ORIG-GUID: B6cD-WxQSYwj4zCRMDVW89aycbQqggi3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 bulkscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280028 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D2D28C0005 X-Stat-Signature: mf77us5xgjt7o5pdi4xkjs9bokykiy9w X-HE-Tag: 1711601813-794160 X-HE-Meta: U2FsdGVkX1+1HrgjAEgvwxxcvGFBn2xi0qMCk+D728S3zi3HnzZCBsMP5kCZtFd+ME/Rw5a5FxxWSrDNtShZU0NPf6AhQ9qAqRXjKEmCOQ4jAR9U6x05nExvI2NYqxI00yOH5KWIqDGo9BFJlzihGe4xQ40qdk77yXgJgJ8DTGQ0Kf9gXXgi3WNJt7wz0AIT45PTePJKImnJJIsawNuTxrFmrkIL+7qCegAKL/bzCgWiPYNbPm5ZtXQL6FIGRpNv3cdkLp4ssADbiix5v7of72b92SiVpQiTB3T3MtgoYrNhGdwbLxJuyaR/qFv7QFFHecdu4iIoSMTx+QwYrzhBIVqWlpnj0EjY8q/4k0+k3i1wkQzZkURhG22MgkTMuT9RT78JPhY8u5S9aqbPE/JZ4MFnG6WZNQ26rft8ZrYGoqSyKFK5BLdnyBISNzxhxFI5dhNsTqDG6VQQtn/ZXd2GICtklI08iuUIrV546d22af5qil1df7MUrwhyzOvVSV9wAIazZZlOHQW0o8tz8d1K/e5mcx2G1S6yLDfjDmMhAAH5FFdz97APHy/9SAPp72kTFMHk7j8CKfIiMCLpcsM8qz4TETyN6SB7nZsUQPfSH3oV5HRL6UApQ3cEuVexpcrqEwgG9OWg+klDYlIpXyi1b/lPuLB4GDmyK+1QkR/BT6bvGqPLzaatavFb9kremXv0tkrEYgsCvkKAZ2Wa/rt9J3c8VBCaAdgIj37AJLLzEBdPbxBZwmkOpf5Qdypf8RtfZ/X27jrif6xN6Lssk7RDMC7ecNqMqq44kp4Jf/POIVuL35KwcBKeYpDaE1PxHqAZ/xZg0ZTmwelnTxGliussWh17SU7KcS+JedGx0tjHMhNAMRxN2OEGRe/82MRvcZ1vK1AJliy3JQdCcF1e1et1n+VZllV4t5Xt8zR5Yvy5X5crH/gZyRQO93f3OGWkHsVB+HQE+VNiHEI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This reverts commit 6d144436d954311f2dbacb5bf7b084042448d83e. Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but instead in the address of the access. riscv: Respect change to delete mm, addr parameters from __set_pte_at() This commit also changed calls to __set_pte_at() to use fewer parameters on riscv. Keep that change rather than reverting it, as the signature of __set_pte_at() is changed in a different commit. Signed-off-by: Rohan McLure --- arch/arm64/include/asm/pgtable.h | 2 +- arch/riscv/include/asm/pgtable.h | 2 +- arch/x86/include/asm/pgtable.h | 2 +- include/linux/page_table_check.h | 11 +++++++---- mm/page_table_check.c | 3 ++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index afdd56d26ad7..7334e5526185 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -568,7 +568,7 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(mm, pudp, pud); + page_table_check_pud_set(mm, addr, pudp, pud); return __set_pte_at(mm, addr, (pte_t *)pudp, pud_pte(pud), PUD_SIZE >> PAGE_SHIFT); } diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 20242402fc11..1e0c0717b3f9 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -719,7 +719,7 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(mm, pudp, pud); + page_table_check_pud_set(mm, addr, pudp, pud); return __set_pte_at((pte_t *)pudp, pud_pte(pud)); } diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 315535ffb258..09db55fa8856 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1245,7 +1245,7 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(mm, pudp, pud); + page_table_check_pud_set(mm, addr, pudp, pud); native_set_pud(pudp, pud); } diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h index 6722941c7cb8..d188428512f5 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -20,7 +20,8 @@ void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud); void __page_table_check_ptes_set(struct mm_struct *mm, pte_t *ptep, pte_t pte, unsigned int nr); void __page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t pmd); -void __page_table_check_pud_set(struct mm_struct *mm, pud_t *pudp, pud_t pud); +void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, + pud_t *pudp, pud_t pud); void __page_table_check_pte_clear_range(struct mm_struct *mm, unsigned long addr, pmd_t pmd); @@ -83,13 +84,14 @@ static inline void page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, __page_table_check_pmd_set(mm, pmdp, pmd); } -static inline void page_table_check_pud_set(struct mm_struct *mm, pud_t *pudp, +static inline void page_table_check_pud_set(struct mm_struct *mm, + unsigned long addr, pud_t *pudp, pud_t pud) { if (static_branch_likely(&page_table_check_disabled)) return; - __page_table_check_pud_set(mm, pudp, pud); + __page_table_check_pud_set(mm, addr, pudp, pud); } static inline void page_table_check_pte_clear_range(struct mm_struct *mm, @@ -134,7 +136,8 @@ static inline void page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, { } -static inline void page_table_check_pud_set(struct mm_struct *mm, pud_t *pudp, +static inline void page_table_check_pud_set(struct mm_struct *mm, + unsigned long addr, pud_t *pudp, pud_t pud) { } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index af69c3c8f7c2..75167537ebd7 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -210,7 +210,8 @@ void __page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t pmd) } EXPORT_SYMBOL(__page_table_check_pmd_set); -void __page_table_check_pud_set(struct mm_struct *mm, pud_t *pudp, pud_t pud) +void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, + pud_t *pudp, pud_t pud) { if (&init_mm == mm) return; From patchwork Thu Mar 28 04:55:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 109D7C54E67 for ; Thu, 28 Mar 2024 05:01:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9433D6B0092; Thu, 28 Mar 2024 01:01:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CC426B009A; Thu, 28 Mar 2024 01:01:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 747826B009B; Thu, 28 Mar 2024 01:01:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 528D66B0092 for ; Thu, 28 Mar 2024 01:01:40 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EE28EA0F3B for ; Thu, 28 Mar 2024 05:01:39 +0000 (UTC) X-FDA: 81945249918.25.34BA37E Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf12.hostedemail.com (Postfix) with ESMTP id B7FEE40004 for ; Thu, 28 Mar 2024 05:01:37 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=GaJWn00W; spf=pass (imf12.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711602097; a=rsa-sha256; cv=none; b=c3iugk+CDodqRntHM64hcz0ya7kUuWviZKBT+5i6zl5tDs9xpVTHnJ/zXjk76uXWYPuBiB NVHJGH907677zj13R8wkyVyadtn6s6ND+TIj+q+3VGd2D15/DxnbbvPJzv3JwZqmtGQMiH uK7xhkPH3FlcoQv/5DFtIuZLaoJgEIc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=GaJWn00W; spf=pass (imf12.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711602097; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nLWG/9f5VzQNniofE9iwE4THEl8pt1EB1uS6VH25BJs=; b=v+pQ6y1e+KgpzjJo2PUTh/8NP3+ID2flrccv4lKS4kIrRdkAOwWkt6GEIrQ6V4PlHHuwQc Om0a/8BW2hN5c6qzeNUiPBKgR7fzpcS/6pBoMO+n9fj8IImOpmLisPJjTZwgN/D6QV/hot t8dmMOEqp6CdvqaF00Xckw8HrP2/TNA= Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4tlIa029621; Thu, 28 Mar 2024 05:01: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=nLWG/9f5VzQNniofE9iwE4THEl8pt1EB1uS6VH25BJs=; b=GaJWn00WycIIPYxmIWDpbc/XPVNY2Nzif2txdPIkYVpN0XDrboVM61vcxblS3Cca6GGd YusKwYGoVBHgqu83/k7joZ0hkDGTnwvSrG3kV+vAzYeONMhGY/GHV+BKkt9iJhoY/jxJ Xq0yNskZed1BXtrJbxFRNAvTARvAO8pjgMtzGfPKhVSAdRCp8/hP+E7jMsiOp42Y9giL /eHQe+c14FF3yIdT/hKmH/WlzTF70r/bwPYjXR4/ccvoq17boE7oN5kVeoE0wxGxGGlA o6dvjbmHjrvqHH/vRcPW+NJMIiQAFZuP6L2zBaIrvh4KpKm0DM/LmUPTVfEVSSGxF6gt vQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x505a8857-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 05:01:29 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4rB9M028717; Thu, 28 Mar 2024 04:56:46 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x2adpkbpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:56:46 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4ugq826739276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:56:44 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B0AA20049; Thu, 28 Mar 2024 04:56:42 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B731E2004F; Thu, 28 Mar 2024 04:56:41 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:56:41 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 47EA860429; Thu, 28 Mar 2024 15:56:35 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 02/11] Revert "mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_set" Date: Thu, 28 Mar 2024 15:55:22 +1100 Message-ID: <20240328045535.194800-5-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: q_wwPUKELJVtmeYZ_ztoIyL1g9Nj_fK6 X-Proofpoint-ORIG-GUID: q_wwPUKELJVtmeYZ_ztoIyL1g9Nj_fK6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280029 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B7FEE40004 X-Stat-Signature: qd5rqgharp7gdg9b6u6rdrpu5zzmcwfu X-Rspam-User: X-HE-Tag: 1711602097-628633 X-HE-Meta: U2FsdGVkX1+97ZvjL/yCHla0oGC5Mc8vVRI83hx6svR0joiHgCrqa8z4R0MCTL9+D1aGKo2UQ90AgIMB4psv41t2oF8+Mz9gkCWVyxvxCT03hQR7SSsB+ihpiuiTesky/nwA/UwgrK0oh0rAAVMaDP42dB9u6m0eehbz8osMcAChh41flzXbA2McCRAejXDHMAD+ZFlMdjTVrTW9OFVKjUn4z7f8I/FbALyy1fxGZt0VDDd/ZqDKP/MbZ8rRF9GKFcyU6SmQwsLxDaDBlKzsxmjsqLAfDk+7jWZakjiTo47nJt+IT9e96H+ryZgXg8mTMBt03lQgzZ+mhCDoh5eqs3Bc4mL50u2hqk0wReYHZkwirQWEu3vWXPmR0Z5UtqBPqgYDcNn6TRvtUGCYVS5/m/5W7CnmAFw0UPT17YvwnyT2RACh5YDirRu4viBEyqPkn51l+Ze7xl4gdSYgC2cLxE2uOqjYotB2MJOG43lCIXsj363eglk/Xq1Vly2EZRj2y1oY0cemsRhcIY+/txcm7Tgx6NjBMQtv2OVuiW75/zViL0e3TP5UWnhYqPYexZOR1Nh4PViPm9GA7WKCs1FFKviFJAzAhey+FNMVg0QrKkGVEmlfr9bQJc9m3sBhli+qsqKEwbZZEf5OAFmOfAYL+pGBDCbkslVy3gg0y+ZT1khfv8EISONhy3MmYJJKNLBhZV6kzhQbYMm2cZr08l3hRQEmHrFPNjwLblAsMjiXiEAWtSbKwuC/thUl1zNbFdAVVxrVMYBLPCKaBuAau7WQ6LaxYMvEB4eyLN40T/JszxmvvpHz4R9G0aZZCLModKN2rTWanfTakQP/vWxHrzcNTWpDrouDgVXZNGxsn2NtzTNSNCklmDZFMz00oCLs8Em1/eXcxtunUznpvrjazSJcp8UdCuhnrOTs1IHvMQRL0FkKfE85lmDpP2/TNAH8XjjjpUWtlrPZjeBmFUa38ju WbZEQ1Gd 2yVvnRtSQkqSURA8oR55P7QY7ukvZpoDJGnWoFrrgKRadb4Z591JmLuMj31FXJNb5YMzqaW59tIjuc2HaeAaJo5ltavEK2WccyRB6+HLnNubHJ7recuAipySqePUp506faVMbRD25pNyN4cfBz1XOBjC2JkuIlZBTalhY4dwhI4f6X+ae/wBfnpBsBVO/8WEO//y2MhHYCR110czuW28c2W2Z92icO4vVLB0WZTIlMN9KE4h3CABlwx+QorBebAdG2l/ysT1b1bbBydw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This reverts commit a3b837130b5865521fa8662aceaa6ebc8d29389a. Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but instead in the address of the access. riscv: Respect change to delete mm, addr parameters from __set_pte_at() This commit also changed calls to __set_pte_at() to use fewer parameters on riscv. Keep that change rather than reverting it, as the signature of __set_pte_at() is changed in a different commit. Signed-off-by: Rohan McLure --- arch/arm64/include/asm/pgtable.h | 4 ++-- arch/riscv/include/asm/pgtable.h | 4 ++-- arch/x86/include/asm/pgtable.h | 4 ++-- include/linux/page_table_check.h | 11 +++++++---- mm/page_table_check.c | 3 ++- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 7334e5526185..995cc6213d0d 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -560,7 +560,7 @@ static inline void __set_pte_at(struct mm_struct *mm, static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { - page_table_check_pmd_set(mm, pmdp, pmd); + page_table_check_pmd_set(mm, addr, pmdp, pmd); return __set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd), PMD_SIZE >> PAGE_SHIFT); } @@ -1239,7 +1239,7 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, static inline pmd_t pmdp_establish(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp, pmd_t pmd) { - page_table_check_pmd_set(vma->vm_mm, pmdp, pmd); + page_table_check_pmd_set(vma->vm_mm, address, pmdp, pmd); return __pmd(xchg_relaxed(&pmd_val(*pmdp), pmd_val(pmd))); } #endif diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 1e0c0717b3f9..7b4053ff597e 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -712,7 +712,7 @@ static inline pmd_t pmd_mkdirty(pmd_t pmd) static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { - page_table_check_pmd_set(mm, pmdp, pmd); + page_table_check_pmd_set(mm, addr, pmdp, pmd); return __set_pte_at((pte_t *)pmdp, pmd_pte(pmd)); } @@ -783,7 +783,7 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, static inline pmd_t pmdp_establish(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp, pmd_t pmd) { - page_table_check_pmd_set(vma->vm_mm, pmdp, pmd); + page_table_check_pmd_set(vma->vm_mm, address, pmdp, pmd); return __pmd(atomic_long_xchg((atomic_long_t *)pmdp, pmd_val(pmd))); } diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 09db55fa8856..82bbe115a1a4 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1238,7 +1238,7 @@ static inline pud_t native_local_pudp_get_and_clear(pud_t *pudp) static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { - page_table_check_pmd_set(mm, pmdp, pmd); + page_table_check_pmd_set(mm, addr, pmdp, pmd); set_pmd(pmdp, pmd); } @@ -1383,7 +1383,7 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, static inline pmd_t pmdp_establish(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp, pmd_t pmd) { - page_table_check_pmd_set(vma->vm_mm, pmdp, pmd); + page_table_check_pmd_set(vma->vm_mm, address, pmdp, pmd); if (IS_ENABLED(CONFIG_SMP)) { return xchg(pmdp, pmd); } else { diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h index d188428512f5..5855d690c48a 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -19,7 +19,8 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd); void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud); void __page_table_check_ptes_set(struct mm_struct *mm, pte_t *ptep, pte_t pte, unsigned int nr); -void __page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t pmd); +void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, + pmd_t *pmdp, pmd_t pmd); void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud); void __page_table_check_pte_clear_range(struct mm_struct *mm, @@ -75,13 +76,14 @@ static inline void page_table_check_ptes_set(struct mm_struct *mm, __page_table_check_ptes_set(mm, ptep, pte, nr); } -static inline void page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, +static inline void page_table_check_pmd_set(struct mm_struct *mm, + unsigned long addr, pmd_t *pmdp, pmd_t pmd) { if (static_branch_likely(&page_table_check_disabled)) return; - __page_table_check_pmd_set(mm, pmdp, pmd); + __page_table_check_pmd_set(mm, addr, pmdp, pmd); } static inline void page_table_check_pud_set(struct mm_struct *mm, @@ -131,7 +133,8 @@ static inline void page_table_check_ptes_set(struct mm_struct *mm, { } -static inline void page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, +static inline void page_table_check_pmd_set(struct mm_struct *mm, + unsigned long addr, pmd_t *pmdp, pmd_t pmd) { } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 75167537ebd7..7b9d7b45505d 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -197,7 +197,8 @@ void __page_table_check_ptes_set(struct mm_struct *mm, pte_t *ptep, pte_t pte, } EXPORT_SYMBOL(__page_table_check_ptes_set); -void __page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t pmd) +void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, + pmd_t *pmdp, pmd_t pmd) { if (&init_mm == mm) return; From patchwork Thu Mar 28 04:55:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 156F5C54E64 for ; Thu, 28 Mar 2024 04:57:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4FB56B0087; Thu, 28 Mar 2024 00:57:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A01766B0088; Thu, 28 Mar 2024 00:57:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C8B76B0089; Thu, 28 Mar 2024 00:57:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6F4D26B0087 for ; Thu, 28 Mar 2024 00:57:10 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 39757120FB3 for ; Thu, 28 Mar 2024 04:57:10 +0000 (UTC) X-FDA: 81945238620.09.473188A Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf14.hostedemail.com (Postfix) with ESMTP id D9DC410000A for ; Thu, 28 Mar 2024 04:57:07 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=D3MEKz08; spf=pass (imf14.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711601828; a=rsa-sha256; cv=none; b=26mkMfkwT8yttrSql+12MwGLo1x1ZeLkeSxwTvsUU7ztQpvYcTpni6/pYzZVIdAwf4XmB3 Pgok+ZTsvYqjyaKBtn42d6ew0E6mvtzN/ptGXn5iJOItEA4OGFPbZ5tPYYXZD20OY/4son M0K/FWqKVSDsCkr01tmWV/WVZRP9024= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=D3MEKz08; spf=pass (imf14.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711601828; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8GnL45S9ZSlCadCtmMUh4ukk0f2xbhyKrX3pRlHvFeE=; b=Z2oYVFT15PpHDEex+ETXSznEMOqHMdUQkqU2OgOFFZoHQDZhi1Sb/+BylRr9KhL0tibBzj k6oVQJ0hRtmL90NqqWcavXCQtX6P/PGFpLKxhuO6tS2SCefKuZ1/cdCMMv8eMdNMI47SwT 2mZBvUKydT3zrO8a05XVYP/HJEnM4po= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4cSxw029060; Thu, 28 Mar 2024 04:56:59 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=8GnL45S9ZSlCadCtmMUh4ukk0f2xbhyKrX3pRlHvFeE=; b=D3MEKz08jrX+s6cI33mmf7uoQnE6kKJXIEak0aA/Mr07wb9YOqCkP0BM0GH9n2LJ3VtZ gHCPcAo96i0DqdFJAuvMMYUVuKrfhHVi7KYaBvcFrTCHXUmy2wcTZ5DrO/0UkVoyy8Yf Xg4tDoFD+dHdFYiVl/WbIqAcdOxIqApsQQEW/obXHeEMWabsqYH580pR5RLvwPbXs6in 7HMFqmC4oV/B0zqTATib/eDB/gb5e17Oh48twnKgi649KWbxe2XUHozRksxd+2Cw6P+S rt2RyUk8psGgwq6x+rJdbqAUbeLNDQHGUgVym2DcvbVr3xyZyzvNOp0YTO4Of97pHOyy mg== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x509tg7fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:56:58 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4TSaZ025458; Thu, 28 Mar 2024 04:56:56 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x2awn37tg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:56:56 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4uqVs42008834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:56:54 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04CC32004E; Thu, 28 Mar 2024 04:56:52 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 280622004B; Thu, 28 Mar 2024 04:56:51 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:56:51 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id BD8B460112; Thu, 28 Mar 2024 15:56:45 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 04/11] Revert "mm/page_table_check: remove unused parameter in [__]page_table_check_pud_clear" Date: Thu, 28 Mar 2024 15:55:24 +1100 Message-ID: <20240328045535.194800-7-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: iMthdwUzRshaNz5hMzAoYyn0wPQwGBo7 X-Proofpoint-ORIG-GUID: iMthdwUzRshaNz5hMzAoYyn0wPQwGBo7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 bulkscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280028 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D9DC410000A X-Stat-Signature: uorkudifp6c4sijdyg5kmhxxrnozogft X-Rspam-User: X-HE-Tag: 1711601827-877627 X-HE-Meta: U2FsdGVkX1/DGy4YYcWnjoUqXKIppMqZxuMidYdB+o1A4zvisPefRhKKBucHm378r7cd/nlvP816zCopvvl7IU1T8eywh+5QOvLn27/opMEWCoLaBAKcb5iMffgtkrO/H5CxiUPHY91UhQmOQWlqTTspCOhqBC1mCfLM1EF1HDIgNsZDH74Y2NMUC6wC4AR76Cs0alhlhihYuSlg2vEQ/vNqhpxtnZgsuOzHjfReaRzvHYfxywciM2f2Si/KulnzcTGRtDizTMnNYbOWjKt0zFEvSjDF1KITVlDr450X/aYpB854r57XUTMroG0JOpU+YuEwJUMocygH4icmOu9FQ/KIwLHvV6bbQnRw9n7mzJaaes7BRrOnTSbfgwzsLgw4ViDIR+T8RR45rXn65b7nVxmJEpBTkkrx3zWlZ3sFhIs+0Zxzkw2GEZ1SnTIv2M0NjybtasokPvYBIlYjlyHfjJcWn+Kc9SYNbz1BHrQS62cEASIcvmkQfRKYVB3A+18TUofthVTe0wCKyl8pKT3uAPARw0Hm8aGsV116tXKidpK5Eq3Z2eCxdhZtHhWpFAiC2+HlvXFetc4xuxFx/7jAt5424ebQkwos+3J+NQtcZinz4hF1o+Kd5KJ1rAI23L+sv//1W1FNFzp8bgoMJsyWAZyUe5t3UJ1s5rZmDHUr5dTs078h5pOPGJOtCDD3LRuUvCLgcNyQnR3iAo/PBsvOxoZV+ZA+sOBYuRN0P0gz9VvjgQ7RoqFanRuFzXqEGfgyNY0C76RnnAQxb86yyl8d+zGnyRscDIXGFewRi17GXHUhfnaloo+4dBGOm5J1uUWPxNZgzgzBORxlj3z7xAYd2sd+dlh+gR7bG9nzw9itOdVWeHjZJmh9HL9Hf3I3NBwrNKlcASi7epUlArZD+vmUHNx/1KnZmhFfw9Es341ESrhORu2mFo9+tXfIz3Rmu8B2Eh8sF0p/Jv8knbAqVWw HHQkc3Cs GwiAClEv3NDU768Fa/7Jcra5nAlYEb5ozlgmXa9ky0Eey+RlcSnUTxYYBHj3b/R+VBnAHIh/f8hSEihzpqGrCBWi85pnYmvobR23Me3zzoxHpSpfXdxcW2Xp//ZzzarRjnXluDd4GA4+hcbndVFHdfYqIt9IykJ2iO9LANx2oxYvjo5LO4O8SKtr51c3Bo3FRUbP6EskiqyJmJPOlM2wzk5otD2R4+Hy/7UvNY3Wj9Z+AQvsti2+xP4IkTWQ3jnsROGOlw8iB4tM60Is= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This reverts commit 931c38e16499a057e30a3033f4d6a9c242f0f156. Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but instead in the address of the access. Signed-off-by: Rohan McLure --- arch/x86/include/asm/pgtable.h | 2 +- include/linux/page_table_check.h | 11 +++++++---- include/linux/pgtable.h | 2 +- mm/page_table_check.c | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 82bbe115a1a4..e35b2b4f5ea1 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1356,7 +1356,7 @@ static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, { pud_t pud = native_pudp_get_and_clear(pudp); - page_table_check_pud_clear(mm, pud); + page_table_check_pud_clear(mm, addr, pud); return pud; } diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h index 9243c920ed02..d01a00ffc1f9 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -16,7 +16,8 @@ extern struct page_ext_operations page_table_check_ops; void __page_table_check_zero(struct page *page, unsigned int order); void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte); void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd); -void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud); +void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, + pud_t pud); void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned int nr); void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, @@ -59,12 +60,13 @@ static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) __page_table_check_pmd_clear(mm, pmd); } -static inline void page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) +static inline void page_table_check_pud_clear(struct mm_struct *mm, + unsigned long addr, pud_t pud) { if (static_branch_likely(&page_table_check_disabled)) return; - __page_table_check_pud_clear(mm, pud); + __page_table_check_pud_clear(mm, addr, pud); } static inline void page_table_check_ptes_set(struct mm_struct *mm, @@ -125,7 +127,8 @@ static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) { } -static inline void page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) +static inline void page_table_check_pud_clear(struct mm_struct *mm, + unsigned long addr, pud_t pud) { } diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index b2b4c1160d4a..6a5c44c2208e 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -570,7 +570,7 @@ static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, pud_t pud = *pudp; pud_clear(pudp); - page_table_check_pud_clear(mm, pud); + page_table_check_pud_clear(mm, address, pud); return pud; } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 3a338fee6d00..a8c8fd7f06f8 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -171,7 +171,8 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) } EXPORT_SYMBOL(__page_table_check_pmd_clear); -void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) +void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, + pud_t pud) { if (&init_mm == mm) return; @@ -217,7 +218,7 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, if (&init_mm == mm) return; - __page_table_check_pud_clear(mm, *pudp); + __page_table_check_pud_clear(mm, addr, *pudp); if (pud_user_accessible_page(pud)) { page_table_check_set(pud_pfn(pud), PUD_SIZE >> PAGE_SHIFT, pud_write(pud)); From patchwork Thu Mar 28 04:55:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4276CD1280 for ; Thu, 28 Mar 2024 04:57:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34E4A6B0089; Thu, 28 Mar 2024 00:57:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FB646B008A; Thu, 28 Mar 2024 00:57:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19CB86B008C; Thu, 28 Mar 2024 00:57:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E8D956B0089 for ; Thu, 28 Mar 2024 00:57:12 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A0B1E80F1A for ; Thu, 28 Mar 2024 04:57:12 +0000 (UTC) X-FDA: 81945238704.11.90575E2 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf11.hostedemail.com (Postfix) with ESMTP id 58DF340010 for ; Thu, 28 Mar 2024 04:57:10 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=mhOO9Qif; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf11.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711601830; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+k6vsLec1pcg2vE2qJpdFE2QORhER0/WgwCnGamDgpg=; b=lQJbinfCxPcimu5oz6snD4OM4WTaVshgdYF6zrv6YdN1AKDZZI8Xar+PdnD6Ihrv9cXQHe QwYp9xR/A8Z9XToXmcryorIhnM5ytmF0x4KgNIsNgYJStoETJ9ll3J+ZSbCzlS5sf8P4X4 ZFtViCVPxzXaRB0qFO3LicSzgmTHVFM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=mhOO9Qif; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf11.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711601830; a=rsa-sha256; cv=none; b=WI1tnJaRfQw422zKNw0VjU5l2mwn/VX+2/h0D4LKPTCxC89nMiPtofu0thza1W5cNxIH/q zViBhA1CMq+FmUVnH2a/UEgUpzAFe9LFcfhTtkqlxX9MtQjFrk7FU7KJnfa8Hwdv59Lhr3 SwSOADFBzZscxON20gRcso0TqhX61+8= Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4RTA0012155; Thu, 28 Mar 2024 04:57:02 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=+k6vsLec1pcg2vE2qJpdFE2QORhER0/WgwCnGamDgpg=; b=mhOO9Qif0VHAbJS0c0Qp4H2UDoYL5E4Ld3W/7U2v5KUCvM92dJN5x+gmrPMgg+sZj8lc VgtEBypRTFJEmiGS/ROT0CPC7ZpYpilVd+BVFSo55PzdhhmS47vp4+8vEEV7CMLp8vvR JUY19XPruZ9aNTvYKExTn/LDjWUFYYtbRX7mzY1TM1/mNKlSKTwPA2pHatHDG3qCLh3p HiMOgWHMzAXxvwt8BfXKau6lqg3ZvS3Hf5KoIlyqOhidaBSl9ByR+grPlMGCMlWfRd6n KOCnYEgYBqVfgZt7Sbg10FSfWtqy5xZmBVkGd63itryfDnIetimSUrrwksJoO5sAWlwp pg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x51hj01y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:02 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4eOoj028650; Thu, 28 Mar 2024 04:57:01 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x2adpkbqm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:00 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4uuHp32506280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:56:59 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C43322004F; Thu, 28 Mar 2024 04:56:56 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E6AB32004D; Thu, 28 Mar 2024 04:56:55 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:56:55 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 7C49760429; Thu, 28 Mar 2024 15:56:50 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 05/11] Revert "mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_clear" Date: Thu, 28 Mar 2024 15:55:25 +1100 Message-ID: <20240328045535.194800-8-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: l_TYlGBAizY8qd4jQ3qAEWGlP1Lv1m6t X-Proofpoint-ORIG-GUID: l_TYlGBAizY8qd4jQ3qAEWGlP1Lv1m6t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 mlxscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280028 X-Rspamd-Queue-Id: 58DF340010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: d6wqjktyoshdazkhtcmxb1n4tza5px7f X-HE-Tag: 1711601830-631843 X-HE-Meta: U2FsdGVkX1/Nx5oBP7hkc2c4ENMQHkjnxS9we3zdeHRbajB8iG6G9RF36/kz2j8PZqcGhy+yefQ6ews6DGAQ35U3l3qr1w8Qe/EA7lxvHBZkTIW6UDbTJgZLdkIp5GuElZS+nSAEzqWCnBcg/rM18GaK5CzLqyNJQCv9UHpr322c9gtcXsH8aRoxv5uld8Y+9SxZJItZq/69uobjk6tMAV1Ca0Hmxh1v5wAtHRSSF7E09AuMqTDvlepTduon2MKiQHWwtr5gkewmDYTJnU5SPM2rJ+mPhaEAylA16uyYQS9dHSXH/2UxUzrG7NHNrsNkq6N7IsQXl1X8dKrpMphtCqnbhqalP7hNmkarP3L32lOzp8W3inxulxUDPN5itXUETLSjGNYeWRJs3NJ+265wLB0M8L5Omnf7VyheHn6u2722OXI2+zXnp0+Y41VNIN7pU4oId6aT+wt9Md0wBqlWjRIehUMwptdICau3NLqJT/imydh9xwQ7NBxpQ6cPczDfw2eYrG2t9c1qeH/qdUVHo3jraNX3GzIIsw3BTvC2wTMqDyHRQBVHGinWkD560+8BqyW+Sy9QXYHDILE4Xn4YTc1lTRTyZaGJa30L3rr3oPzS16+aAg/xp0N3VBLPCWo5aBrvjtXETfXxqZt10gFTehC2qkm+x2A45TyozNEohrOIw76fp8BqYiXn/5OdET2YSh9YWIV+oI1CxxVxR1RShK6rKYuj0asPjgT3FlyNIstB7cikhBeZ3zMmzbQTZsq16BN/ldC19/5zBkfeTATmpoceHNFRfMmwGPqgQkuFonZoliBRaW6YbSq8i6EdAJvk/1e2acJETZf1bAJO2cGyYEggOa2ZsySBmkiCvYPGOPd2s9bd+nEdrjZIM6MskwjKCEdzJhwDGKeHlVQTkK1RS0ehlF5Mo1e8OpK7kC3ltML6Ffll75HePuqf2+mjUUwU/XDdUfzQmd+DDmpRPWX jl4JFJ3o ldzWeysfLksqqnUByDW8I9lTfPp/0FRGquSC7Fai3iEk3Lc4mI1bj5gmanT/GyqyaB2hgmvz6x1DRZq7SWYK5usGODE8T5LzDyNvwdHFT1O8QNYBIwUOf0nJup0FhS/bdlkeTyEashbjsaJ3WqxqEPB1W2Wbflp33oe963FK5jTD7MDG1iYWRQPsveupmlKmWTken5iAUNwcDryHFDCB6zD8eGyKt7BxpSGfjmspjRZ99+F8a4WVzjiq95LDKwmwzvTURpkR78jSlsmo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This reverts commit 1831414cd729a34af937d56ad684a66599de6344. Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but instead in the address of the access. Signed-off-by: Rohan McLure --- arch/arm64/include/asm/pgtable.h | 2 +- arch/riscv/include/asm/pgtable.h | 2 +- arch/x86/include/asm/pgtable.h | 2 +- include/linux/page_table_check.h | 11 +++++++---- include/linux/pgtable.h | 2 +- mm/page_table_check.c | 5 +++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index b3938f80a1b6..d20afcfae530 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1188,7 +1188,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, { pmd_t pmd = __pmd(xchg_relaxed(&pmd_val(*pmdp), 0)); - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, address, pmd); return pmd; } diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index a153d3d143d2..0066626159a5 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -767,7 +767,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, { pmd_t pmd = __pmd(atomic_long_xchg((atomic_long_t *)pmdp, 0)); - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, address, pmd); return pmd; } diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index e35b2b4f5ea1..9876e6d92799 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1345,7 +1345,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long { pmd_t pmd = native_pmdp_get_and_clear(pmdp); - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, addr, pmd); return pmd; } diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h index d01a00ffc1f9..0a6ebfa46a31 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -15,7 +15,8 @@ extern struct page_ext_operations page_table_check_ops; void __page_table_check_zero(struct page *page, unsigned int order); void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte); -void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd); +void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, + pmd_t pmd); void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, pud_t pud); void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr, @@ -52,12 +53,13 @@ static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) __page_table_check_pte_clear(mm, pte); } -static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) +static inline void page_table_check_pmd_clear(struct mm_struct *mm, + unsigned long addr, pmd_t pmd) { if (static_branch_likely(&page_table_check_disabled)) return; - __page_table_check_pmd_clear(mm, pmd); + __page_table_check_pmd_clear(mm, addr, pmd); } static inline void page_table_check_pud_clear(struct mm_struct *mm, @@ -123,7 +125,8 @@ static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) { } -static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) +static inline void page_table_check_pmd_clear(struct mm_struct *mm, + unsigned long addr, pmd_t pmd) { } diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 6a5c44c2208e..d17fbca4da7b 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -557,7 +557,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, pmd_t pmd = *pmdp; pmd_clear(pmdp); - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, address, pmd); return pmd; } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index a8c8fd7f06f8..7afaad9c6e6f 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -160,7 +160,8 @@ void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) } EXPORT_SYMBOL(__page_table_check_pte_clear); -void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) +void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, + pmd_t pmd) { if (&init_mm == mm) return; @@ -204,7 +205,7 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, if (&init_mm == mm) return; - __page_table_check_pmd_clear(mm, *pmdp); + __page_table_check_pmd_clear(mm, addr, *pmdp); if (pmd_user_accessible_page(pmd)) { page_table_check_set(pmd_pfn(pmd), PMD_SIZE >> PAGE_SHIFT, pmd_write(pmd)); From patchwork Thu Mar 28 04:55:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64DAEC54E64 for ; Thu, 28 Mar 2024 04:57:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E20DF6B008C; Thu, 28 Mar 2024 00:57:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD1456B0092; Thu, 28 Mar 2024 00:57:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C72926B0095; Thu, 28 Mar 2024 00:57:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AAD236B008C for ; Thu, 28 Mar 2024 00:57:19 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4A813A0F0C for ; Thu, 28 Mar 2024 04:57:19 +0000 (UTC) X-FDA: 81945238998.06.4C86038 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf03.hostedemail.com (Postfix) with ESMTP id 057102000C for ; Thu, 28 Mar 2024 04:57:16 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="D9tnDe/D"; spf=pass (imf03.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711601837; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Gsw+Y1Ht68D9tInl8Z5fv44Uyk9Xck/bnI47iO61y1A=; b=ZKCnEegX7CWQcKIzI0P10u1JdUJrrlDm7QO8+FTPZckNYC8vAXSnqy0AaKFui38VAb78B5 ssfqZnObLJ2riZ9Ff/VV1t5fxX2RsHsHzYC7QIOU/BF3PWKfNjQQp8ZLD0n1hJ39nc+qhS 3mn0nezPf/idzHtG01OaKNCaHaNvqwE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711601837; a=rsa-sha256; cv=none; b=EsLhkh0Z6WEpXywUEzu+aD2dA1u4+6cmUpPvVaP9i7wp7vtIC9madepYQfPclTHLLH6Joo TDx2ptG6j8LbPkdeIBUM8JgXYOU3g+7CaUf4j1oEItqUjBTb8ubNzWm+HoSH4VAvuHhiV4 H1JwygG0dK/641YFPHeXzejrK05Mh8g= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="D9tnDe/D"; spf=pass (imf03.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4SVIV014036; Thu, 28 Mar 2024 04:57:07 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=Gsw+Y1Ht68D9tInl8Z5fv44Uyk9Xck/bnI47iO61y1A=; b=D9tnDe/DKbtHe+AOzcJZcMeSLcBj736QqrTce4zW5anqlU8+mHcNPyjxEdaTY3n7av1l UlqJNsDsnfn+8141q5M5dM7ZYQ06dlNaTQ4GB3Ag8y/Ld+hbMjTKxknBFV2UWeQSblCE NxgwqDgF6hVix+Km0aaPd/GWvH6oFaB866jrjnxhz3ZZe7XCxpbFfWDWlmRGkVTk6q5L 6jR6UuPPNO/K66PvWzzC6i6dpGcOgGE+xZi5JCU1m97jRzBZtJf1fkzEONalnGaXosdA BeXlZo230S1M9AE6tGK28MrHUc2T6oj2oOVmQHw+5Vci7L68JdVMpf8IIH5Fm7hUZ40i NA== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x51hj01yg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:06 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4qwSn025482; Thu, 28 Mar 2024 04:57:05 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x2awn37tu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:05 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4v1MJ49021236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:57:03 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 809562004E; Thu, 28 Mar 2024 04:57:01 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A201B2004B; Thu, 28 Mar 2024 04:57:00 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:57:00 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 3BF5E600C9; Thu, 28 Mar 2024 15:56:54 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 06/11] Revert "mm/page_table_check: remove unused parameter in [__]page_table_check_pte_clear" Date: Thu, 28 Mar 2024 15:55:26 +1100 Message-ID: <20240328045535.194800-9-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: j-0dPpIyhZyLAfAfM_1sTzF5V7Z9zWwN X-Proofpoint-ORIG-GUID: j-0dPpIyhZyLAfAfM_1sTzF5V7Z9zWwN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=762 bulkscore=0 impostorscore=0 mlxscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280028 X-Rspamd-Queue-Id: 057102000C X-Rspam-User: X-Stat-Signature: 7fqqrwanhox3o7h4ejqt9e1wpt4dnogz X-Rspamd-Server: rspam03 X-HE-Tag: 1711601836-479250 X-HE-Meta: U2FsdGVkX18fU0iKC+68j49UJdm8Dgnht6NDAiG5m0gauQODRrQTkH1J0rjJ//ruo4xw0Ue/0Y67BD5jTG7XKFRI8CoEktedyI5EAu1kWQEnVOT0ClEHcdrtVPbJGb9DM1rGUr8POzrxxITU1rcIi71QoreNh3kdl2KjgHLRKnwIVFAV+l36tOOosRwM/nDvKRXHLMt0WDrjv4FavWEZ3E26VsqKMoZQgcQCY49OaTjpttdBVk3eVMe+yPA4ZLfK2lYOmpAfj413rUoI0Nh7jpvaPM/sgaX/izEJjkKkEvxrYXHmG/+XHAgvt9GJZjcg1bQ5sTdD24sigvHRTecfuZg0EOnjw14DEZ31/8DAviW9o1H2RoieZsQoAt8GxLms7UZuxlKz/C38WscLanNiX7zbgvBqWb3MIHnxGMd2sEPMG6RgPmilAN43Dmy3puhi/ObRiTedf0Aic/jNwpdaO6YwN7yuMAamsEJf/SHUyvz1z1MJnYFV1YBeSLPmW+Q3NnyslrGIpOUTrseRfVF55y4e6xHMI2GqKBRWEfq5nj+Fdy6tcdrYTBIYxRlTqs8TNF2w6S+u2Dr47+dUD+Zdllk0vzLG2CksstDU/lisPeGDsHPuxaYZ4NHWgXyujqgZ/BwiIZTfXUixMVn2bo6mWcVfkIs+vT6azAVyj6nWA0i/SrYgym6+P5jo9a1dKcIZRyY+hJ+wERVtwgHZgmppE2XAGyQ8nHovqyNfmWG9Tsc7K8swZ1qAdQZa0ePZ4RllNRJ3LJ4TxoHwjG3/YQTxWyDyAx7VwO+X0AIHDsXyb6A/7hN+FMNnNEhvsT4DCFcRXEbu3nnMMS6E9hZqkjU0zwxfKJPNprfA870zng0kue/4QZA0w8mWbklhDfZNDS9n7U6xtkmJS/Za+3gGAa3G0CaeUoMgWn6t6xuYL6ublQPz2Iq11sp3NwtSwXSnfR2HiAvX1fm6IU67pa+9+Uk rnSdzOKf apmnNLrhKzJFGX7zfO8yjEISvUV4sqM9hIlElHrmFWl3jOrUl6L1cFr2D4MhmsGg950Rvb9PHtQghIsBpeOJvG4LrKgTt0BdX6IEGd9ObZSkg8vHd0wFSjo/yvMEYCxD9papoESav4uW165tqsb94epWVqqXpAW96eoCNyLV0m2/oElc5em2jU6haq0dONnW6RfvdB5IhaFKreqtEdOrbd1AUTDSs1L+jI/50pHeTL6+xOA0iTtEw6mjYwzN7R0kyQMoVH5Qx8RWcHCc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This reverts commit aa232204c4689427cefa55fe975692b57291523a. Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but instead in the address of the access. Signed-off-by: Rohan McLure --- arch/arm64/include/asm/pgtable.h | 2 +- arch/riscv/include/asm/pgtable.h | 2 +- arch/x86/include/asm/pgtable.h | 4 ++-- include/linux/page_table_check.h | 11 +++++++---- include/linux/pgtable.h | 2 +- mm/page_table_check.c | 7 ++++--- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index d20afcfae530..040c2e664cff 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1145,7 +1145,7 @@ static inline pte_t __ptep_get_and_clear(struct mm_struct *mm, { pte_t pte = __pte(xchg_relaxed(&pte_val(*ptep), 0)); - page_table_check_pte_clear(mm, pte); + page_table_check_pte_clear(mm, address, pte); return pte; } diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 0066626159a5..92bf5c309055 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -563,7 +563,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, { pte_t pte = __pte(atomic_long_xchg((atomic_long_t *)ptep, 0)); - page_table_check_pte_clear(mm, pte); + page_table_check_pte_clear(mm, address, pte); return pte; } diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 9876e6d92799..b2b3902f8df4 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1276,7 +1276,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_t pte = native_ptep_get_and_clear(ptep); - page_table_check_pte_clear(mm, pte); + page_table_check_pte_clear(mm, addr, pte); return pte; } @@ -1292,7 +1292,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, * care about updates and native needs no locking */ pte = native_local_ptep_get_and_clear(ptep); - page_table_check_pte_clear(mm, pte); + page_table_check_pte_clear(mm, addr, pte); } else { pte = ptep_get_and_clear(mm, addr, ptep); } diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h index 0a6ebfa46a31..48721a4a2b84 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -14,7 +14,8 @@ extern struct static_key_true page_table_check_disabled; extern struct page_ext_operations page_table_check_ops; void __page_table_check_zero(struct page *page, unsigned int order); -void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte); +void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr, + pte_t pte); void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, pmd_t pmd); void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, @@ -45,12 +46,13 @@ static inline void page_table_check_free(struct page *page, unsigned int order) __page_table_check_zero(page, order); } -static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) +static inline void page_table_check_pte_clear(struct mm_struct *mm, + unsigned long addr, pte_t pte) { if (static_branch_likely(&page_table_check_disabled)) return; - __page_table_check_pte_clear(mm, pte); + __page_table_check_pte_clear(mm, addr, pte); } static inline void page_table_check_pmd_clear(struct mm_struct *mm, @@ -121,7 +123,8 @@ static inline void page_table_check_free(struct page *page, unsigned int order) { } -static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) +static inline void page_table_check_pte_clear(struct mm_struct *mm, + unsigned long addr, pte_t pte) { } diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index d17fbca4da7b..7c18a1e55696 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -454,7 +454,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, { pte_t pte = ptep_get(ptep); pte_clear(mm, address, ptep); - page_table_check_pte_clear(mm, pte); + page_table_check_pte_clear(mm, address, pte); return pte; } #endif diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 7afaad9c6e6f..98cccee74b02 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -149,7 +149,8 @@ void __page_table_check_zero(struct page *page, unsigned int order) page_ext_put(page_ext); } -void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) +void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr, + pte_t pte) { if (&init_mm == mm) return; @@ -193,7 +194,7 @@ void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr, return; for (i = 0; i < nr; i++) - __page_table_check_pte_clear(mm, ptep_get(ptep + i)); + __page_table_check_pte_clear(mm, addr, ptep_get(ptep + i)); if (pte_user_accessible_page(pte)) page_table_check_set(pte_pfn(pte), nr, pte_write(pte)); } @@ -241,7 +242,7 @@ void __page_table_check_pte_clear_range(struct mm_struct *mm, if (WARN_ON(!ptep)) return; for (i = 0; i < PTRS_PER_PTE; i++) { - __page_table_check_pte_clear(mm, ptep_get(ptep)); + __page_table_check_pte_clear(mm, addr, ptep_get(ptep)); addr += PAGE_SIZE; ptep++; } From patchwork Thu Mar 28 04:55:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89559C54E67 for ; Thu, 28 Mar 2024 04:57:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19F416B0095; Thu, 28 Mar 2024 00:57:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 150EE6B0096; Thu, 28 Mar 2024 00:57:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E95326B0098; Thu, 28 Mar 2024 00:57:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BD0C16B0095 for ; Thu, 28 Mar 2024 00:57:21 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8F8CDA0F01 for ; Thu, 28 Mar 2024 04:57:21 +0000 (UTC) X-FDA: 81945239082.09.789825C Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf29.hostedemail.com (Postfix) with ESMTP id 771C212000B for ; Thu, 28 Mar 2024 04:57:19 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="ZF/Df8cA"; spf=pass (imf29.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711601839; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=l64yPSCJgp+48IGOZHO1jI/AZ1J5HFNmmvqOu9zpdzY=; b=L6l0S4tmkRbtCpSLbKuBiiPUOTATyfxr44+nP0BBn+1koCys5rcQBnu/0K7GYey2eMgc+0 Oz4nAUWxvOZk0C1NsAtDNzFagGfVOkQxNrFyDrWPNn/3frLZD7joLuaWWomdh2eskc/Cq/ kh87bl8FevEy3QV0vTvMQzJmz5f8wPI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711601839; a=rsa-sha256; cv=none; b=fgE7rAGeskuKUymPAsb55YJynsQ9wgBTbD1z5lhtNyJpiEgn4YCGKuKCB8cLPWKNqtvJeG Xh1KgWi5B6bNQH7898xV3FLRs8XD2KcsMktDO1Vw4Cuxiep6PqRQY2KExJTJm5DT+cIMMa J7GOa/U5OuHiRfumJbkuUzDCFRnAa24= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b="ZF/Df8cA"; spf=pass (imf29.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4RDJi012038; Thu, 28 Mar 2024 04:57:11 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=l64yPSCJgp+48IGOZHO1jI/AZ1J5HFNmmvqOu9zpdzY=; b=ZF/Df8cA37+pPlzgsQw61a0pwYimWTvMRZ69SKAtl6qZTPOSCi+Giahm+q8T6n5Tsh2j C0gIsTKdcMqEta9rCkQDWWlI0jWbQmj9p9WeFnVroI2cv9UjpgFdU39IDEKVKE0NOTKY yG515ihaIxC748NM8ohknzzvmwVDcIOoo5JB3gldMM6bvDqjjkNYeBqo2xvEvquo3MQJ 9VpJjoL6TDu+J3md8IpSxJYClLRhJIAKBgXvDK2CDSudSvr/LoeaDz9HnkJQJjmLjlfO fzVCprRHCR0mbTzYH57q5m+PjAq0Wm1g9xTZsPOirxbADljrWAT87N7QTuqEFP1Lscxd mQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x51hj01ym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:11 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4oUTu028623; Thu, 28 Mar 2024 04:57:10 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x2adpkbr5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:10 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4v6Od28442960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:57:08 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 321942004F; Thu, 28 Mar 2024 04:57:06 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 57C6E20040; Thu, 28 Mar 2024 04:57:05 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:57:05 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id F084A60112; Thu, 28 Mar 2024 15:56:59 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 07/11] mm: Provide address parameter to p{te,md,ud}_user_accessible_page() Date: Thu, 28 Mar 2024 15:55:27 +1100 Message-ID: <20240328045535.194800-10-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: uzvN9eFF5Z58EeH43-44EA_3Px-Atzgq X-Proofpoint-ORIG-GUID: uzvN9eFF5Z58EeH43-44EA_3Px-Atzgq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=941 bulkscore=0 impostorscore=0 mlxscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280028 X-Rspamd-Queue-Id: 771C212000B X-Rspam-User: X-Stat-Signature: 8o141fb8wditib55akanhsemite6tnxh X-Rspamd-Server: rspam03 X-HE-Tag: 1711601839-674245 X-HE-Meta: U2FsdGVkX18McuehlGMlf3IUb3g78d5Mc+a+t1I9egy8dIGgU7hBCYUoH7wtTAgXohTICOlGGo6isUQUAamwelQk+/FnCWk9wkyO0GVT3CYTqT62F1aUuME12FX5RrHfP2sc98/bDI+fFjJvWfQCEINRBRysg3ii7B0w5rRKbt+Ngg5xwWv+c1MyAYRT3zKN1NLH4cM/IvHd1BtGT1DDazYUOhUSEiJQeergkd7f5Kd2icEIGnER5jnlKaV2gsKzJ3bj3EVURztBaNRs6iEvxajIOTMRCx6e03ZZFcyezY7/SA2iSAmPrtq8z5Ngaz5fNua9jPF7LuvjJwfB6G5KYh4rua9v64xp4hQeULSLLCXjQST4X0w+xEjkAp3CZrrcW6UrnEwwiU9uO0cik+KKE9xAFOvPghg91ssOqrxwO/4otybciIVoYtd14xJeMa+5+4EDchUZBQrvZ45N7GNTE0Ww0fOn0Akuf0ZE+Wvx9c7oFkB9llygDIh5RFDW/J1tB4orKz4lskj5dm843tPx3bkYp0Dx5FZcLcFd0uvZlsAmrego+5bvuYDLupnxi/qBbeppiZdIZ8ToP9bTaeQ1AdbxN7eCkbztckSMbf0go8EXr6ENVZOk3jEZwcN7gqFsyT3lFCyrwQyu5z8HNr4LOjIJDNwt0eomDr0zQ2jIMfUPDX9u9bZhY4ldHgXkT/7smsN3ucd01kvAZzElOojUk//koc/wyTfBQZFdXBXch/ci5wL/7eHYba78VdghD0VCJMx/PEWNIJv2kKQtGy34+iumPOI1K7VBFSSmW+UsjC87/YkAQUZNXaICbEujH333sgXSbtq8fyQpN/cLN/obatG3zvuhQLq7mJ5IiAva0NXqCxe1jXluDOWZb2sHKVTlIEo2gmNT3/Jwxoje4sX8aDEt56a2epZC5FjSFLvZHAjjmznwESnKC4ZxBViGTASEdkSgv28ot0Y= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On several powerpc platforms, a page table entry may not imply whether the relevant mapping is for userspace or kernelspace. Instead, such platforms infer this by the address which is being accessed. Add an additional address argument to each of these routines in order to provide support for page table check on powerpc. Signed-off-by: Rohan McLure --- arch/arm64/include/asm/pgtable.h | 6 +++--- arch/riscv/include/asm/pgtable.h | 6 +++--- arch/x86/include/asm/pgtable.h | 6 +++--- mm/page_table_check.c | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 040c2e664cff..f698b30463f3 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1074,17 +1074,17 @@ static inline int pgd_devmap(pgd_t pgd) #endif #ifdef CONFIG_PAGE_TABLE_CHECK -static inline bool pte_user_accessible_page(pte_t pte) +static inline bool pte_user_accessible_page(pte_t pte, unsigned long addr) { return pte_present(pte) && (pte_user(pte) || pte_user_exec(pte)); } -static inline bool pmd_user_accessible_page(pmd_t pmd) +static inline bool pmd_user_accessible_page(pmd_t pmd, unsigned long addr) { return pmd_leaf(pmd) && !pmd_present_invalid(pmd) && (pmd_user(pmd) || pmd_user_exec(pmd)); } -static inline bool pud_user_accessible_page(pud_t pud) +static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr) { return pud_leaf(pud) && (pud_user(pud) || pud_user_exec(pud)); } diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 92bf5c309055..b9663e03475b 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -724,17 +724,17 @@ static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, } #ifdef CONFIG_PAGE_TABLE_CHECK -static inline bool pte_user_accessible_page(pte_t pte) +static inline bool pte_user_accessible_page(pte_t pte, unsigned long addr) { return pte_present(pte) && pte_user(pte); } -static inline bool pmd_user_accessible_page(pmd_t pmd) +static inline bool pmd_user_accessible_page(pmd_t pmd, unsigned long addr) { return pmd_leaf(pmd) && pmd_user(pmd); } -static inline bool pud_user_accessible_page(pud_t pud) +static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr) { return pud_leaf(pud) && pud_user(pud); } diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index b2b3902f8df4..e898813fce01 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1688,17 +1688,17 @@ static inline bool arch_has_hw_nonleaf_pmd_young(void) #endif #ifdef CONFIG_PAGE_TABLE_CHECK -static inline bool pte_user_accessible_page(pte_t pte) +static inline bool pte_user_accessible_page(pte_t pte, unsigned long addr) { return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER); } -static inline bool pmd_user_accessible_page(pmd_t pmd) +static inline bool pmd_user_accessible_page(pmd_t pmd, unsigned long addr) { return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) && (pmd_val(pmd) & _PAGE_USER); } -static inline bool pud_user_accessible_page(pud_t pud) +static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr) { return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) && (pud_val(pud) & _PAGE_USER); } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 98cccee74b02..aa5e16c8328e 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -155,7 +155,7 @@ void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr, if (&init_mm == mm) return; - if (pte_user_accessible_page(pte)) { + if (pte_user_accessible_page(pte, addr)) { page_table_check_clear(pte_pfn(pte), PAGE_SIZE >> PAGE_SHIFT); } } @@ -167,7 +167,7 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, if (&init_mm == mm) return; - if (pmd_user_accessible_page(pmd)) { + if (pmd_user_accessible_page(pmd, addr)) { page_table_check_clear(pmd_pfn(pmd), PMD_SIZE >> PAGE_SHIFT); } } @@ -179,7 +179,7 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, if (&init_mm == mm) return; - if (pud_user_accessible_page(pud)) { + if (pud_user_accessible_page(pud, addr)) { page_table_check_clear(pud_pfn(pud), PUD_SIZE >> PAGE_SHIFT); } } @@ -195,7 +195,7 @@ void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr, for (i = 0; i < nr; i++) __page_table_check_pte_clear(mm, addr, ptep_get(ptep + i)); - if (pte_user_accessible_page(pte)) + if (pte_user_accessible_page(pte, addr)) page_table_check_set(pte_pfn(pte), nr, pte_write(pte)); } EXPORT_SYMBOL(__page_table_check_ptes_set); @@ -207,7 +207,7 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, return; __page_table_check_pmd_clear(mm, addr, *pmdp); - if (pmd_user_accessible_page(pmd)) { + if (pmd_user_accessible_page(pmd, addr)) { page_table_check_set(pmd_pfn(pmd), PMD_SIZE >> PAGE_SHIFT, pmd_write(pmd)); } @@ -221,7 +221,7 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, return; __page_table_check_pud_clear(mm, addr, *pudp); - if (pud_user_accessible_page(pud)) { + if (pud_user_accessible_page(pud, addr)) { page_table_check_set(pud_pfn(pud), PUD_SIZE >> PAGE_SHIFT, pud_write(pud)); } From patchwork Thu Mar 28 04:55:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13607976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6F80C54E67 for ; Thu, 28 Mar 2024 04:57:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71C136B0098; Thu, 28 Mar 2024 00:57:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CCD06B0099; Thu, 28 Mar 2024 00:57:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56DA96B009A; Thu, 28 Mar 2024 00:57:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 397996B0098 for ; Thu, 28 Mar 2024 00:57:43 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C9DC4A07BC for ; Thu, 28 Mar 2024 04:57:42 +0000 (UTC) X-FDA: 81945239964.22.37771D5 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf16.hostedemail.com (Postfix) with ESMTP id 9D5D118000C for ; Thu, 28 Mar 2024 04:57:40 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sOCPv27W; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf16.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711601860; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xcL/IQIOv2OUkgf1WCRrE88EaCpc0gUXU0bMezHPnrw=; b=lnw20RoDrmLFnndoh+4D93+E0Z8nIs8U4IoErGqCopNCyOniSBsd7GNjYFbzj5ZCUfO3dz LkP3+z8p6des7vq0dFU3z/OKIVix2J6DRWjeKOEPV9pfEL1nPaSUuSkBWQktrC2pe5Ux/F aDqO0X2DQ9LW3qQ+RqRDpGTlTzhd6cI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sOCPv27W; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf16.hostedemail.com: domain of rmclure@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rmclure@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711601860; a=rsa-sha256; cv=none; b=q0pCEUUZlC1u41x8u31YbBvtdocgKSgzBQzjUXYoEyiyzkvhq50F3wE/eV5GL5ZcVhFcyS /rqWw40ACAr/KxDK9mif/IJjngf6E6zkimECxWNIvyOoT3OeF1floIrEPthKRqZD09R7th 7ywzE29eh5ESWmeQy3NvqNXDfaJnzK4= Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42S4SM3i013956; Thu, 28 Mar 2024 04:57: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=xcL/IQIOv2OUkgf1WCRrE88EaCpc0gUXU0bMezHPnrw=; b=sOCPv27WjKaOnrb/zKhXw1nndgf0+yCsThhQlUG4ClDwe7jE8/TmGBkr+Ti/P6fPwvQc IYzOoqr+9VzKSPvqeFlt43rmPYptZrT5RkEcuqy0WU/Sunx2cQrU1j0+yV+OHGyzTINI awadIKRJemZ8z1I6y021+CR7mL1cIqRZkLm0rrQX1ZMuK7w7T18IdNH1WMy5gpavhzLB qP5PDg9MXZyx6uM+2PfVbq6Gk0P2H4bm7uf7HDVhmv+ee1v3H/ovSYcUP+EgE6RM2yw9 p1KdRw/78QbhTL+Gn0SVkz9KPrT/cYy9rDkTz1xyqSoEprIMTGyHIjbLfyxGzAqHiS+l Wg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3x51hj020c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:29 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 42S3ktYS016605; Thu, 28 Mar 2024 04:57:28 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3x29dubp74-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Mar 2024 04:57:28 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42S4vPD542271138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2024 04:57:27 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26F572004E; Thu, 28 Mar 2024 04:57:25 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 474D420043; Thu, 28 Mar 2024 04:57:24 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Mar 2024 04:57:24 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.66.88.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id D67A760112; Thu, 28 Mar 2024 15:57:18 +1100 (AEDT) From: Rohan McLure To: linuxppc-dev@lists.ozlabs.org Cc: Rohan McLure , mpe@ellerman.id.au, christophe.leroy@csgroup.eu, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v11 11/11] powerpc: mm: Support page table check Date: Thu, 28 Mar 2024 15:55:31 +1100 Message-ID: <20240328045535.194800-14-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328045535.194800-3-rmclure@linux.ibm.com> References: <20240328045535.194800-3-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZoK1JV8bt85Eo4bOTNwkAuPLxaU6rIo- X-Proofpoint-ORIG-GUID: ZoK1JV8bt85Eo4bOTNwkAuPLxaU6rIo- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_04,2024-03-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=764 bulkscore=0 impostorscore=0 mlxscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403280028 X-Rspamd-Queue-Id: 9D5D118000C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: qieqkuxm5hdeat3srndqpcam3mnwsxqp X-HE-Tag: 1711601860-997875 X-HE-Meta: U2FsdGVkX18fH7b09Ulznsd+jcspPu69zsO1W1XklZFn//T82mAl87gwCgcKGUMzLOrrVusrAO/vWIxdl7LPgHtNT8juNfNPY2jeOg8+RBOr76e5AAWxtIZaOpYvFCZ5MIvrnZB6BGuOj3uuEeQ0EXkMZY1etDm+W7HSSssq5d8hKgK8TH4aA3a593YvKsEdPZ7Y/V2CO6fzyf7i0ri/JEg4vROHzgRgK+5B/nhKVJcju7ZToqYvtU318tC2IwcW6ngJEpeYjINPXuyWfzZa0DSt+mshV7v3YscbgKFi9grlRFkishN7MO1cwqxp7BnHnIVCD2bG184T0NjwPFqsxgAefrCHZyn9DVrzXyAI/PRi+7IcgYKvvTvjYvLWk3qwfqnH5MRc5qVB0znQ5Ua9lGCxTb2VNo8WAXVYih6oIe+grqR/JIhFmG27nGEVvi6/hnVXIIXNaN3YmZaQ1aNEMrPt+K9o2B6b7ZFwJgdQBcwIrIweVJwFTRGSGP56Gg+pQl1Uo0ee4kTfWVscU3UV/IRAQJHAu9r4TDza0FHCWGw9TN9pN1FVoHVVtm0wNjEgo5dINhF4uImpARW3mJI9czUFp3wORkK/AwWpu68e1SQmEHt1NcvQypMU3Mev1pTR45IpAE8cxqecuFsEabp6tOKVX1TJJiFgoShHuXvanw5tmJmqGFjKNev5ZYinlonKG4QbQ6pHu4KQs8Oe1ePOj6ARNh76K88FJPZNIhM4doJaigfOfAV6M2gdscUyZ1TsMV8xkck4ZOLti1V9qfIPJ5mD9qBQ8ZZeU8JbQnOYTeno2u2jl0laSxdHA+KLsVjSfHBCFoAp6mR/VRWjR7kvEWoJpn7RiNkbHKmFREFtId21Ax09fxYyZDqPzklcF1/aKXlbSzaNu+uptVAChmEKfunauVWdxb02so2QmqxLRP+DFEQcMPbSNBRCHg41MT/mAsJKE4Y+u+oHFvyAR/4 jE/I/57B hOCmPsdcNqlw88bIeaFB1KlVHbw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On creation and clearing of a page table mapping, instrument such calls by invoking page_table_check_pte_set and page_table_check_pte_clear respectively. These calls serve as a sanity check against illegal mappings. Enable ARCH_SUPPORTS_PAGE_TABLE_CHECK for all platforms. See also: riscv support in commit 3fee229a8eb9 ("riscv/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") arm64 in commit 42b2547137f5 ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") x86_64 in commit d283d422c6c4 ("x86: mm: add x86_64 support for page table check") Reviewed-by: Christophe Leroy Signed-off-by: Rohan McLure --- v9: Updated for new API. Instrument pmdp_collapse_flush's two constituent calls to avoid header hell v10: Cause p{u,m}dp_huge_get_and_clear() to resemble one another --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/book3s/32/pgtable.h | 7 ++- arch/powerpc/include/asm/book3s/64/pgtable.h | 45 +++++++++++++++----- arch/powerpc/mm/book3s64/hash_pgtable.c | 4 ++ arch/powerpc/mm/book3s64/pgtable.c | 11 +++-- arch/powerpc/mm/book3s64/radix_pgtable.c | 3 ++ arch/powerpc/mm/pgtable.c | 4 ++ 7 files changed, 61 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index a68b9e637eda..66a72f9078f5 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -166,6 +166,7 @@ config PPC select ARCH_STACKWALK select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_DEBUG_PAGEALLOC if PPC_BOOK3S || PPC_8xx || 40x + select ARCH_SUPPORTS_PAGE_TABLE_CHECK select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF if PPC64 select ARCH_USE_MEMTEST diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 83f7b98ef49f..703deb5749e6 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -201,6 +201,7 @@ void unmap_kernel_page(unsigned long va); #ifndef __ASSEMBLY__ #include #include +#include /* Bits to mask out from a PGD to get to the PUD page */ #define PGD_MASKED_BITS 0 @@ -314,7 +315,11 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - return __pte(pte_update(mm, addr, ptep, ~_PAGE_HASHPTE, 0, 0)); + pte_t old_pte = __pte(pte_update(mm, addr, ptep, ~_PAGE_HASHPTE, 0, 0)); + + page_table_check_pte_clear(mm, addr, old_pte); + + return old_pte; } #define __HAVE_ARCH_PTEP_SET_WRPROTECT diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index d8640ddbcad1..6199d2b4bded 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -145,6 +145,8 @@ #define PAGE_KERNEL_ROX __pgprot(_PAGE_BASE | _PAGE_KERNEL_ROX) #ifndef __ASSEMBLY__ +#include + /* * page table defines */ @@ -415,8 +417,11 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - unsigned long old = pte_update(mm, addr, ptep, ~0UL, 0, 0); - return __pte(old); + pte_t old_pte = __pte(pte_update(mm, addr, ptep, ~0UL, 0, 0)); + + page_table_check_pte_clear(mm, addr, old_pte); + + return old_pte; } #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL @@ -425,11 +430,16 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, pte_t *ptep, int full) { if (full && radix_enabled()) { + pte_t old_pte; + /* * We know that this is a full mm pte clear and * hence can be sure there is no parallel set_pte. */ - return radix__ptep_get_and_clear_full(mm, addr, ptep, full); + old_pte = radix__ptep_get_and_clear_full(mm, addr, ptep, full); + page_table_check_pte_clear(mm, addr, old_pte); + + return old_pte; } return ptep_get_and_clear(mm, addr, ptep); } @@ -1306,19 +1316,34 @@ extern int pudp_test_and_clear_young(struct vm_area_struct *vma, static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) { - if (radix_enabled()) - return radix__pmdp_huge_get_and_clear(mm, addr, pmdp); - return hash__pmdp_huge_get_and_clear(mm, addr, pmdp); + pmd_t old_pmd; + + if (radix_enabled()) { + old_pmd = radix__pmdp_huge_get_and_clear(mm, addr, pmdp); + } else { + old_pmd = hash__pmdp_huge_get_and_clear(mm, addr, pmdp); + } + + page_table_check_pmd_clear(mm, addr, old_pmd); + + return old_pmd; } #define __HAVE_ARCH_PUDP_HUGE_GET_AND_CLEAR static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pud_t *pudp) { - if (radix_enabled()) - return radix__pudp_huge_get_and_clear(mm, addr, pudp); - BUG(); - return *pudp; + pud_t old_pud; + + if (radix_enabled()) { + old_pud = radix__pudp_huge_get_and_clear(mm, addr, pudp); + } else { + BUG(); + } + + page_table_check_pud_clear(mm, addr, old_pud); + + return old_pud; } static inline pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, diff --git a/arch/powerpc/mm/book3s64/hash_pgtable.c b/arch/powerpc/mm/book3s64/hash_pgtable.c index 871472f99a01..f200d55c35d8 100644 --- a/arch/powerpc/mm/book3s64/hash_pgtable.c +++ b/arch/powerpc/mm/book3s64/hash_pgtable.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -231,6 +232,9 @@ pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long addres pmd = *pmdp; pmd_clear(pmdp); + + page_table_check_pmd_clear(vma->vm_mm, address, pmd); + /* * Wait for all pending hash_page to finish. This is needed * in case of subpage collapse. When we collapse normal pages diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index f7be5fa058e8..171e20e69441 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -116,6 +117,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, WARN_ON(!(pmd_leaf(pmd))); #endif trace_hugepage_set_pmd(addr, pmd_val(pmd)); + page_table_check_pmd_set(mm, addr, pmdp, pmd); return set_pte_at_unchecked(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd)); } @@ -133,6 +135,7 @@ void set_pud_at(struct mm_struct *mm, unsigned long addr, WARN_ON(!(pud_leaf(pud))); #endif trace_hugepage_set_pud(addr, pud_val(pud)); + page_table_check_pud_set(mm, addr, pudp, pud); return set_pte_at_unchecked(mm, addr, pudp_ptep(pudp), pud_pte(pud)); } @@ -168,11 +171,13 @@ void serialize_against_pte_lookup(struct mm_struct *mm) pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { - unsigned long old_pmd; + pmd_t old_pmd; - old_pmd = pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT, _PAGE_INVALID); + old_pmd = __pmd(pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT, _PAGE_INVALID)); flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE); - return __pmd(old_pmd); + page_table_check_pmd_clear(vma->vm_mm, address, old_pmd); + + return old_pmd; } pmd_t pmdp_huge_get_and_clear_full(struct vm_area_struct *vma, diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c index e8da30536bd5..5e777a462a96 100644 --- a/arch/powerpc/mm/book3s64/radix_pgtable.c +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1390,6 +1391,8 @@ pmd_t radix__pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long addre pmd = *pmdp; pmd_clear(pmdp); + page_table_check_pmd_clear(vma->vm_mm, address, pmd); + radix__flush_tlb_collapsed_pmd(vma->vm_mm, address); return pmd; diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index 1e3bd1861b71..1a5c18bd8508 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -206,6 +207,9 @@ void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, * and not hw_valid ptes. Hence there is no translation cache flush * involved that need to be batched. */ + + page_table_check_ptes_set(mm, addr, ptep, pte, nr); + for (;;) { /*