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

From: Andrew Morton
Date: Fri Nov 15 2019 - 18:23:55 EST


On Fri, 15 Nov 2019 18:19:57 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:

> Hi all,
>
> [Also reported by Randy Dunlap]
>
> After merging the akpm-current tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
>
> mm/vmalloc.c: In function '__purge_vmap_area_lazy':
> mm/vmalloc.c:1286:8: error: 'SHARED_KERNEL_PMD' undeclared (first use in this function)
> 1286 | if (!SHARED_KERNEL_PMD && boot_cpu_has(X86_FEATURE_PTI))
> | ^~~~~~~~~~~~~~~~~
> mm/vmalloc.c:1286:8: note: each undeclared identifier is reported only once for each function it appears in
> mm/vmalloc.c:1286:29: error: implicit declaration of function 'boot_cpu_has' [-Werror=implicit-function-declaration]
> 1286 | if (!SHARED_KERNEL_PMD && boot_cpu_has(X86_FEATURE_PTI))
> | ^~~~~~~~~~~~
> mm/vmalloc.c:1286:42: error: 'X86_FEATURE_PTI' undeclared (first use in this function)
> 1286 | if (!SHARED_KERNEL_PMD && boot_cpu_has(X86_FEATURE_PTI))
> | ^~~~~~~~~~~~~~~
>
> Caused by commit
>
> 07ef40e149bf ("mm-vmalloc-fix-regression-caused-by-needless-vmalloc_sync_all-fix")
>
> SHARED_KERNEL_PMD, boot_cpu_has() and X86_FEATURE_PTI are only defined
> for X86.
>
> I have reverted that commit for today.

Thanks. So it has to be an ifdef.

--- a/mm/vmalloc.c~mm-vmalloc-fix-regression-caused-by-needless-vmalloc_sync_all-fix-fix
+++ a/mm/vmalloc.c
@@ -1255,17 +1255,17 @@ static bool __purge_vmap_area_lazy(unsig
if (unlikely(valist == NULL))
return false;

- if (IS_ENABLED(CONFIG_X86_PAE)) {
- /*
- * First make sure the mappings are removed from all page-tables
- * before they are freed.
- *
- * This is only needed on x86-32 with !SHARED_KERNEL_PMD, which
- * is the case on a PAE kernel with PTI enabled.
- */
- if (!SHARED_KERNEL_PMD && boot_cpu_has(X86_FEATURE_PTI))
- vmalloc_sync_all();
- }
+#ifdef CONFIG_X86_PAE
+ /*
+ * First make sure the mappings are removed from all pagetables before
+ * they are freed.
+ *
+ * This is only needed on x86-32 with !SHARED_KERNEL_PMD, which is the
+ * case on a PAE kernel with PTI enabled.
+ */
+ if (!SHARED_KERNEL_PMD && boot_cpu_has(X86_FEATURE_PTI))
+ vmalloc_sync_all();
+#endif

/*
* TODO: to calculate a flush range without looping.
_