lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240318200404.448346-8-peterx@redhat.com>
Date: Mon, 18 Mar 2024 16:03:57 -0400
From: peterx@...hat.com
To: linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	x86@...nel.org,
	Muchun Song <muchun.song@...ux.dev>,
	Mike Rapoport <rppt@...nel.org>,
	Matthew Wilcox <willy@...radead.org>,
	sparclinux@...r.kernel.org,
	Jason Gunthorpe <jgg@...dia.com>,
	linuxppc-dev@...ts.ozlabs.org,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	linux-arm-kernel@...ts.infradead.org,
	peterx@...hat.com,
	Russell King <linux@...linux.org.uk>,
	Shawn Guo <shawnguo@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
	Bjorn Andersson <andersson@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Konrad Dybcio <konrad.dybcio@...aro.org>,
	Fabio Estevam <festevam@...x.de>
Subject: [PATCH v2 07/14] mm/arm: Redefine pmd_huge() with pmd_leaf()

From: Peter Xu <peterx@...hat.com>

Most of the archs already define these two APIs the same way.  ARM is more
complicated in two aspects:

  - For pXd_huge() it's always checking against !PXD_TABLE_BIT, while for
    pXd_leaf() it's always checking against PXD_TYPE_SECT.

  - SECT/TABLE bits are defined differently on 2-level v.s. 3-level ARM
    pgtables, which makes the whole thing even harder to follow.

Luckily, the second complexity should be hidden by the pmd_leaf()
implementation against 2-level v.s. 3-level headers.  Invoke pmd_leaf()
directly for pmd_huge(), to remove the first part of complexity.  This
prepares to drop pXd_huge() API globally.

When at it, drop the obsolete comments - it's outdated.

Cc: Russell King <linux@...linux.org.uk>
Cc: Shawn Guo <shawnguo@...nel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Bjorn Andersson <andersson@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Konrad Dybcio <konrad.dybcio@...aro.org>
Cc: Fabio Estevam <festevam@...x.de>
Cc: linux-arm-kernel@...ts.infradead.org
Signed-off-by: Peter Xu <peterx@...hat.com>
---
 arch/arm/mm/hugetlbpage.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c
index dd7a0277c5c0..c2fa643f6bb5 100644
--- a/arch/arm/mm/hugetlbpage.c
+++ b/arch/arm/mm/hugetlbpage.c
@@ -18,11 +18,6 @@
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
-/*
- * On ARM, huge pages are backed by pmd's rather than pte's, so we do a lot
- * of type casting from pmd_t * to pte_t *.
- */
-
 int pud_huge(pud_t pud)
 {
 	return 0;
@@ -30,5 +25,5 @@ int pud_huge(pud_t pud)
 
 int pmd_huge(pmd_t pmd)
 {
-	return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
+	return pmd_leaf(pmd);
 }
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ