asm-generic/pgtable-nop?d.h: define folded with a value for use in C
PATCH 1/1 asm-generic/pgtable-nop?d.h: define folded with a value for use in C
It turns out "if (__is_defined(__PAGETABLE_PMD_FOLDED))" isn't equivalent to "#ifdef __PAGETABLE_PMD_FOLDED". (who knew!)
kconfig.h's __is_defined() expects a define of the form "#define CONFIG_BOOGER 1". But these nop?d headers just have "#define __PAGETABLE_PMD_FOLDED".
This means ____is_defined()'s triplet passed to __take_second_arg() is 'empty-string, 1 0' in both cases, meaning these symbols can't be used from C. (they are always false).
asm-generic gets away with this as its using the pre-processor's defined() macro on this, not the C __is_defined().
Add the expected '1'.
---
This fixes an issue with patches queued for arm64. Can it go via the arm64 tree?
Link: lore.kernel.org/r/[email protected]
include/asm-generic/pgtable-nopmd.h | 2 +- include/asm-generic/pgtable-nopud.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/pgtable-nopmd.h +1 -1
@@ -8,7 +8,7 @@struct mm_struct ; -#define __PAGETABLE_PMD_FOLDED +#define __PAGETABLE_PMD_FOLDED 1/* * Having the pmd type consist of a pud gets the size right, and allows
include/asm-generic/pgtable-nopud.h +1 -1
@@ -9,7 +9,7 @@#else #include <asm-generic/pgtable-nop4d.h> -#define __PAGETABLE_PUD_FOLDED +#define __PAGETABLE_PUD_FOLDED 1/* * Having the pud type consist of a p4d gets the size right, and allows
Signature · 1 line
2.19.0
Quoted 6 lines · James Morse
It turns out "if (
__is_defined(__PAGETABLE_PMD_FOLDED))" isn't equivalent to "#ifdef__PAGETABLE_PMD_FOLDED". (who knew!)kconfig.h's
__is_defined()expects a define of the form "#defineCONFIG_BOOGER1". But these nop?d headers just have "#define__PAGETABLE_PMD_FOLDED".
I wonder why we're using __is_defined() at all on arm64. It looks like some internal kconfig.h helper for IS_ENABLED() etc. Even if it looks nicer, I'd rather go for an #ifdef in the arm64 set_pmd() code.
Signature · 1 line
Catalin
Quoted 11 lines · Catalin Marinas
Quoted 6 lines · James Morse
It turns out "if (
__is_defined(__PAGETABLE_PMD_FOLDED))" isn't equivalent to "#ifdef__PAGETABLE_PMD_FOLDED". (who knew!)kconfig.h's
__is_defined()expects a define of the form "#defineCONFIG_BOOGER1". But these nop?d headers just have "#define__PAGETABLE_PMD_FOLDED".I wonder why we're using
__is_defined()at all on arm64. It looks like some internalkconfig.hhelper forIS_ENABLED()etc. Even if it looks nicer, I'd rather go for an #ifdef in the arm64set_pmd()code.
This was my fault entirely; sorry about that.
I'd wanted to ensure that we got build coverage regardless of the kernel configuration, which was why i'd used __is_defined().
Thanks,
Mark.