diff mbox series

[3/3] MIPS: Add support for LTO

Message ID 20211213224914.1501303-4-paul@crapouillou.net (mailing list archive)
State New
Headers show
Series MIPS: Add support for LTO | expand

Commit Message

Paul Cercueil Dec. 13, 2021, 10:49 p.m. UTC
Allow CONFIG_LTO_CLANG to be enabled. The ThinLTO variant is not yet
supported.

While this option allows to build a LTO'd kernel, the result kernel file
ends up being *bigger* than the non-LTO variant (about 3.6 MiB with LTO
vs. 3.1 MiB without with a ZSTD-compressed kernel).

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Nathan Chancellor Dec. 14, 2021, 6:09 p.m. UTC | #1
On Mon, Dec 13, 2021 at 10:49:14PM +0000, Paul Cercueil wrote:
> Allow CONFIG_LTO_CLANG to be enabled. The ThinLTO variant is not yet
> supported.
> 
> While this option allows to build a LTO'd kernel, the result kernel file
> ends up being *bigger* than the non-LTO variant (about 3.6 MiB with LTO
> vs. 3.1 MiB without with a ZSTD-compressed kernel).

I believe this happens because the linker is able to inline more, which
should make the code faster but makes it larger. I believe we limit the
inlining threshold so that it is not too bad but maybe that could be
further tuned.

> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 0215dc1529e9..6987db8d5f64 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -22,6 +22,7 @@ config MIPS
>  	select ARCH_USE_QUEUED_RWLOCKS
>  	select ARCH_USE_QUEUED_SPINLOCKS
>  	select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES
> +	select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN
>  	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
>  	select ARCH_WANT_IPC_PARSE_VERSION
>  	select ARCH_WANT_LD_ORPHAN_WARN
> -- 
> 2.33.0
> 
>
Nick Desaulniers Dec. 14, 2021, 7:45 p.m. UTC | #2
On Mon, Dec 13, 2021 at 2:49 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Allow CONFIG_LTO_CLANG to be enabled. The ThinLTO variant is not yet
> supported.
>
> While this option allows to build a LTO'd kernel, the result kernel file
> ends up being *bigger* than the non-LTO variant (about 3.6 MiB with LTO
> vs. 3.1 MiB without with a ZSTD-compressed kernel).

LGTM but I think there's more work to be done first based on my
comments on the earlier patches.

In particular, we should be able to boot the result and not have to
modify any Makefiles outside of the series to get it to link.

Good to know we're close though!  Don't give up!

>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 0215dc1529e9..6987db8d5f64 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -22,6 +22,7 @@ config MIPS
>         select ARCH_USE_QUEUED_RWLOCKS
>         select ARCH_USE_QUEUED_SPINLOCKS
>         select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES
> +       select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN
>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
>         select ARCH_WANT_IPC_PARSE_VERSION
>         select ARCH_WANT_LD_ORPHAN_WARN
> --
> 2.33.0
>
diff mbox series

Patch

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 0215dc1529e9..6987db8d5f64 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -22,6 +22,7 @@  config MIPS
 	select ARCH_USE_QUEUED_RWLOCKS
 	select ARCH_USE_QUEUED_SPINLOCKS
 	select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES
+	select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select ARCH_WANT_LD_ORPHAN_WARN