From nobody Fri Dec 19 15:46:26 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CE2826FD98 for ; Fri, 11 Apr 2025 05:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744350262; cv=none; b=kF7n5bdeVglF46JYBtZahdRLRnSttody0CEgethbfbPeBMSCD27U9B0UYm0bmnVVh62wWQ1Tm1toiTe8N0LAWeyvp071nxwtVY8IIJ5lj5kucUQ00o1uBngKcjTAKbtG/iD3e0cCCVDFfr38fpjR37NWm3T9aHGrYNUmcH0ZJsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744350262; c=relaxed/simple; bh=urkEgXQKXDayxSPsLZ6m4aA0LDtzR1Hbm8y+5qGrj1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ym6Jz6qYBcsavKYNLRPnKkaX5ctSuDb1LLKv9vrMZHmcTmHs4JMtSZQw8Ot0TjgFjrt7M81cazaWhD/2SIZDFpBAC9BaT3pEZw8YcN1Wqhm8mAqKNxMnlp5DFCqPHsoDQAyAlK+bOy4UuYEoHL31rscxrozsoI1E6eQ0VJSkr/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=ZqXSiafn; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ZqXSiafn" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 53AMCZbY004127; Fri, 11 Apr 2025 05:44:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=V+FiDkwM5bRV8CJZW /HsNBOqSTMzvNrJiblPEx1ni6U=; b=ZqXSiafnXaUTVsz/1FNXAfA9KpP04RQd+ 4AT8s9wZmxu1fF3UMyv9BycoLmOLQ6pDHch/zMcHaTzgR1qvaHbjHQ6T3W89EERd 4uMU8x4ee9p5s5/Z864VubCSQATqK7HsYWz6kw/aYdE7cXJQfGlNZC4hOS2blHqk ANerr1jt76asVO6R2yeMmYxf5Dlzy+knR+YBM6RMmuXKwxxO3VQlmAKondjE9M+7 qfBzMKHPHuwDiq4NtM9NIxH9zHobqDuBLVYUhZGkT3ZL1SVzkw/wz0l431xMXEHu aeq6fckmdfnEOngsk+cDOcf49bAwJcsDROZ55cuNbTOgqTLJ6N44g== 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 45xe13vfta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Apr 2025 05:44:07 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 53B1bltY025510; Fri, 11 Apr 2025 05:44:06 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 45ugbm9gws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Apr 2025 05:44:05 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 53B5i4Lc52691412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Apr 2025 05:44:04 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F385B20043; Fri, 11 Apr 2025 05:44:03 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2063220040; Fri, 11 Apr 2025 05:44:03 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.63.197.14]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 11 Apr 2025 05:44:03 +0000 (GMT) Received: from jarvis.ozlabs.ibm.com (haven.au.ibm.com [9.63.198.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 6349A60AC3; Fri, 11 Apr 2025 15:43:57 +1000 (AEST) From: Andrew Donnellan To: linuxppc-dev@lists.ozlabs.org Cc: x86@kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, sweettea-kernel@dorminy.me, christophe.leroy@csgroup.eu Subject: [PATCH v14 05/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_clear() Date: Fri, 11 Apr 2025 15:43:48 +1000 Message-ID: <20250411054354.511145-6-ajd@linux.ibm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250411054354.511145-1-ajd@linux.ibm.com> References: <20250411054354.511145-1-ajd@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uOBT-gwSeKfRJ2B6V8auVjunVoMrBGqf X-Proofpoint-GUID: uOBT-gwSeKfRJ2B6V8auVjunVoMrBGqf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-11_01,2025-04-10_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=911 adultscore=0 suspectscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504110038 Content-Type: text/plain; charset="utf-8" From: Rohan McLure This reverts commit 1831414cd729 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_clear"). 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 Reviewed-by: Pasha Tatashin Signed-off-by: Andrew Donnellan --- 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/pgta= ble.h index 6410c3583ca0..3ccebb6c090e 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1349,7 +1349,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm= _struct *mm, { pmd_t pmd =3D __pmd(xchg_relaxed(&pmd_val(*pmdp), 0)); =20 - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, address, pmd); =20 return pmd; } diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgta= ble.h index d348186f4731..beafa053a768 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -879,7 +879,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_s= truct *mm, { pmd_t pmd =3D __pmd(atomic_long_xchg((atomic_long_t *)pmdp, 0)); =20 - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, address, pmd); =20 return pmd; } diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5a71a884858e..c385ba804fda 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1387,7 +1387,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm= _struct *mm, unsigned long { pmd_t pmd =3D native_pmdp_get_and_clear(pmdp); =20 - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, addr, pmd); =20 return pmd; } diff --git a/include/linux/page_table_check.h b/include/linux/page_table_ch= eck.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; =20 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); } =20 -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; =20 - __page_table_check_pmd_clear(mm, pmd); + __page_table_check_pmd_clear(mm, addr, pmd); } =20 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) { } =20 -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) { } =20 diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 5cc978ef1330..52553aaa2039 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -637,7 +637,7 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_s= truct *mm, pmd_t pmd =3D *pmdp; =20 pmd_clear(pmdp); - page_table_check_pmd_clear(mm, pmd); + page_table_check_pmd_clear(mm, address, pmd); =20 return pmd; } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index aad4b7e2194d..9a6cfea0c1d4 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -156,7 +156,8 @@ void __page_table_check_pte_clear(struct mm_struct *mm,= pte_t pte) } EXPORT_SYMBOL(__page_table_check_pte_clear); =20 -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 =3D=3D mm) return; @@ -227,7 +228,7 @@ void __page_table_check_pmd_set(struct mm_struct *mm, u= nsigned long addr, =20 page_table_check_pmd_flags(pmd); =20 - __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)); --=20 2.49.0