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++; }