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

From: Stephen Rothwell <[email-masked]>
Date: Thu, 18 Mar 2021 20:56:07 +1100

Hi all,

After merging the akpm-current tree, today's linux-next build (sparc
defconfig) failed like this:

In file included from arch/sparc/include/asm/pgtable_32.h:25:0,
                 from arch/sparc/include/asm/pgtable.h:7,
                 from include/linux/pgtable.h:6,
                 from include/linux/mm.h:33,
                 from mm/vmalloc.c:12:
mm/vmalloc.c: In function 'vmalloc_to_page':
include/asm-generic/pgtable-nopud.h:51:27: error: implicit declaration of function 'pud_page'; did you mean 'put_page'? [-Werror=implicit-function-declaration]
 #define p4d_page(p4d)    (pud_page((pud_t){ p4d }))
                           ^
mm/vmalloc.c:643:10: note: in expansion of macro 'p4d_page'
   return p4d_page(*p4d) + ((addr & ~P4D_MASK) >> PAGE_SHIFT);
          ^~~~~~~~
mm/vmalloc.c:643:25: warning: return makes pointer from integer without a cast [-Wint-conversion]
   return p4d_page(*p4d) + ((addr & ~P4D_MASK) >> PAGE_SHIFT);
mm/vmalloc.c:651:25: warning: return makes pointer from integer without a cast [-Wint-conversion]
   return pud_page(*pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Caused by commit

  70d18d470920 ("mm/vmalloc: fix HUGE_VMAP regression by enabling huge pages in vmalloc_to_page")

I have applied the following hack path for today (hopefully someone can
come up with something better):

From: Stephen Rothwell <[email-masked]>
Date: Thu, 18 Mar 2021 18:32:58 +1100
Subject: [PATCH] hack to make SPARC32 build

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/vmalloc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 57b7f62d25a7..96444d64129a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -640,7 +640,11 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
 	if (p4d_none(*p4d))
 		return NULL;
 	if (p4d_leaf(*p4d))
+#ifdef CONFIG_SPARC32
+		return NULL;
+#else
 		return p4d_page(*p4d) + ((addr & ~P4D_MASK) >> PAGE_SHIFT);
+#endif
 	if (WARN_ON_ONCE(p4d_bad(*p4d)))
 		return NULL;
 
@@ -648,7 +652,11 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
 	if (pud_none(*pud))
 		return NULL;
 	if (pud_leaf(*pud))
+#ifdef CONFIG_SPARC32
+		return NULL;
+#else
 		return pud_page(*pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
+#endif
 	if (WARN_ON_ONCE(pud_bad(*pud)))
 		return NULL;
 
-- 
2.30.0

-- 
Cheers,
Stephen Rothwell