From patchwork Tue Apr 2 05:11:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohan McLure X-Patchwork-Id: 13613343 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 C1A04CD1284 for ; Tue, 2 Apr 2024 05:13:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 536AB6B0089; Tue, 2 Apr 2024 01:13:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E5BD6B008A; Tue, 2 Apr 2024 01:13:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 360596B008C; Tue, 2 Apr 2024 01:13:05 -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 1669F6B0089 for ; Tue, 2 Apr 2024 01:13:05 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8AB3AC094C for ; Tue, 2 Apr 2024 05:13:04 +0000 (UTC) X-FDA: 81963422688.25.F37330C Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf19.hostedemail.com (Postfix) with ESMTP id 4317C1A0004 for ; Tue, 2 Apr 2024 05:13:02 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=fo+ZjtjL; spf=pass (imf19.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=1712034782; a=rsa-sha256; cv=none; b=CBt61sFNVWztjEqBDDmJHeXkN5Y5DRgKgRmrLxzuJeNQj0NNPRwMPMButDz1KlzVFJXBCB /zs+nK02rI80A5dpoZnS1d5EsPXQe8pLpQRHqVPFeMGXDBjdArSPnRUsMz2mkE3cylKsjx Q5BxmrX0jMoE/rCxGLfSMQtEhoyFh/w= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=fo+ZjtjL; spf=pass (imf19.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=1712034782; 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=tUzpoRgP74RJvLxNk04Ei+mJEF628oJyuC44RPNo9XY=; b=XngJAP0gQnxNafRs167r1/h3vnRq7W5KSAHZvh5EwEq3MdvHqLlYOQ5G1XULVGTMKJ39Oe gfoqVBsHnqZmYDTDtnJDuTflVX1GAo0vj7sYC86xgRSbCaPGmFPAVzKvdie8MD0LnIWTdb 5oprXm7jz6Zwa9AG31pDylSuyaeLOy0= 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 4324vToj018618; Tue, 2 Apr 2024 05:12:54 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=tUzpoRgP74RJvLxNk04Ei+mJEF628oJyuC44RPNo9XY=; b=fo+ZjtjL2LcelCWynoh5ZwUS6CcAaJ1l+hzih8bNK0A0zuhp8hW+xuh0hAZauO83tZ1q yGUqAIDfoTzMBA71h3BzzcDp+1DqZVHRL4GNqO5gtQrsy0pKL/JqrxmqGa7xMfF/VI95 mfzKzDqYQ3bEWEKZPD0I4WQ4fG+QddQdj4o8kpKP8Hg4sl9vbO0aTuKDZOwjKBzPXic4 yp/bbGdTV2aZ3E3i0WUt2DZIASKV+u5I2TMC1bTq+wFRPTFvNssBSALIDUnY2yW3kz0b /buhZYG8sUNI694474qaoYBN4MB7SUfIBYQw/6LiRviOn9BDL5+bH9jO2KpzY6J4sxHv Tg== 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 3x8beq810m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Apr 2024 05:12:53 +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 4324819a025721; Tue, 2 Apr 2024 05:12:52 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3x6x2p4exj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Apr 2024 05:12:52 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4325Cm5t46989728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Apr 2024 05:12:50 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5026220043; Tue, 2 Apr 2024 05:12:48 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E58220040; Tue, 2 Apr 2024 05:12:47 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 2 Apr 2024 05:12:47 +0000 (GMT) Received: from socotra.ibm.com (unknown [9.69.87.144]) (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 551D96009D; Tue, 2 Apr 2024 16:12:41 +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 v12 02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set() Date: Tue, 2 Apr 2024 16:11:42 +1100 Message-ID: <20240402051154.476244-3-rmclure@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402051154.476244-1-rmclure@linux.ibm.com> References: <20240402051154.476244-1-rmclure@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: q_MR-DVrR3m3_WzdkuR7z1yv6fKJT9_- X-Proofpoint-GUID: q_MR-DVrR3m3_WzdkuR7z1yv6fKJT9_- 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-04-02_02,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 malwarescore=0 adultscore=0 clxscore=1015 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2404020035 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4317C1A0004 X-Stat-Signature: n9oquaq575qobcez7iii8u6ppc8d6os8 X-Rspam-User: X-HE-Tag: 1712034782-602418 X-HE-Meta: U2FsdGVkX1+LEB4rSYg9oviKTdKud4mmt9/wFMF/8nZpmnHSkppLU8xbg68TIDiXVIHWEDDHd4f8gvjZNo8oBP5mxhuTRQNlfmIYd4XQgxcQXoh0q8fTfNEIJlFjkeiSV8327F8okkABi0/h0PizkVfxFEiD0Sy4pgcIvezV7WzqDwg/SemXPwaeJaBH72bWsPYBzYjdENvYjMynrpPH+EOivkGgiI8BsuOdE5qQcVi+SwH52+4TLHOtStRK+gkmjaIxE4fJVGnH0mvlgTrbl82xGm5sqGZ8YWvJbszAZ5leC2+r/F8b/11W26YEeWPbmwJfNbTj0DMjnncb0zP8vS0D+69JnAcl1JOWaKzHTpW2uyC8kII7xw7fsienZcqNfUOPMi6f+VMWyLlaGOnyLvpVftBjzO3wvtChFv67A6nm4bbsGsqkj3gpshVd18eeug0DADI85YNln1IF5fZ3rLls9BuREpWrZPTf9uFxiOFy55hLSPijU0mcWduzJ++KiodfWTLZ9MlCiXunpfjE4537e3xDCqWF9Sem8S7V0qU4cfOWZvABm9hEUE5g00ef7UKDhoM5I6Z5IjBe4llaCR7Yu+KwTjqCNNcTH2lAxj8R5aBwIfgmZzhf7neTWRoa9Y57uxj/hTlHZec+Kujhr+e5b03j8SXygXRDmQUYnmrzsJf7763puWvYdFGPl1AdLK3RmaCHfdhnMN6yopvpNv4wt4Be/J1jxe2nPzJsbqAA2ts8W4nE5kxfa+f8DaVOWTFXc/s1tI8UIM3OwEmqQiuWmTh+09xcP2jjCVbn8onhhzaVt0/ZjQUMtvLPzxG8po7e0lUUImCFYyz3uLVdPHZnfITo5PIuo+YkyPVfYrN8JoMQtV4FPHv/4XHYev/F/HS7imfFmnJ9GxK+fxAkiP/cmPXTYf4qw1X5ioTnxX/wGO9DHqjV1JDWZYJVcGHlNsR14jTv+3sGmIi/mHC l4BWi5/+ qDGBvTc5QaFdUOzgXyzvy8q+621QYF3dFofpBoZoN8/NiWTiMlaqMAVG+9/HK888jHUYIxeAJGStxIX5QKnYrwcSD3xjNUNfjw5bwx230CGue9/JQt1QX/M8eiN7ezrs/RypipQbhz0jHazjKOXf97sHgUN7LUf8QQpBIlLJNxKuJFrGo+AsPs/2He9j9EjIlcYOd3xToqY+ZFPQODgG8xKiD5WEiRhhTRTk65hUhmZC3Np0ihMR1G/KqXeJK8Q27eGMlbRmttD/t4j4= 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 a3b837130b58 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_set"). 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 Reviewed-by: Pasha Tatashin --- 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;