linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING
@ 2020-02-20 11:08 Masahiro Yamada
  2020-02-20 11:08 ` [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-02-20 11:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Ingo Molnar, Thomas Gleixner, x86,
	clang-built-linux, Miguel Ojeda, sparclinux, Masahiro Yamada,
	Andy Lutomirski, Borislav Petkov, David S. Miller,
	H. Peter Anvin, linux-kernel

The code, #undef CONFIG_OPTIMIZE_INLINING, is not working as expected
because <linux/compiler_types.h> is parsed before vclock_gettime.c
since 28128c61e08e ("kconfig.h: Include compiler types to avoid missed
struct attributes").

Since then, <linux/compiler_types.h> is included really early by
using the '-include' option. So, you cannot negate the decision of
<linux/compiler_types.h> in this way.

You can confirm it by checking the pre-processed code, like this:

  $ make arch/x86/entry/vdso/vdso32/vclock_gettime.i

There is no difference with/without CONFIG_CC_OPTIMIZE_FOR_SIZE.

It is about two years since 28128c61e08e. Nobody has reported a
problem (or, nobody has even noticed the fact that this code is not
working).

It is ugly and unreliable to attempt to undefine a CONFIG option from
C files, and anyway the inlining heuristic is up to the compiler.

Just remove the broken code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---

Changes in v2:
  - fix a type
  - add Acked-by

 arch/sparc/vdso/vdso32/vclock_gettime.c     | 4 ----
 arch/x86/entry/vdso/vdso32/vclock_gettime.c | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/arch/sparc/vdso/vdso32/vclock_gettime.c b/arch/sparc/vdso/vdso32/vclock_gettime.c
index 026abb3b826c..d7f99e6745ea 100644
--- a/arch/sparc/vdso/vdso32/vclock_gettime.c
+++ b/arch/sparc/vdso/vdso32/vclock_gettime.c
@@ -4,10 +4,6 @@
 
 #define	BUILD_VDSO32
 
-#ifndef	CONFIG_CC_OPTIMIZE_FOR_SIZE
-#undef	CONFIG_OPTIMIZE_INLINING
-#endif
-
 #ifdef	CONFIG_SPARC64
 
 /*
diff --git a/arch/x86/entry/vdso/vdso32/vclock_gettime.c b/arch/x86/entry/vdso/vdso32/vclock_gettime.c
index 9242b28418d5..3c26488db94d 100644
--- a/arch/x86/entry/vdso/vdso32/vclock_gettime.c
+++ b/arch/x86/entry/vdso/vdso32/vclock_gettime.c
@@ -1,10 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #define BUILD_VDSO32
 
-#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
-#undef CONFIG_OPTIMIZE_INLINING
-#endif
-
 #ifdef CONFIG_X86_64
 
 /*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely
  2020-02-20 11:08 [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Masahiro Yamada
@ 2020-02-20 11:08 ` Masahiro Yamada
  2020-02-20 17:42   ` Nathan Chancellor
  2020-02-20 17:41 ` [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Nathan Chancellor
  2020-03-19  7:20 ` Masahiro Yamada
  2 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2020-02-20 11:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Ingo Molnar, Thomas Gleixner, x86,
	clang-built-linux, Miguel Ojeda, sparclinux, Masahiro Yamada,
	Borislav Petkov, H. Peter Anvin, linux-kernel

Commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING
forcibly") made this always-on option. We released v5.4 and v5.5
including that commit.

Remove the CONFIG option and clean up the code now.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---

Changes in v2:
  - add Reviewed-by

 arch/x86/configs/i386_defconfig   |  1 -
 arch/x86/configs/x86_64_defconfig |  1 -
 include/linux/compiler_types.h    | 11 +----------
 kernel/configs/tiny.config        |  1 -
 lib/Kconfig.debug                 | 12 ------------
 5 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 59ce9ed58430..d961d831c266 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -288,7 +288,6 @@ CONFIG_EARLY_PRINTK_DBGP=y
 CONFIG_DEBUG_STACKOVERFLOW=y
 # CONFIG_DEBUG_RODATA_TEST is not set
 CONFIG_DEBUG_BOOT_PARAMS=y
-CONFIG_OPTIMIZE_INLINING=y
 CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 CONFIG_SECURITY_SELINUX=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 0b9654c7a05c..4826254c6140 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -285,7 +285,6 @@ CONFIG_EARLY_PRINTK_DBGP=y
 CONFIG_DEBUG_STACKOVERFLOW=y
 # CONFIG_DEBUG_RODATA_TEST is not set
 CONFIG_DEBUG_BOOT_PARAMS=y
-CONFIG_OPTIMIZE_INLINING=y
 CONFIG_UNWINDER_ORC=y
 CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 72393a8c1a6c..e970f97a7fcb 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -129,22 +129,13 @@ struct ftrace_likely_data {
 #define __compiler_offsetof(a, b)	__builtin_offsetof(a, b)
 
 /*
- * Force always-inline if the user requests it so via the .config.
  * Prefer gnu_inline, so that extern inline functions do not emit an
  * externally visible function. This makes extern inline behave as per gnu89
  * semantics rather than c99. This prevents multiple symbol definition errors
  * of extern inline functions at link time.
  * A lot of inline functions can cause havoc with function tracing.
- * Do not use __always_inline here, since currently it expands to inline again
- * (which would break users of __always_inline).
  */
-#if !defined(CONFIG_OPTIMIZE_INLINING)
-#define inline inline __attribute__((__always_inline__)) __gnu_inline \
-	__inline_maybe_unused notrace
-#else
-#define inline inline                                    __gnu_inline \
-	__inline_maybe_unused notrace
-#endif
+#define inline inline __gnu_inline __inline_maybe_unused notrace
 
 /*
  * gcc provides both __inline__ and __inline as alternate spellings of
diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config
index 7fa0c4ae6394..8a44b93da0f3 100644
--- a/kernel/configs/tiny.config
+++ b/kernel/configs/tiny.config
@@ -6,7 +6,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_KERNEL_XZ=y
 # CONFIG_KERNEL_LZO is not set
 # CONFIG_KERNEL_LZ4 is not set
-CONFIG_OPTIMIZE_INLINING=y
 # CONFIG_SLAB is not set
 # CONFIG_SLUB is not set
 CONFIG_SLOB=y
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 69def4a9df00..5abde39c3c69 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -305,18 +305,6 @@ config HEADERS_INSTALL
 	  user-space program samples. It is also needed by some features such
 	  as uapi header sanity checks.
 
-config OPTIMIZE_INLINING
-	def_bool y
-	help
-	  This option determines if the kernel forces gcc to inline the functions
-	  developers have marked 'inline'. Doing so takes away freedom from gcc to
-	  do what it thinks is best, which is desirable for the gcc 3.x series of
-	  compilers. The gcc 4.x series have a rewritten inlining algorithm and
-	  enabling this option will generate a smaller kernel there. Hopefully
-	  this algorithm is so good that allowing gcc 4.x and above to make the
-	  decision will become the default in the future. Until then this option
-	  is there to test gcc for this.
-
 config DEBUG_SECTION_MISMATCH
 	bool "Enable full Section mismatch analysis"
 	help
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING
  2020-02-20 11:08 [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Masahiro Yamada
  2020-02-20 11:08 ` [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely Masahiro Yamada
@ 2020-02-20 17:41 ` Nathan Chancellor
  2020-03-19  7:20 ` Masahiro Yamada
  2 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2020-02-20 17:41 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Andrew Morton, Arnd Bergmann, Ingo Molnar, Thomas Gleixner, x86,
	clang-built-linux, Miguel Ojeda, sparclinux, Andy Lutomirski,
	Borislav Petkov, David S. Miller, H. Peter Anvin, linux-kernel

On Thu, Feb 20, 2020 at 08:08:06PM +0900, Masahiro Yamada wrote:
> The code, #undef CONFIG_OPTIMIZE_INLINING, is not working as expected
> because <linux/compiler_types.h> is parsed before vclock_gettime.c
> since 28128c61e08e ("kconfig.h: Include compiler types to avoid missed
> struct attributes").
> 
> Since then, <linux/compiler_types.h> is included really early by
> using the '-include' option. So, you cannot negate the decision of
> <linux/compiler_types.h> in this way.
> 
> You can confirm it by checking the pre-processed code, like this:
> 
>   $ make arch/x86/entry/vdso/vdso32/vclock_gettime.i
> 
> There is no difference with/without CONFIG_CC_OPTIMIZE_FOR_SIZE.
> 
> It is about two years since 28128c61e08e. Nobody has reported a
> problem (or, nobody has even noticed the fact that this code is not
> working).
> 
> It is ugly and unreliable to attempt to undefine a CONFIG option from
> C files, and anyway the inlining heuristic is up to the compiler.
> 
> Just remove the broken code.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely
  2020-02-20 11:08 ` [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely Masahiro Yamada
@ 2020-02-20 17:42   ` Nathan Chancellor
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2020-02-20 17:42 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Andrew Morton, Arnd Bergmann, Ingo Molnar, Thomas Gleixner, x86,
	clang-built-linux, Miguel Ojeda, sparclinux, Borislav Petkov,
	H. Peter Anvin, linux-kernel

On Thu, Feb 20, 2020 at 08:08:07PM +0900, Masahiro Yamada wrote:
> Commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING
> forcibly") made this always-on option. We released v5.4 and v5.5
> including that commit.
> 
> Remove the CONFIG option and clean up the code now.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING
  2020-02-20 11:08 [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Masahiro Yamada
  2020-02-20 11:08 ` [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely Masahiro Yamada
  2020-02-20 17:41 ` [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Nathan Chancellor
@ 2020-03-19  7:20 ` Masahiro Yamada
  2020-04-03  5:57   ` Masahiro Yamada
  2 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2020-03-19  7:20 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Ingo Molnar, Thomas Gleixner, X86 ML,
	clang-built-linux, Miguel Ojeda, sparclinux, Andy Lutomirski,
	Borislav Petkov, David S. Miller, H. Peter Anvin,
	Linux Kernel Mailing List

Hi Andrew,

Ping.
Could you pick up this series?


Thanks.


On Thu, Feb 20, 2020 at 8:08 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> The code, #undef CONFIG_OPTIMIZE_INLINING, is not working as expected
> because <linux/compiler_types.h> is parsed before vclock_gettime.c
> since 28128c61e08e ("kconfig.h: Include compiler types to avoid missed
> struct attributes").
>
> Since then, <linux/compiler_types.h> is included really early by
> using the '-include' option. So, you cannot negate the decision of
> <linux/compiler_types.h> in this way.
>
> You can confirm it by checking the pre-processed code, like this:
>
>   $ make arch/x86/entry/vdso/vdso32/vclock_gettime.i
>
> There is no difference with/without CONFIG_CC_OPTIMIZE_FOR_SIZE.
>
> It is about two years since 28128c61e08e. Nobody has reported a
> problem (or, nobody has even noticed the fact that this code is not
> working).
>
> It is ugly and unreliable to attempt to undefine a CONFIG option from
> C files, and anyway the inlining heuristic is up to the compiler.
>
> Just remove the broken code.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> ---
>
> Changes in v2:
>   - fix a type
>   - add Acked-by
>
>  arch/sparc/vdso/vdso32/vclock_gettime.c     | 4 ----
>  arch/x86/entry/vdso/vdso32/vclock_gettime.c | 4 ----
>  2 files changed, 8 deletions(-)
>
> diff --git a/arch/sparc/vdso/vdso32/vclock_gettime.c b/arch/sparc/vdso/vdso32/vclock_gettime.c
> index 026abb3b826c..d7f99e6745ea 100644
> --- a/arch/sparc/vdso/vdso32/vclock_gettime.c
> +++ b/arch/sparc/vdso/vdso32/vclock_gettime.c
> @@ -4,10 +4,6 @@
>
>  #define        BUILD_VDSO32
>
> -#ifndef        CONFIG_CC_OPTIMIZE_FOR_SIZE
> -#undef CONFIG_OPTIMIZE_INLINING
> -#endif
> -
>  #ifdef CONFIG_SPARC64
>
>  /*
> diff --git a/arch/x86/entry/vdso/vdso32/vclock_gettime.c b/arch/x86/entry/vdso/vdso32/vclock_gettime.c
> index 9242b28418d5..3c26488db94d 100644
> --- a/arch/x86/entry/vdso/vdso32/vclock_gettime.c
> +++ b/arch/x86/entry/vdso/vdso32/vclock_gettime.c
> @@ -1,10 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #define BUILD_VDSO32
>
> -#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
> -#undef CONFIG_OPTIMIZE_INLINING
> -#endif
> -
>  #ifdef CONFIG_X86_64
>
>  /*
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200220110807.32534-1-masahiroy%40kernel.org.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING
  2020-03-19  7:20 ` Masahiro Yamada
@ 2020-04-03  5:57   ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-04-03  5:57 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Ingo Molnar, Thomas Gleixner, X86 ML,
	clang-built-linux, Miguel Ojeda, sparclinux, Andy Lutomirski,
	Borislav Petkov, David S. Miller, H. Peter Anvin,
	Linux Kernel Mailing List

On Thu, Mar 19, 2020 at 4:20 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Hi Andrew,
>
> Ping.
> Could you pick up this series?
>
>
> Thanks.
>
>
> On Thu, Feb 20, 2020 at 8:08 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > The code, #undef CONFIG_OPTIMIZE_INLINING, is not working as expected
> > because <linux/compiler_types.h> is parsed before vclock_gettime.c
> > since 28128c61e08e ("kconfig.h: Include compiler types to avoid missed
> > struct attributes").
> >
> > Since then, <linux/compiler_types.h> is included really early by
> > using the '-include' option. So, you cannot negate the decision of
> > <linux/compiler_types.h> in this way.
> >
> > You can confirm it by checking the pre-processed code, like this:
> >
> >   $ make arch/x86/entry/vdso/vdso32/vclock_gettime.i
> >
> > There is no difference with/without CONFIG_CC_OPTIMIZE_FOR_SIZE.
> >
> > It is about two years since 28128c61e08e. Nobody has reported a
> > problem (or, nobody has even noticed the fact that this code is not
> > working).
> >
> > It is ugly and unreliable to attempt to undefine a CONFIG option from
> > C files, and anyway the inlining heuristic is up to the compiler.
> >
> > Just remove the broken code.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>



I think adding the patch author to Cc:
is strange.



The footer of 6290b47e9aa282c11f38390931b06402c553dbc4
looks like this.


    Link: http://lkml.kernel.org/r/20200220110807.32534-1-masahiroy@kernel.org
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
    Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Masahiro Yamada <masahiroy@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: David Miller <davem@davemloft.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>



"Cc: Masahiro Yamada <masahiroy@kernel.org>"
is unneeded since I am the author.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-03  5:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 11:08 [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Masahiro Yamada
2020-02-20 11:08 ` [PATCH v2 2/2] compiler: Remove CONFIG_OPTIMIZE_INLINING entirely Masahiro Yamada
2020-02-20 17:42   ` Nathan Chancellor
2020-02-20 17:41 ` [PATCH v2 1/2] sparc,x86: vdso: remove meaningless undefining CONFIG_OPTIMIZE_INLINING Nathan Chancellor
2020-03-19  7:20 ` Masahiro Yamada
2020-04-03  5:57   ` Masahiro Yamada

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).