* [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
@ 2018-10-03 17:50 James Morse
2018-10-03 17:50 ` James Morse
2018-10-04 9:45 ` Catalin Marinas
0 siblings, 2 replies; 6+ messages in thread
From: James Morse @ 2018-10-03 17:50 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-arch, Mark Rutland, Arnd Bergmann, Catalin Marinas,
Will Deacon, 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
"#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'.
Signed-off-by: James Morse <james.morse@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
---
This fixes an issue with patches queued for arm64. Can it go via the arm64 tree?
Link: lore.kernel.org/r/0f9a3abc-4890-faf5-ee7e-18434641b858@arm.com
include/asm-generic/pgtable-nopmd.h | 2 +-
include/asm-generic/pgtable-nopud.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index f35f6e8149e4..fcb4769a075a 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -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
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h
index e950b9c50f34..d300dbcddaf3 100644
--- a/include/asm-generic/pgtable-nopud.h
+++ b/include/asm-generic/pgtable-nopud.h
@@ -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
--
2.19.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
2018-10-03 17:50 [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C James Morse
@ 2018-10-03 17:50 ` James Morse
2018-10-04 9:45 ` Catalin Marinas
1 sibling, 0 replies; 6+ messages in thread
From: James Morse @ 2018-10-03 17:50 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-arch, Arnd Bergmann, Will Deacon, Catalin Marinas,
James Morse, Mark Rutland
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'.
Signed-off-by: James Morse <james.morse@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
---
This fixes an issue with patches queued for arm64. Can it go via the arm64 tree?
Link: lore.kernel.org/r/0f9a3abc-4890-faf5-ee7e-18434641b858@arm.com
include/asm-generic/pgtable-nopmd.h | 2 +-
include/asm-generic/pgtable-nopud.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index f35f6e8149e4..fcb4769a075a 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -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
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h
index e950b9c50f34..d300dbcddaf3 100644
--- a/include/asm-generic/pgtable-nopud.h
+++ b/include/asm-generic/pgtable-nopud.h
@@ -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
--
2.19.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
2018-10-03 17:50 [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C James Morse
2018-10-03 17:50 ` James Morse
@ 2018-10-04 9:45 ` Catalin Marinas
2018-10-04 9:45 ` Catalin Marinas
2018-10-05 11:02 ` Mark Rutland
1 sibling, 2 replies; 6+ messages in thread
From: Catalin Marinas @ 2018-10-04 9:45 UTC (permalink / raw)
To: James Morse
Cc: linux-arch, Mark Rutland, Will Deacon, Arnd Bergmann, linux-arm-kernel
On Wed, Oct 03, 2018 at 06:50:52PM +0100, James Morse wrote:
> 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".
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.
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
2018-10-04 9:45 ` Catalin Marinas
@ 2018-10-04 9:45 ` Catalin Marinas
2018-10-05 11:02 ` Mark Rutland
1 sibling, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2018-10-04 9:45 UTC (permalink / raw)
To: James Morse
Cc: linux-arm-kernel, linux-arch, Arnd Bergmann, Will Deacon, Mark Rutland
On Wed, Oct 03, 2018 at 06:50:52PM +0100, James Morse wrote:
> 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".
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.
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
2018-10-04 9:45 ` Catalin Marinas
2018-10-04 9:45 ` Catalin Marinas
@ 2018-10-05 11:02 ` Mark Rutland
2018-10-05 11:02 ` Mark Rutland
1 sibling, 1 reply; 6+ messages in thread
From: Mark Rutland @ 2018-10-05 11:02 UTC (permalink / raw)
To: Catalin Marinas
Cc: linux-arch, Will Deacon, James Morse, Arnd Bergmann, linux-arm-kernel
On Thu, Oct 04, 2018 at 10:45:00AM +0100, Catalin Marinas wrote:
> On Wed, Oct 03, 2018 at 06:50:52PM +0100, James Morse wrote:
> > 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".
>
> 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.
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
2018-10-05 11:02 ` Mark Rutland
@ 2018-10-05 11:02 ` Mark Rutland
0 siblings, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2018-10-05 11:02 UTC (permalink / raw)
To: Catalin Marinas
Cc: James Morse, linux-arm-kernel, linux-arch, Arnd Bergmann, Will Deacon
On Thu, Oct 04, 2018 at 10:45:00AM +0100, Catalin Marinas wrote:
> On Wed, Oct 03, 2018 at 06:50:52PM +0100, James Morse wrote:
> > 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".
>
> 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.
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-10-05 18:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 17:50 [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C James Morse
2018-10-03 17:50 ` James Morse
2018-10-04 9:45 ` Catalin Marinas
2018-10-04 9:45 ` Catalin Marinas
2018-10-05 11:02 ` Mark Rutland
2018-10-05 11:02 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).