Subject: linux-next: build failure after merge of the mm tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 9 Jan 2025 10:06:46 +1100

Hi all,

After merging the mm tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

In file included from arch/powerpc/include/asm/book3s/64/mmu-hash.h:20,
                 from arch/powerpc/include/asm/book3s/64/mmu.h:32,
                 from arch/powerpc/include/asm/mmu.h:377,
                 from arch/powerpc/include/asm/paca.h:18,
                 from arch/powerpc/include/asm/current.h:13,
                 from include/linux/thread_info.h:23,
                 from include/asm-generic/preempt.h:5,
                 from ./arch/powerpc/include/generated/asm/preempt.h:1,
                 from include/linux/preempt.h:79,
                 from include/linux/alloc_tag.h:11,
                 from include/linux/rhashtable-types.h:12,
                 from include/linux/ipc.h:7,
                 from include/uapi/linux/sem.h:5,
                 from include/linux/sem.h:5,
                 from include/linux/compat.h:14,
                 from arch/powerpc/kernel/asm-offsets.c:12:
arch/powerpc/include/asm/book3s/64/pgtable.h:1364:1: error: expected identifier or '(' before '}' token
 1364 | }
      | ^
arch/powerpc/mm/book3s64/pgtable.c: In function 'pmdp_huge_get_and_clear_full':
arch/powerpc/mm/book3s64/pgtable.c:670:33: error: unterminated argument list invoking macro "VM_BUG_ON"
  670 | EXPORT_SYMBOL(vm_get_page_prot);
      |                                 ^
arch/powerpc/mm/book3s64/pgtable.c:207:9: error: 'VM_BUG_ON' undeclared (first use in this function)
  207 |         VM_BUG_ON((pmd_present(*pmdp) && !pmd_trans_huge(*pmdp) &&
      |         ^~~~~~~~~
arch/powerpc/mm/book3s64/pgtable.c:207:9: note: each undeclared identifier is reported only once for each function it appears in
arch/powerpc/mm/book3s64/pgtable.c:207:18: error: expected ';' at end of input
  207 |         VM_BUG_ON((pmd_present(*pmdp) && !pmd_trans_huge(*pmdp) &&
      |                  ^
      |                  ;
......
arch/powerpc/mm/book3s64/pgtable.c:207:9: error: expected declaration or statement at end of input
  207 |         VM_BUG_ON((pmd_present(*pmdp) && !pmd_trans_huge(*pmdp) &&
      |         ^~~~~~~~~
arch/powerpc/mm/book3s64/pgtable.c:205:15: error: unused variable 'pmd' [-Werror=unused-variable]
  205 |         pmd_t pmd;
      |               ^~~
arch/powerpc/mm/book3s64/pgtable.c:671: error: control reaches end of non-void function [-Werror=return-type]
cc1: all warnings being treated as errors
arch/powerpc/mm/book3s64/hash_hugepage.c: In function '__hash_page_thp':
arch/powerpc/mm/book3s64/hash_hugepage.c:57:44: error: '_PAGE_DEVMAP' undeclared (first use in this function)
   57 |         if (!(old_pmd & (H_PAGE_THP_HUGE | _PAGE_DEVMAP)))
      |                                            ^~~~~~~~~~~~
arch/powerpc/mm/book3s64/hash_hugepage.c:57:44: note: each undeclared identifier is reported only once for each function it appears in
arch/powerpc/mm/book3s64/hugetlbpage.c: In function '__hash_page_huge':
arch/powerpc/mm/book3s64/hugetlbpage.c:77:42: error: '_PAGE_DEVMAP' undeclared (first use in this function)
   77 |         if (old_pte & (H_PAGE_THP_HUGE | _PAGE_DEVMAP))
      |                                          ^~~~~~~~~~~~
arch/powerpc/mm/book3s64/hugetlbpage.c:77:42: note: each undeclared identifier is reported only once for each function it appears in

Caused by commits

  c0c3319917db ("mm: remove devmap related functions and page table bits")
  f9a01843d366 ("mm: remove pXX_devmap callers")

from the mm-unstable branch of the mm tree.

I have applied the following patch for today.

From: Stephen Rothwell <[email-masked]>
Date: Thu, 9 Jan 2025 09:33:31 +1100
Subject: [PATCH] fix up for "mm: remove devmap related functions and page
 table bits"

and "mm: remove pXX_devmap callers"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 arch/powerpc/include/asm/book3s/64/pgtable.h | 1 -
 arch/powerpc/mm/book3s64/hash_hugepage.c     | 2 +-
 arch/powerpc/mm/book3s64/hugetlbpage.c       | 2 +-
 arch/powerpc/mm/book3s64/pgtable.c           | 2 +-
 4 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index bda0649b316d..1d98d0a5984b 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -1361,7 +1361,6 @@ static inline bool arch_needs_pgtable_deposit(void)
 }
 extern void serialize_against_pte_lookup(struct mm_struct *mm);
 
-}
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
 #define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
diff --git a/arch/powerpc/mm/book3s64/hash_hugepage.c b/arch/powerpc/mm/book3s64/hash_hugepage.c
index 15d6f3ea7178..cdfd4fe75edb 100644
--- a/arch/powerpc/mm/book3s64/hash_hugepage.c
+++ b/arch/powerpc/mm/book3s64/hash_hugepage.c
@@ -54,7 +54,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 	/*
 	 * Make sure this is thp or devmap entry
 	 */
-	if (!(old_pmd & (H_PAGE_THP_HUGE | _PAGE_DEVMAP)))
+	if (!(old_pmd & H_PAGE_THP_HUGE))
 		return 0;
 
 	rflags = htab_convert_pte_flags(new_pmd, flags);
diff --git a/arch/powerpc/mm/book3s64/hugetlbpage.c b/arch/powerpc/mm/book3s64/hugetlbpage.c
index 83c3361b358b..2bcbbf9d85ac 100644
--- a/arch/powerpc/mm/book3s64/hugetlbpage.c
+++ b/arch/powerpc/mm/book3s64/hugetlbpage.c
@@ -74,7 +74,7 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
 	} while(!pte_xchg(ptep, __pte(old_pte), __pte(new_pte)));
 
 	/* Make sure this is a hugetlb entry */
-	if (old_pte & (H_PAGE_THP_HUGE | _PAGE_DEVMAP))
+	if (old_pte & H_PAGE_THP_HUGE)
 		return 0;
 
 	rflags = htab_convert_pte_flags(new_pte, flags);
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index b6aeb306ec0b..49293d0c41dd 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -204,7 +204,7 @@ pmd_t pmdp_huge_get_and_clear_full(struct vm_area_struct *vma,
 {
 	pmd_t pmd;
 	VM_BUG_ON(addr & ~HPAGE_PMD_MASK);
-	VM_BUG_ON((pmd_present(*pmdp) && !pmd_trans_huge(*pmdp) &&
+	VM_BUG_ON((pmd_present(*pmdp) && !pmd_trans_huge(*pmdp)) ||
 		   !pmd_present(*pmdp));
 	pmd = pmdp_huge_get_and_clear(vma->vm_mm, addr, pmdp);
 	/*
-- 
2.45.2

-- 
Cheers,
Stephen Rothwell