From patchwork Wed Mar 13 04:21:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13590971 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 1C254C54E58 for ; Wed, 13 Mar 2024 04:21:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 932FD940009; Wed, 13 Mar 2024 00:21:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E351940010; Wed, 13 Mar 2024 00:21:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71AB6940009; Wed, 13 Mar 2024 00:21:51 -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 51B93940010 for ; Wed, 13 Mar 2024 00:21:51 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 22157C1041 for ; Wed, 13 Mar 2024 04:21:51 +0000 (UTC) X-FDA: 81890717622.10.4CCDE0E Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf10.hostedemail.com (Postfix) with ESMTP id AB48BC001C for ; Wed, 13 Mar 2024 04:21:48 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=L7gUm0dt; spf=pass (imf10.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=1710303708; a=rsa-sha256; cv=none; b=BWf1rJGq/V9EBxQy+9j5ODDpjk9HaJycYwg2JhRIYR+g6LZKTgx6QYcHITQVc6iFKulUQ4 gDqmcjkPuxkdIsGFTG+K9xJzKOQufChr1oUaJl3bsOhulc3GxrQSDMDgQw21Q9sYkWCM+S DxgZhpgmO+Sc/PGQ/hWM5PZRPQmc9Pc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=L7gUm0dt; spf=pass (imf10.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=1710303708; 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=9XXDP54rR4EAdpOPs5Th/H7WVfSwAhcEpWLZpZxAUGM=; b=eznpxmkVCAOiT8Qmhraoz3HjXNELRiHc/kKKvknxdIIKX3mMzQHrnEoVm8ObRtmy+mds8V Ad9FpZMIg4ZcXQ62CSkUhz4sf8OC+2EtYMhMb1Ii2mXl+xiZQdX5BAPLlFVlsJdxfOtAf3 zGZX6wYr8ZpD2XWOc0F4ga7RJDWTd1E= Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42D459cR023072; Wed, 13 Mar 2024 04:21:37 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=9XXDP54rR4EAdpOPs5Th/H7WVfSwAhcEpWLZpZxAUGM=; b=L7gUm0dtjONy2LjMaEsIVVyD2hXX79aYZW19hsKJ0Xpj8M35iKJhBW8jt5y0HqJbv/I/ 0rz5tHVDF9D+Gq1WYm6yaC8qGItN9DXh8xlm4v76NsYwkYTQ2wmp/Lm0+kjZN6SvvUw/ V9RIeFnhHR5f+FWZYXfLr2wf68c6n2sEZ/p/WuJsns5lwEGf3d9WV/bgmhrGj6X4kx7h EuRg2EK2czzgVjwIeuZYVpBAcYITy3J0/IJjDgFeJ74sqOBtK8Op0DBlMB4MhtrvupGk GbUrFz5ltq0S67o5T9S4YQE2IhNLjdaXRWO+SwNpydRNVFh6tp2csaY/KIkgCotAwLaY ng== 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 3wu4t2r5s0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Mar 2024 04:21:37 +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 42D3jD7R015028; Wed, 13 Mar 2024 04:21:36 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ws33nuhcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Mar 2024 04:21:35 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 42D4LVah23266046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Mar 2024 04:21:33 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7DF620043; Wed, 13 Mar 2024 04:21:31 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3E032004D; Wed, 13 Mar 2024 04:21:30 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 13 Mar 2024 04:21:30 +0000 (GMT) Received: from socotra.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (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 0D4E060412; Wed, 13 Mar 2024 15:21:26 +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 v10 06/12] Revert "mm/page_table_check: remove unused parameter in [__]page_table_check_pte_clear" Date: Wed, 13 Mar 2024 15:21:11 +1100 Message-ID: <20240313042118.230397-7-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313042118.230397-1-rmclure@linux.ibm.com> References: <20240313042118.230397-1-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CjsZWOq4r3lXXzXUQZdBfLwhcoc8o2WM X-Proofpoint-ORIG-GUID: CjsZWOq4r3lXXzXUQZdBfLwhcoc8o2WM 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-13_04,2024-03-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 clxscore=1015 suspectscore=0 spamscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=805 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403130030 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: AB48BC001C X-Stat-Signature: 8qu1ax15b6rdqgw94tsg1t5zjiso6ef3 X-Rspam-User: X-HE-Tag: 1710303708-64857 X-HE-Meta: U2FsdGVkX19F78K50YTJKrcx1WiaO/iNRHf6mjHGTK/Wefhm85/l835ZASokfJ3rdsVT+7H8jIjm4Rv5OxwzuTKZe9REDWJjkY6VA3lSxtcAcwCpDS3Qo8dnb/1/m8ViYqGK7vStS7srWJN+zFdIfciDuI8pz8hgNutyH+kKTYlsodWAZyx5cC1OfaVMffEF+ozeDGwPzIVay/tMtdAYwz7LWnM/dvLtPlIwkXSavvnj65ACESVXvNqSLFsmdTImjReMWAMEq0D3tWwA5ZtWTONEpO9Ncommon+sc6D5QuV0iyVo4AwFdTxsshIqx4TGnCzokliSxqLPavnh5jxHsSF/u0/Hm9I79s39AiM1X+Qt1wRDrKSL8hP8hBen7Wzj0CdtEN/srRnG0UdRowmzDtfUsIhKz2l4VsdJ7LwDijoCwawZ5dj8WDkNPrs985pUefanuMQQ54tCen9H7hm6bwN+YY2g31GmbM7ecqJotuDU0L9dIriftfGBZCwd0uX8Z98zEcUGLWdisqqk+5UQRZ69DoOWQWpY9LY75BnOHcdat7k1vaYznhJnI4YOJQncUrBjRHbS7djkwMXhier1oG7ePmfMEcF2Qgsi6Q+v0vuOyaqawHZ1UEhaG6gEwMWVnNQBwGj8nEhVp2LfHHfVY1HUqeUurppoSsnq75t0TDfymI1DkaCQrJ4PkNoSz5akaNitZwKc6upW2oLn167KSrJuIsYBjM0BKFpXWlNwkjX1byAoc09Pb1Q45d5ewWyvxaRW1W4GCZ8iN6dRfc8jxOYIdQ0VQrFLIZVvUm0f/7PeuxxCmnTgC27q5aAKKWWw2XBTToB0u2QGC1uERxu0SKjTC3lxHG0Vqz23y7D7zD21+zki3aLV9t+8s/R3Tm/u5L4ZDNlItyUTFGYd1KJWCFNIZ5ZO8j11cXqCQkKtV64v/3swCTU/jOAfyJ0ilnx0TrgfqWmf2qhhe/fxdGG DEswFjXF UDmYjsgEYxLMa265Cb+bPHVGq95sfyqxV8kWS45Qmg032Vtd4243e/opHomhe7MXwwWYGvq7jeQuY2SHQ65Cuh8aThfB3iDI8ATu/jroH0yhLMFRoT8ceJIsRvrtkzzF1B5gbYaGKOqpzG4NXE5xL1biGFM3bZ4mGF3GgdYeEktnPV9c1aOqYOpqgMbRvAbQMtteh+s1QRCy9rR2mLdPGardQf8zRJvZgy0OCpoj9dnNbjtOlBCQhPt5hUaWOPmBB2GkCeH7sE1LOiXg= 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 4210d3b071ec..74bb81744df2 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -953,7 +953,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 cf8e18f27649..2fa6625f591a 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -561,7 +561,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 26722f553c43..e8fd625de280 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1283,7 +1283,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; } @@ -1299,7 +1299,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 d0d1a0bbf905..89af325129f2 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -428,7 +428,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++; }