Skip to contentSkip to conversation

mm-arch-provide-pud_pfn-fallback.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 26, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/arch: provide pud_pfn() fallback
has been removed from the -mm tree. Its filename was
mm-arch-provide-pud_pfn-fallback.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Peter Xu <[email protected]>
Subject: mm/arch: provide pud_pfn() fallback
Date: Wed, 27 Mar 2024 11:23:24 -0400

The comment in the code explains the reasons. We took a different approach comparing to pmd_pfn() by providing a fallback function.

Another option is to provide some lower level config options (compare to HUGETLB_PAGE or THP) to identify which layer an arch can support for such huge mappings. However that can be an overkill.

[[email protected]: fix loongson defconfig]
Cc Mike Rapoport (IBM) <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Andrew Jones <[email protected]>
Cc Aneesh Kumar K.V (IBM) <[email protected]>
Cc Axel Rasmussen <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc James Houghton <[email protected]>
Cc John Hubbard <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Muchun Song <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Yang Shi <[email protected]>

---

 arch/riscv/include/asm/pgtable.h    |    1 +
 arch/s390/include/asm/pgtable.h     |    1 +
 arch/sparc/include/asm/pgtable_64.h |    1 +
 arch/x86/include/asm/pgtable.h      |    1 +
 include/linux/pgtable.h             |   14 ++++++++++++++
 5 files changed, 18 insertions(+)
arch/riscv/include/asm/pgtable.h renamed from arch/riscv/include/asm/pgtable.h~mm-arch-provide-pud_pfn-fallback +1 -0
@@ -648,6 +648,7 @@ static inline unsigned long pmd_pfn(pmd_
 
 #define __pud_to_phys(pud)  (__page_val_to_pfn(pud_val(pud)) << PAGE_SHIFT)
 
+#define pud_pfn pud_pfn
 static inline unsigned long pud_pfn(pud_t pud)
 {
 	return ((__pud_to_phys(pud) & PUD_MASK) >> PAGE_SHIFT);
arch/s390/include/asm/pgtable.h renamed from arch/s390/include/asm/pgtable.h~mm-arch-provide-pud_pfn-fallback +1 -0
@@ -1405,6 +1405,7 @@ static inline unsigned long pud_deref(pu
 	return (unsigned long)__va(pud_val(pud) & origin_mask);
 }
 
+#define pud_pfn pud_pfn
 static inline unsigned long pud_pfn(pud_t pud)
 {
 	return __pa(pud_deref(pud)) >> PAGE_SHIFT;
arch/sparc/include/asm/pgtable_64.h renamed from arch/sparc/include/asm/pgtable_64.h~mm-arch-provide-pud_pfn-fallback +1 -0
@@ -875,6 +875,7 @@ static inline bool pud_leaf(pud_t pud)
 	return pte_val(pte) & _PAGE_PMD_HUGE;
 }
 
+#define pud_pfn pud_pfn
 static inline unsigned long pud_pfn(pud_t pud)
 {
 	pte_t pte = __pte(pud_val(pud));
arch/x86/include/asm/pgtable.h renamed from arch/x86/include/asm/pgtable.h~mm-arch-provide-pud_pfn-fallback +1 -0
@@ -234,6 +234,7 @@ static inline unsigned long pmd_pfn(pmd_
 	return (pfn & pmd_pfn_mask(pmd)) >> PAGE_SHIFT;
 }
 
+#define pud_pfn pud_pfn
 static inline unsigned long pud_pfn(pud_t pud)
 {
 	phys_addr_t pfn = pud_val(pud);
include/linux/pgtable.h renamed from include/linux/pgtable.h~mm-arch-provide-pud_pfn-fallback +14 -0
@@ -1820,6 +1820,20 @@ typedef unsigned int pgtbl_mod_mask;
 #endif
 
 /*
+ * We always define pmd_pfn for all archs as it's used in lots of generic
+ * code.  Now it happens too for pud_pfn (and can happen for larger
+ * mappings too in the future; we're not there yet).  Instead of defining
+ * it for all archs (like pmd_pfn), provide a fallback.
+ *
+ * Note that returning 0 here means any arch that didn't define this can
+ * get severely wrong when it hits a real pud leaf.  It's arch's
+ * responsibility to properly define it when a huge pud is possible.
+ */
+#ifndef pud_pfn
+#define pud_pfn(x) 0
+#endif
+
+/*
  * Some architectures have MMUs that are configurable or selectable at boot
  * time. These lead to variable PTRS_PER_x. For statically allocated arrays it
  * helps to have a static maximum value.

_

Patches currently in -mm which might be from [email protected] are

mm-userfaultfd-reset-ptes-when-close-for-wr-protected-ones.patch mm-hugetlb-assert-hugetlb_lock-in-__hugetlb_cgroup_commit_charge.patch mm-page_table_check-support-userfault-wr-protect-entries.patch