* [PATCH] x86: mark native_set_p4d() as __always_inline
@ 2018-06-05 11:35 Arnd Bergmann
2018-06-05 14:10 ` Kirill A. Shutemov
2018-06-06 10:12 ` [tip:x86/urgent] x86: Mark " tip-bot for Arnd Bergmann
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-06-05 11:35 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, x86
Cc: Arnd Bergmann, H. Peter Anvin, Kirill A. Shutemov, Andrew Morton,
Dave Hansen, Greg Kroah-Hartman, Zi Yan, Naoya Horiguchi,
linux-kernel
When CONFIG_OPTIMIZE_INLINING is enabled, the function native_set_p4d()
may not be fully inlined into the caller, resulting in a false-positive
warning about an access to the __pgtable_l5_enabled variable from a
non-__init function, despite the original caller being an __init function:
WARNING: vmlinux.o(.text.unlikely+0x1429): Section mismatch in reference from the function native_set_p4d() to the variable .init.data:__pgtable_l5_enabled
WARNING: vmlinux.o(.text.unlikely+0x1429): Section mismatch in reference from the function native_p4d_clear() to the variable .init.data:__pgtable_l5_enabled
The function native_set_p4d() references
the variable __initdata __pgtable_l5_enabled.
This is often because native_set_p4d lacks a __initdata
annotation or the annotation of __pgtable_l5_enabled is wrong.
Marking the native_set_p4d function and its caller native_p4d_clear()
avoids this problem.
I did not bisect the original cause, but I assume this is related to
the recent rework that turned pgtable_l5_enabled() into an inline
function, which in turn caused the compiler to make different inlining
decisions.
Fixes: ad3fe525b950 ("x86/mm: Unify pgtable_l5_enabled usage in early boot code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/include/asm/pgtable_64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 3c5385f9a88f..0fdcd21dadbd 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -216,7 +216,7 @@ static inline pgd_t pti_set_user_pgd(pgd_t *pgdp, pgd_t pgd)
}
#endif
-static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
+static __always_inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
{
pgd_t pgd;
@@ -230,7 +230,7 @@ static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
*p4dp = native_make_p4d(native_pgd_val(pgd));
}
-static inline void native_p4d_clear(p4d_t *p4d)
+static __always_inline void native_p4d_clear(p4d_t *p4d)
{
native_set_p4d(p4d, native_make_p4d(0));
}
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: mark native_set_p4d() as __always_inline
2018-06-05 11:35 [PATCH] x86: mark native_set_p4d() as __always_inline Arnd Bergmann
@ 2018-06-05 14:10 ` Kirill A. Shutemov
2018-06-06 10:12 ` [tip:x86/urgent] x86: Mark " tip-bot for Arnd Bergmann
1 sibling, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2018-06-05 14:10 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Thomas Gleixner, Ingo Molnar, x86, H. Peter Anvin, Andrew Morton,
Dave Hansen, Greg Kroah-Hartman, Zi Yan, Naoya Horiguchi,
linux-kernel
On Tue, Jun 05, 2018 at 11:35:15AM +0000, Arnd Bergmann wrote:
> When CONFIG_OPTIMIZE_INLINING is enabled, the function native_set_p4d()
> may not be fully inlined into the caller, resulting in a false-positive
> warning about an access to the __pgtable_l5_enabled variable from a
> non-__init function, despite the original caller being an __init function:
>
> WARNING: vmlinux.o(.text.unlikely+0x1429): Section mismatch in reference from the function native_set_p4d() to the variable .init.data:__pgtable_l5_enabled
> WARNING: vmlinux.o(.text.unlikely+0x1429): Section mismatch in reference from the function native_p4d_clear() to the variable .init.data:__pgtable_l5_enabled
> The function native_set_p4d() references
> the variable __initdata __pgtable_l5_enabled.
> This is often because native_set_p4d lacks a __initdata
> annotation or the annotation of __pgtable_l5_enabled is wrong.
>
> Marking the native_set_p4d function and its caller native_p4d_clear()
> avoids this problem.
>
> I did not bisect the original cause, but I assume this is related to
> the recent rework that turned pgtable_l5_enabled() into an inline
> function, which in turn caused the compiler to make different inlining
> decisions.
>
> Fixes: ad3fe525b950 ("x86/mm: Unify pgtable_l5_enabled usage in early boot code")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks for fixing this.
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Do you have a clue which native_set_p4d() call causes the issue?
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:x86/urgent] x86: Mark native_set_p4d() as __always_inline
2018-06-05 11:35 [PATCH] x86: mark native_set_p4d() as __always_inline Arnd Bergmann
2018-06-05 14:10 ` Kirill A. Shutemov
@ 2018-06-06 10:12 ` tip-bot for Arnd Bergmann
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Arnd Bergmann @ 2018-06-06 10:12 UTC (permalink / raw)
To: linux-tip-commits
Cc: gregkh, tglx, kirill.shutemov, linux-kernel, hpa, akpm, zi.yan,
n-horiguchi, dave.hansen, arnd, mingo
Commit-ID: 046c0dbec0238c25b7526c26c9a9687664229ce2
Gitweb: https://git.kernel.org/tip/046c0dbec0238c25b7526c26c9a9687664229ce2
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Tue, 5 Jun 2018 13:35:15 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 6 Jun 2018 12:09:45 +0200
x86: Mark native_set_p4d() as __always_inline
When CONFIG_OPTIMIZE_INLINING is enabled, the function native_set_p4d()
may not be fully inlined into the caller, resulting in a false-positive
warning about an access to the __pgtable_l5_enabled variable from a
non-__init function, despite the original caller being an __init function:
WARNING: vmlinux.o(.text.unlikely+0x1429): Section mismatch in reference from the function native_set_p4d() to the variable .init.data:__pgtable_l5_enabled
WARNING: vmlinux.o(.text.unlikely+0x1429): Section mismatch in reference from the function native_p4d_clear() to the variable .init.data:__pgtable_l5_enabled
The function native_set_p4d() references the variable __initdata
__pgtable_l5_enabled. This is often because native_set_p4d lacks a
__initdata annotation or the annotation of __pgtable_l5_enabled is wrong.
Marking the native_set_p4d function and its caller native_p4d_clear()
avoids this problem.
I did not bisect the original cause, but I assume this is related to the
recent rework that turned pgtable_l5_enabled() into an inline function,
which in turn caused the compiler to make different inlining decisions.
Fixes: ad3fe525b950 ("x86/mm: Unify pgtable_l5_enabled usage in early boot code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Zi Yan <zi.yan@cs.rutgers.edu>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Link: https://lkml.kernel.org/r/20180605113715.1133726-1-arnd@arndb.de
---
arch/x86/include/asm/pgtable_64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 877bc27718ae..c750112cb416 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -216,7 +216,7 @@ static inline pgd_t pti_set_user_pgd(pgd_t *pgdp, pgd_t pgd)
}
#endif
-static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
+static __always_inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
{
pgd_t pgd;
@@ -230,7 +230,7 @@ static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
*p4dp = native_make_p4d(native_pgd_val(pgd));
}
-static inline void native_p4d_clear(p4d_t *p4d)
+static __always_inline void native_p4d_clear(p4d_t *p4d)
{
native_set_p4d(p4d, native_make_p4d(0));
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-06 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 11:35 [PATCH] x86: mark native_set_p4d() as __always_inline Arnd Bergmann
2018-06-05 14:10 ` Kirill A. Shutemov
2018-06-06 10:12 ` [tip:x86/urgent] x86: Mark " tip-bot for Arnd Bergmann
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).