* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:26 ` [PATCH] Extract initrd free logic from arch-specific code Shea Levy
@ 2018-03-28 15:58 ` Rob Landley
2018-03-28 16:04 ` Shea Levy
2018-03-28 16:48 ` Russell King - ARM Linux
2018-03-28 16:55 ` Kees Cook
` (3 subsequent siblings)
4 siblings, 2 replies; 26+ messages in thread
From: Rob Landley @ 2018-03-28 15:58 UTC (permalink / raw)
To: Shea Levy, linux-riscv, linux-kernel
Cc: Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, Geert Uytterhoeven, James Hogan, Michal Simek,
Ralf Baechle, David Howells, Ley Foon Tan, Jonas Bonn,
Stefan Kristiansson, Stafford Horne, James E.J. Bottomley,
Helge Deller, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Palmer Dabbelt, Albert Ou, Martin Schwidefsky,
Heiko Carstens, Chen Liqin, Lennox Wu, Rich Felker,
David S. Miller, Jeff Dike, Richard Weinberger, Guan Xuetao,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On 03/28/2018 10:26 AM, Shea Levy wrote:
> Now only those architectures that have custom initrd free requirements
> need to define free_initrd_mem.
...
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> {
> free_initmem_default(-1);
> }
> -
> -#ifdef CONFIG_BLK_DEV_INITRD
> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> -{
> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> -}
> -#endif
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3f972e83909b..19d1c5594e2d 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -47,6 +47,7 @@ config ARM
> select HARDIRQS_SW_RESEND
> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> + select HAVE_ARCH_FREE_INITRD_MEM
> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> select HAVE_ARCH_MMAP_RND_BITS if MMU
Isn't this why weak symbols were invented?
Confused,
Rob
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:58 ` Rob Landley
@ 2018-03-28 16:04 ` Shea Levy
2018-03-28 16:48 ` Russell King - ARM Linux
1 sibling, 0 replies; 26+ messages in thread
From: Shea Levy @ 2018-03-28 16:04 UTC (permalink / raw)
To: Rob Landley, linux-riscv, linux-kernel
Cc: Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, Geert Uytterhoeven, James Hogan, Michal Simek,
Ralf Baechle, David Howells, Ley Foon Tan, Jonas Bonn,
Stefan Kristiansson, Stafford Horne, James E.J. Bottomley,
Helge Deller, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Palmer Dabbelt, Albert Ou, Martin Schwidefsky,
Heiko Carstens, Chen Liqin, Lennox Wu, Rich Felker,
David S. Miller, Jeff Dike, Richard Weinberger, Guan Xuetao,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]
Hi Rob,
Rob Landley <rob@landley.net> writes:
> On 03/28/2018 10:26 AM, Shea Levy wrote:
>> Now only those architectures that have custom initrd free requirements
>> need to define free_initrd_mem.
> ...
>> --- a/arch/arc/mm/init.c
>> +++ b/arch/arc/mm/init.c
>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
>> {
>> free_initmem_default(-1);
>> }
>> -
>> -#ifdef CONFIG_BLK_DEV_INITRD
>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
>> -{
>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
>> -}
>> -#endif
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 3f972e83909b..19d1c5594e2d 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -47,6 +47,7 @@ config ARM
>> select HARDIRQS_SW_RESEND
>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
>> + select HAVE_ARCH_FREE_INITRD_MEM
>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
>> select HAVE_ARCH_MMAP_RND_BITS if MMU
>
> Isn't this why weak symbols were invented?
>
This approach was suggested by Christoph Hellwig upthread, and seems to
have some precedent elsewhere (e.g. strncasecmp), but I agree weak
symbols seem appropriate here. I'm happy to implement either approach!
>
> Confused,
>
> Rob
Thanks,
Shea
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:58 ` Rob Landley
2018-03-28 16:04 ` Shea Levy
@ 2018-03-28 16:48 ` Russell King - ARM Linux
2018-03-28 19:04 ` Rob Landley
1 sibling, 1 reply; 26+ messages in thread
From: Russell King - ARM Linux @ 2018-03-28 16:48 UTC (permalink / raw)
To: Rob Landley
Cc: Shea Levy, linux-riscv, linux-kernel, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> On 03/28/2018 10:26 AM, Shea Levy wrote:
> > Now only those architectures that have custom initrd free requirements
> > need to define free_initrd_mem.
> ...
> > --- a/arch/arc/mm/init.c
> > +++ b/arch/arc/mm/init.c
> > @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> > {
> > free_initmem_default(-1);
> > }
> > -
> > -#ifdef CONFIG_BLK_DEV_INITRD
> > -void __init free_initrd_mem(unsigned long start, unsigned long end)
> > -{
> > - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> > -}
> > -#endif
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 3f972e83909b..19d1c5594e2d 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -47,6 +47,7 @@ config ARM
> > select HARDIRQS_SW_RESEND
> > select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> > select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> > + select HAVE_ARCH_FREE_INITRD_MEM
> > select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> > select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> > select HAVE_ARCH_MMAP_RND_BITS if MMU
>
> Isn't this why weak symbols were invented?
Weak symbols means that we end up with both the weakly-referenced code
and the arch code in the kernel image. That's fine if the weak code
is small.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 16:48 ` Russell King - ARM Linux
@ 2018-03-28 19:04 ` Rob Landley
2018-03-28 22:14 ` Russell King - ARM Linux
0 siblings, 1 reply; 26+ messages in thread
From: Rob Landley @ 2018-03-28 19:04 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Shea Levy, linux-riscv, linux-kernel, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
>> On 03/28/2018 10:26 AM, Shea Levy wrote:
>>> Now only those architectures that have custom initrd free requirements
>>> need to define free_initrd_mem.
>> ...
>>> --- a/arch/arc/mm/init.c
>>> +++ b/arch/arc/mm/init.c
>>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
>>> {
>>> free_initmem_default(-1);
>>> }
>>> -
>>> -#ifdef CONFIG_BLK_DEV_INITRD
>>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
>>> -{
>>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
>>> -}
>>> -#endif
>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>>> index 3f972e83909b..19d1c5594e2d 100644
>>> --- a/arch/arm/Kconfig
>>> +++ b/arch/arm/Kconfig
>>> @@ -47,6 +47,7 @@ config ARM
>>> select HARDIRQS_SW_RESEND
>>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
>>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
>>> + select HAVE_ARCH_FREE_INITRD_MEM
>>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
>>> select HAVE_ARCH_MMAP_RND_BITS if MMU
>>
>> Isn't this why weak symbols were invented?
>
> Weak symbols means that we end up with both the weakly-referenced code
> and the arch code in the kernel image. That's fine if the weak code
> is small.
The kernel's been able to build with link time garbage collection since 2016:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
Wouldn't that remove the unused one?
Rob
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 19:04 ` Rob Landley
@ 2018-03-28 22:14 ` Russell King - ARM Linux
2018-03-28 22:37 ` Oliver
2018-03-29 16:39 ` Rob Landley
0 siblings, 2 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2018-03-28 22:14 UTC (permalink / raw)
To: Rob Landley
Cc: Shea Levy, linux-riscv, linux-kernel, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
>
>
> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
> >>> Now only those architectures that have custom initrd free requirements
> >>> need to define free_initrd_mem.
> >> ...
> >>> --- a/arch/arc/mm/init.c
> >>> +++ b/arch/arc/mm/init.c
> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> >>> {
> >>> free_initmem_default(-1);
> >>> }
> >>> -
> >>> -#ifdef CONFIG_BLK_DEV_INITRD
> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> >>> -{
> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> >>> -}
> >>> -#endif
> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >>> index 3f972e83909b..19d1c5594e2d 100644
> >>> --- a/arch/arm/Kconfig
> >>> +++ b/arch/arm/Kconfig
> >>> @@ -47,6 +47,7 @@ config ARM
> >>> select HARDIRQS_SW_RESEND
> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> >>> + select HAVE_ARCH_FREE_INITRD_MEM
> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> >>
> >> Isn't this why weak symbols were invented?
> >
> > Weak symbols means that we end up with both the weakly-referenced code
> > and the arch code in the kernel image. That's fine if the weak code
> > is small.
>
> The kernel's been able to build with link time garbage collection since 2016:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
>
> Wouldn't that remove the unused one?
Probably, if anyone bothered to use that, which they don't.
LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
what I can see, nothing selects it. Therefore, the symbol is always
disabled, and so the feature never gets used in mainline kernels.
Brings up the obvious question - why is it there if it's completely
unused? (Maybe to cause confusion, and allowing a justification
for __weak ?)
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 22:14 ` Russell King - ARM Linux
@ 2018-03-28 22:37 ` Oliver
2018-03-29 0:23 ` Nicholas Piggin
2018-03-29 15:27 ` Russell King - ARM Linux
2018-03-29 16:39 ` Rob Landley
1 sibling, 2 replies; 26+ messages in thread
From: Oliver @ 2018-03-28 22:37 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Rob Landley, Shea Levy, linux-riscv, linux-kernel,
Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Vineet Gupta, Catalin Marinas, Will Deacon,
Mark Salter, Aurelien Jacquiot, Mikael Starvik, Jesper Nilsson,
Yoshinori Sato, Richard Kuo, Tony Luck, Fenghua Yu,
Geert Uytterhoeven, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Chris Zankel, Max Filippov, Kate Stewart,
Greg Kroah-Hartman, Philippe Ombredanne, Eugeniy Paltsev, Al Viro,
Vladimir Murzin, Linus Walleij, Michal Hocko, Andrew Morton,
Sudip Mukherjee, Marc Zyngier, Rob Herring, Kees Cook,
Vlastimil Babka, Balbir Singh, Christophe Leroy, Joe Perches,
Dan Williams, Wei Yang, Christian König, Arnd Bergmann,
Deepa Dinamani, Daniel Thompson, Florian Fainelli, linux-alpha,
linux-snps-arc, linux-arm-kernel, adi-buildroot-devel,
linux-c6x-dev, linux-cris-kernel, uclinux-h8-devel, linux-hexagon,
linux-ia64, linux-m68k, linux-metag, linux-mips, linux-am33-list,
nios2-dev, openrisc, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa, Nicholas Piggin
On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
>>
>>
>> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
>> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
>> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
>> >>> Now only those architectures that have custom initrd free requirements
>> >>> need to define free_initrd_mem.
>> >> ...
>> >>> --- a/arch/arc/mm/init.c
>> >>> +++ b/arch/arc/mm/init.c
>> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
>> >>> {
>> >>> free_initmem_default(-1);
>> >>> }
>> >>> -
>> >>> -#ifdef CONFIG_BLK_DEV_INITRD
>> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
>> >>> -{
>> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
>> >>> -}
>> >>> -#endif
>> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> >>> index 3f972e83909b..19d1c5594e2d 100644
>> >>> --- a/arch/arm/Kconfig
>> >>> +++ b/arch/arm/Kconfig
>> >>> @@ -47,6 +47,7 @@ config ARM
>> >>> select HARDIRQS_SW_RESEND
>> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
>> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
>> >>> + select HAVE_ARCH_FREE_INITRD_MEM
>> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
>> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
>> >>
>> >> Isn't this why weak symbols were invented?
>> >
>> > Weak symbols means that we end up with both the weakly-referenced code
>> > and the arch code in the kernel image. That's fine if the weak code
>> > is small.
>>
>> The kernel's been able to build with link time garbage collection since 2016:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
>>
>> Wouldn't that remove the unused one?
>
> Probably, if anyone bothered to use that, which they don't.
>
> LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> what I can see, nothing selects it. Therefore, the symbol is always
> disabled, and so the feature never gets used in mainline kernels.
>
> Brings up the obvious question - why is it there if it's completely
> unused? (Maybe to cause confusion, and allowing a justification
> for __weak ?)
IIRC Nick had some patches to do the arch enablement for powerpc, but
I'm not sure what happened to them though. I suspect it just fell down
Nick's ever growing TODO list.
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 22:37 ` Oliver
@ 2018-03-29 0:23 ` Nicholas Piggin
2018-03-29 15:27 ` Russell King - ARM Linux
1 sibling, 0 replies; 26+ messages in thread
From: Nicholas Piggin @ 2018-03-29 0:23 UTC (permalink / raw)
To: Oliver
Cc: Russell King - ARM Linux, Rob Landley, Shea Levy, linux-riscv,
linux-kernel, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, Geert Uytterhoeven, James Hogan, Michal Simek,
Ralf Baechle, David Howells, Ley Foon Tan, Jonas Bonn,
Stefan Kristiansson, Stafford Horne, James E.J. Bottomley,
Helge Deller, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Palmer Dabbelt, Albert Ou, Martin Schwidefsky,
Heiko Carstens, Chen Liqin, Lennox Wu, Rich Felker,
David S. Miller, Jeff Dike, Richard Weinberger, Guan Xuetao,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches, Dan Williams,
Wei Yang, Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On Thu, 29 Mar 2018 09:37:52 +1100
Oliver <oohall@gmail.com> wrote:
> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
> >>
> >>
> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> >> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> >> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
> >> >>> Now only those architectures that have custom initrd free requirements
> >> >>> need to define free_initrd_mem.
> >> >> ...
> >> >>> --- a/arch/arc/mm/init.c
> >> >>> +++ b/arch/arc/mm/init.c
> >> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> >> >>> {
> >> >>> free_initmem_default(-1);
> >> >>> }
> >> >>> -
> >> >>> -#ifdef CONFIG_BLK_DEV_INITRD
> >> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> >> >>> -{
> >> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> >> >>> -}
> >> >>> -#endif
> >> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >> >>> index 3f972e83909b..19d1c5594e2d 100644
> >> >>> --- a/arch/arm/Kconfig
> >> >>> +++ b/arch/arm/Kconfig
> >> >>> @@ -47,6 +47,7 @@ config ARM
> >> >>> select HARDIRQS_SW_RESEND
> >> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> >> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> >> >>> + select HAVE_ARCH_FREE_INITRD_MEM
> >> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> >> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> >> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> >> >>
> >> >> Isn't this why weak symbols were invented?
> >> >
> >> > Weak symbols means that we end up with both the weakly-referenced code
> >> > and the arch code in the kernel image. That's fine if the weak code
> >> > is small.
> >>
> >> The kernel's been able to build with link time garbage collection since 2016:
> >>
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
> >>
> >> Wouldn't that remove the unused one?
> >
> > Probably, if anyone bothered to use that, which they don't.
> >
> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> > what I can see, nothing selects it. Therefore, the symbol is always
> > disabled, and so the feature never gets used in mainline kernels.
> >
> > Brings up the obvious question - why is it there if it's completely
> > unused? (Maybe to cause confusion, and allowing a justification
> > for __weak ?)
Well weak symbols have been used long before it was added.
> IIRC Nick had some patches to do the arch enablement for powerpc, but
> I'm not sure what happened to them though. I suspect it just fell down
> Nick's ever growing TODO list.
Yeah I had started some patches for powerpc and x86 that have ended up
on the back burner. There's been some MIPS people playing with it too.
For the kernel, LD_DEAD_CODE_DATA_ELIMINATION is not great. It can save
a little, but you get issues like any exception table entry or bug table
entry in a function will create a reference back to the function, so the
linker can't trim it away even if nothing else references it.
I'll try to take another look at it within the next few months and
remove it if I can't make progress.
Nicolas Pitre has been doing some much better work on dead code using
real LTO.
Thanks,
Nick
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 22:37 ` Oliver
2018-03-29 0:23 ` Nicholas Piggin
@ 2018-03-29 15:27 ` Russell King - ARM Linux
2018-03-29 15:43 ` Geert Uytterhoeven
2018-03-29 17:43 ` Rob Landley
1 sibling, 2 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2018-03-29 15:27 UTC (permalink / raw)
To: Oliver
Cc: Rob Landley, Shea Levy, linux-riscv, linux-kernel,
Christoph Hellwig, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Vineet Gupta, Catalin Marinas, Will Deacon,
Mark Salter, Aurelien Jacquiot, Mikael Starvik, Jesper Nilsson,
Yoshinori Sato, Richard Kuo, Tony Luck, Fenghua Yu,
Geert Uytterhoeven, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Chris Zankel, Max Filippov, Kate Stewart,
Greg Kroah-Hartman, Philippe Ombredanne, Eugeniy Paltsev, Al Viro,
Vladimir Murzin, Linus Walleij, Michal Hocko, Andrew Morton,
Sudip Mukherjee, Marc Zyngier, Rob Herring, Kees Cook,
Vlastimil Babka, Balbir Singh, Christophe Leroy, Joe Perches,
Dan Williams, Wei Yang, Christian König, Arnd Bergmann,
Deepa Dinamani, Daniel Thompson, Florian Fainelli, linux-alpha,
linux-snps-arc, linux-arm-kernel, adi-buildroot-devel,
linux-c6x-dev, linux-cris-kernel, uclinux-h8-devel, linux-hexagon,
linux-ia64, linux-m68k, linux-metag, linux-mips, linux-am33-list,
nios2-dev, openrisc, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa, Nicholas Piggin
On Thu, Mar 29, 2018 at 09:37:52AM +1100, Oliver wrote:
> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
> >>
> >>
> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> >> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> >> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
> >> >>> Now only those architectures that have custom initrd free requirements
> >> >>> need to define free_initrd_mem.
> >> >> ...
> >> >>> --- a/arch/arc/mm/init.c
> >> >>> +++ b/arch/arc/mm/init.c
> >> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> >> >>> {
> >> >>> free_initmem_default(-1);
> >> >>> }
> >> >>> -
> >> >>> -#ifdef CONFIG_BLK_DEV_INITRD
> >> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> >> >>> -{
> >> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> >> >>> -}
> >> >>> -#endif
> >> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >> >>> index 3f972e83909b..19d1c5594e2d 100644
> >> >>> --- a/arch/arm/Kconfig
> >> >>> +++ b/arch/arm/Kconfig
> >> >>> @@ -47,6 +47,7 @@ config ARM
> >> >>> select HARDIRQS_SW_RESEND
> >> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> >> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> >> >>> + select HAVE_ARCH_FREE_INITRD_MEM
> >> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> >> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> >> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> >> >>
> >> >> Isn't this why weak symbols were invented?
> >> >
> >> > Weak symbols means that we end up with both the weakly-referenced code
> >> > and the arch code in the kernel image. That's fine if the weak code
> >> > is small.
> >>
> >> The kernel's been able to build with link time garbage collection since 2016:
> >>
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
> >>
> >> Wouldn't that remove the unused one?
> >
> > Probably, if anyone bothered to use that, which they don't.
> >
> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> > what I can see, nothing selects it. Therefore, the symbol is always
> > disabled, and so the feature never gets used in mainline kernels.
> >
> > Brings up the obvious question - why is it there if it's completely
> > unused? (Maybe to cause confusion, and allowing a justification
> > for __weak ?)
>
> IIRC Nick had some patches to do the arch enablement for powerpc, but
> I'm not sure what happened to them though. I suspect it just fell down
> Nick's ever growing TODO list.
I've given it a go on ARM, marking every linker-built table with KEEP()
and comparing the System.map files. The resulting kernel is around
150k smaller, which seems good.
However, it doesn't boot - and I don't know why. Booting the kernel
under kvmtool in a VM using virtio-console, I can find no way to get
any kernel messages out of it. Using lkvm debug, I can see that the
PC is stuck inside die(), and that's the only information I have.
It dies before bringing up the other CPUs, so it's a very early death.
I don't think other console types are available under ARM64.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 15:27 ` Russell King - ARM Linux
@ 2018-03-29 15:43 ` Geert Uytterhoeven
2018-03-29 15:58 ` Russell King - ARM Linux
2018-03-29 17:43 ` Rob Landley
1 sibling, 1 reply; 26+ messages in thread
From: Geert Uytterhoeven @ 2018-03-29 15:43 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Oliver, Rob Landley, Shea Levy, linux-riscv,
Linux Kernel Mailing List, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, the arch/x86 maintainers, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches, Dan Williams,
Wei Yang, Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, alpha, arcml, Linux ARM,
adi-buildroot-devel, linux-c6x-dev, Cris,
moderated list:H8/300 ARCHITECTURE, open list:QUALCOMM HEXAGON...,
linux-ia64, linux-m68k, open list:METAG ARCHITECTURE,
Linux MIPS Mailing List, moderated list:PANASONIC MN10300...,
nios2-dev, Openrisc, Parisc List, linuxppc-dev, linux-s390,
Linux-sh list, sparclinux, uml-devel, uml-user, linux-xtensa,
Nicholas Piggin
On Thu, Mar 29, 2018 at 5:27 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Thu, Mar 29, 2018 at 09:37:52AM +1100, Oliver wrote:
>> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
>> <linux@armlinux.org.uk> wrote:
>> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
>> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
>> >> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
>> >> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
>> >> >>> Now only those architectures that have custom initrd free requirements
>> >> >>> need to define free_initrd_mem.
>> >> >> ...
>> >> >>> --- a/arch/arc/mm/init.c
>> >> >>> +++ b/arch/arc/mm/init.c
>> >> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
>> >> >>> {
>> >> >>> free_initmem_default(-1);
>> >> >>> }
>> >> >>> -
>> >> >>> -#ifdef CONFIG_BLK_DEV_INITRD
>> >> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
>> >> >>> -{
>> >> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
>> >> >>> -}
>> >> >>> -#endif
>> >> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> >> >>> index 3f972e83909b..19d1c5594e2d 100644
>> >> >>> --- a/arch/arm/Kconfig
>> >> >>> +++ b/arch/arm/Kconfig
>> >> >>> @@ -47,6 +47,7 @@ config ARM
>> >> >>> select HARDIRQS_SW_RESEND
>> >> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
>> >> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
>> >> >>> + select HAVE_ARCH_FREE_INITRD_MEM
>> >> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>> >> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
>> >> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
>> >> >>
>> >> >> Isn't this why weak symbols were invented?
>> >> >
>> >> > Weak symbols means that we end up with both the weakly-referenced code
>> >> > and the arch code in the kernel image. That's fine if the weak code
>> >> > is small.
>> >>
>> >> The kernel's been able to build with link time garbage collection since 2016:
>> >>
>> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
>> >>
>> >> Wouldn't that remove the unused one?
>> >
>> > Probably, if anyone bothered to use that, which they don't.
>> >
>> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
>> > what I can see, nothing selects it. Therefore, the symbol is always
>> > disabled, and so the feature never gets used in mainline kernels.
>> >
>> > Brings up the obvious question - why is it there if it's completely
>> > unused? (Maybe to cause confusion, and allowing a justification
>> > for __weak ?)
>>
>> IIRC Nick had some patches to do the arch enablement for powerpc, but
>> I'm not sure what happened to them though. I suspect it just fell down
>> Nick's ever growing TODO list.
>
> I've given it a go on ARM, marking every linker-built table with KEEP()
> and comparing the System.map files. The resulting kernel is around
> 150k smaller, which seems good.
>
> However, it doesn't boot - and I don't know why. Booting the kernel
> under kvmtool in a VM using virtio-console, I can find no way to get
> any kernel messages out of it. Using lkvm debug, I can see that the
> PC is stuck inside die(), and that's the only information I have.
> It dies before bringing up the other CPUs, so it's a very early death.
>
> I don't think other console types are available under ARM64.
earlycon?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 15:43 ` Geert Uytterhoeven
@ 2018-03-29 15:58 ` Russell King - ARM Linux
2018-03-29 16:53 ` Marc Zyngier
0 siblings, 1 reply; 26+ messages in thread
From: Russell King - ARM Linux @ 2018-03-29 15:58 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Oliver, Rob Landley, Shea Levy, linux-riscv,
Linux Kernel Mailing List, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, the arch/x86 maintainers, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches, Dan Williams,
Wei Yang, Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, alpha, arcml, Linux ARM,
adi-buildroot-devel, linux-c6x-dev, Cris,
moderated list:H8/300 ARCHITECTURE, open list:QUALCOMM HEXAGON...,
linux-ia64, linux-m68k, open list:METAG ARCHITECTURE,
Linux MIPS Mailing List, moderated list:PANASONIC MN10300...,
nios2-dev, Openrisc, Parisc List, linuxppc-dev, linux-s390,
Linux-sh list, sparclinux, uml-devel, uml-user, linux-xtensa,
Nicholas Piggin
On Thu, Mar 29, 2018 at 05:43:47PM +0200, Geert Uytterhoeven wrote:
> On Thu, Mar 29, 2018 at 5:27 PM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
> > On Thu, Mar 29, 2018 at 09:37:52AM +1100, Oliver wrote:
> >> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
> >> <linux@armlinux.org.uk> wrote:
> >> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
> >> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> >> >> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> >> >> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
> >> >> >>> Now only those architectures that have custom initrd free requirements
> >> >> >>> need to define free_initrd_mem.
> >> >> >> ...
> >> >> >>> --- a/arch/arc/mm/init.c
> >> >> >>> +++ b/arch/arc/mm/init.c
> >> >> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> >> >> >>> {
> >> >> >>> free_initmem_default(-1);
> >> >> >>> }
> >> >> >>> -
> >> >> >>> -#ifdef CONFIG_BLK_DEV_INITRD
> >> >> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> >> >> >>> -{
> >> >> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> >> >> >>> -}
> >> >> >>> -#endif
> >> >> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >> >> >>> index 3f972e83909b..19d1c5594e2d 100644
> >> >> >>> --- a/arch/arm/Kconfig
> >> >> >>> +++ b/arch/arm/Kconfig
> >> >> >>> @@ -47,6 +47,7 @@ config ARM
> >> >> >>> select HARDIRQS_SW_RESEND
> >> >> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> >> >> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> >> >> >>> + select HAVE_ARCH_FREE_INITRD_MEM
> >> >> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> >> >> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> >> >> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> >> >> >>
> >> >> >> Isn't this why weak symbols were invented?
> >> >> >
> >> >> > Weak symbols means that we end up with both the weakly-referenced code
> >> >> > and the arch code in the kernel image. That's fine if the weak code
> >> >> > is small.
> >> >>
> >> >> The kernel's been able to build with link time garbage collection since 2016:
> >> >>
> >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
> >> >>
> >> >> Wouldn't that remove the unused one?
> >> >
> >> > Probably, if anyone bothered to use that, which they don't.
> >> >
> >> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> >> > what I can see, nothing selects it. Therefore, the symbol is always
> >> > disabled, and so the feature never gets used in mainline kernels.
> >> >
> >> > Brings up the obvious question - why is it there if it's completely
> >> > unused? (Maybe to cause confusion, and allowing a justification
> >> > for __weak ?)
> >>
> >> IIRC Nick had some patches to do the arch enablement for powerpc, but
> >> I'm not sure what happened to them though. I suspect it just fell down
> >> Nick's ever growing TODO list.
> >
> > I've given it a go on ARM, marking every linker-built table with KEEP()
> > and comparing the System.map files. The resulting kernel is around
> > 150k smaller, which seems good.
> >
> > However, it doesn't boot - and I don't know why. Booting the kernel
> > under kvmtool in a VM using virtio-console, I can find no way to get
> > any kernel messages out of it. Using lkvm debug, I can see that the
> > PC is stuck inside die(), and that's the only information I have.
> > It dies before bringing up the other CPUs, so it's a very early death.
> >
> > I don't think other console types are available under ARM64.
>
> earlycon?
Through what - as I say above, I think the only thing that's present is
virtio-console, and the virtio stack only get initialised much later in
boot.
Eg, there's the memory-based virtio driver which interfaces any virtio
driver to a memory-based ring structures for communication with the host
(drivers/virtio/virtio_mmio.c) which is initialised at module_init()
time, and so isn't available for earlycon.
I don't think merely changing the module_init() calls in the appropriate
virtio bits will suffice - it's why I pointed out that it dies before
SMP initialisation, which also means that it dies before we start
running the initcalls for subsystems and drivers.
I'm not aware of there being an emulated UART in the guest's address
space, so serial based stuff doesn't work.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 15:58 ` Russell King - ARM Linux
@ 2018-03-29 16:53 ` Marc Zyngier
2018-03-29 17:32 ` Russell King - ARM Linux
0 siblings, 1 reply; 26+ messages in thread
From: Marc Zyngier @ 2018-03-29 16:53 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Geert Uytterhoeven, Oliver, Rob Landley, Shea Levy, linux-riscv,
Linux Kernel Mailing List, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, the arch/x86 maintainers, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Rob Herring, Kees Cook, Vlastimil Babka, Balbir Singh,
Christophe Leroy, Joe Perches, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, alpha, arcml, Linux ARM,
adi-buildroot-devel, linux-c6x-dev, Cris,
moderated list:H8/300 ARCHITECTURE, open list:QUALCOMM HEXAGON...,
linux-ia64, linux-m68k, open list:METAG ARCHITECTURE,
Linux MIPS Mailing List, moderated list:PANASONIC MN10300...,
nios2-dev, Openrisc, Parisc List, linuxppc-dev, linux-s390,
Linux-sh list, sparclinux, uml-devel, uml-user, linux-xtensa,
Nicholas Piggin
On Thu, 29 Mar 2018 16:58:27 +0100,
Russell King - ARM Linux wrote:
>
> On Thu, Mar 29, 2018 at 05:43:47PM +0200, Geert Uytterhoeven wrote:
> > On Thu, Mar 29, 2018 at 5:27 PM, Russell King - ARM Linux
> > <linux@armlinux.org.uk> wrote:
> > > On Thu, Mar 29, 2018 at 09:37:52AM +1100, Oliver wrote:
> > >> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
> > >> <linux@armlinux.org.uk> wrote:
> > >> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
> > >> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> > >> >> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> > >> >> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
> > >> >> >>> Now only those architectures that have custom initrd free requirements
> > >> >> >>> need to define free_initrd_mem.
> > >> >> >> ...
> > >> >> >>> --- a/arch/arc/mm/init.c
> > >> >> >>> +++ b/arch/arc/mm/init.c
> > >> >> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> > >> >> >>> {
> > >> >> >>> free_initmem_default(-1);
> > >> >> >>> }
> > >> >> >>> -
> > >> >> >>> -#ifdef CONFIG_BLK_DEV_INITRD
> > >> >> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> > >> >> >>> -{
> > >> >> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> > >> >> >>> -}
> > >> >> >>> -#endif
> > >> >> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > >> >> >>> index 3f972e83909b..19d1c5594e2d 100644
> > >> >> >>> --- a/arch/arm/Kconfig
> > >> >> >>> +++ b/arch/arm/Kconfig
> > >> >> >>> @@ -47,6 +47,7 @@ config ARM
> > >> >> >>> select HARDIRQS_SW_RESEND
> > >> >> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> > >> >> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> > >> >> >>> + select HAVE_ARCH_FREE_INITRD_MEM
> > >> >> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> > >> >> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> > >> >> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> > >> >> >>
> > >> >> >> Isn't this why weak symbols were invented?
> > >> >> >
> > >> >> > Weak symbols means that we end up with both the weakly-referenced code
> > >> >> > and the arch code in the kernel image. That's fine if the weak code
> > >> >> > is small.
> > >> >>
> > >> >> The kernel's been able to build with link time garbage collection since 2016:
> > >> >>
> > >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
> > >> >>
> > >> >> Wouldn't that remove the unused one?
> > >> >
> > >> > Probably, if anyone bothered to use that, which they don't.
> > >> >
> > >> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> > >> > what I can see, nothing selects it. Therefore, the symbol is always
> > >> > disabled, and so the feature never gets used in mainline kernels.
> > >> >
> > >> > Brings up the obvious question - why is it there if it's completely
> > >> > unused? (Maybe to cause confusion, and allowing a justification
> > >> > for __weak ?)
> > >>
> > >> IIRC Nick had some patches to do the arch enablement for powerpc, but
> > >> I'm not sure what happened to them though. I suspect it just fell down
> > >> Nick's ever growing TODO list.
> > >
> > > I've given it a go on ARM, marking every linker-built table with KEEP()
> > > and comparing the System.map files. The resulting kernel is around
> > > 150k smaller, which seems good.
> > >
> > > However, it doesn't boot - and I don't know why. Booting the kernel
> > > under kvmtool in a VM using virtio-console, I can find no way to get
> > > any kernel messages out of it. Using lkvm debug, I can see that the
> > > PC is stuck inside die(), and that's the only information I have.
> > > It dies before bringing up the other CPUs, so it's a very early death.
> > >
> > > I don't think other console types are available under ARM64.
> >
> > earlycon?
>
> Through what - as I say above, I think the only thing that's present is
> virtio-console, and the virtio stack only get initialised much later in
> boot.
>
> Eg, there's the memory-based virtio driver which interfaces any virtio
> driver to a memory-based ring structures for communication with the host
> (drivers/virtio/virtio_mmio.c) which is initialised at module_init()
> time, and so isn't available for earlycon.
>
> I don't think merely changing the module_init() calls in the appropriate
> virtio bits will suffice - it's why I pointed out that it dies before
> SMP initialisation, which also means that it dies before we start
> running the initcalls for subsystems and drivers.
>
> I'm not aware of there being an emulated UART in the guest's address
> space, so serial based stuff doesn't work.
"earlycon=uart,mmio,0x3f8" is what you're looking for:
$ Work/kvmtool/lkvm run -c2 -k zImage -p "earlycon=uart,mmio,0x3f8" --console virtio --aarch32
# lkvm run -k zImage -m 320 -c 2 --name guest-3856
Info: Loaded kernel to 0x80008000 (6767104 bytes)
Info: Placing fdt at 0x8fe00000 - 0x8fffffff
Info: virtio-mmio.devices=0x200@0x10000:36
Info: virtio-mmio.devices=0x200@0x10200:37
Info: virtio-mmio.devices=0x200@0x10400:38
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.16.0-rc6+ (maz@approximate) (gcc version 6.3.0 20170516 (Debian 6.3.0-18)) #8407 SMP PREEMPT Tue Mar 20 15:01:43 GMT 2018
[ 0.000000] CPU: ARMv7 Processor [410fd082] revision 2 (ARMv7), cr=30c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] OF: fdt: Machine model: linux,dummy-virt
[ 0.000000] earlycon: uart0 at MMIO 0x00000000000003f8 (options '')
[ 0.000000] bootconsole [uart0] enabled
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[...]
M.
--
Jazz is not dead, it just smell funny.
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 16:53 ` Marc Zyngier
@ 2018-03-29 17:32 ` Russell King - ARM Linux
2018-03-29 17:53 ` Marc Zyngier
0 siblings, 1 reply; 26+ messages in thread
From: Russell King - ARM Linux @ 2018-03-29 17:32 UTC (permalink / raw)
To: Marc Zyngier
Cc: Geert Uytterhoeven, Oliver, Rob Landley, Shea Levy, linux-riscv,
Linux Kernel Mailing List, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, the arch/x86 maintainers, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Rob Herring, Kees Cook, Vlastimil Babka, Balbir Singh,
Christophe Leroy, Joe Perches, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, alpha, arcml, Linux ARM,
adi-buildroot-devel, linux-c6x-dev, Cris,
moderated list:H8/300 ARCHITECTURE, open list:QUALCOMM HEXAGON...,
linux-ia64, linux-m68k, open list:METAG ARCHITECTURE,
Linux MIPS Mailing List, moderated list:PANASONIC MN10300...,
nios2-dev, Openrisc, Parisc List, linuxppc-dev, linux-s390,
Linux-sh list, sparclinux, uml-devel, uml-user, linux-xtensa,
Nicholas Piggin
On Thu, Mar 29, 2018 at 05:53:14PM +0100, Marc Zyngier wrote:
> On Thu, 29 Mar 2018 16:58:27 +0100,
> Russell King - ARM Linux wrote:
> >
> > On Thu, Mar 29, 2018 at 05:43:47PM +0200, Geert Uytterhoeven wrote:
> > > On Thu, Mar 29, 2018 at 5:27 PM, Russell King - ARM Linux
> > > <linux@armlinux.org.uk> wrote:
> > > > On Thu, Mar 29, 2018 at 09:37:52AM +1100, Oliver wrote:
> > > >> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
> > > >> <linux@armlinux.org.uk> wrote:
> > > >> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
> > > >> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> > > >> >> > On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> > > >> >> >> On 03/28/2018 10:26 AM, Shea Levy wrote:
> > > >> >> >>> Now only those architectures that have custom initrd free requirements
> > > >> >> >>> need to define free_initrd_mem.
> > > >> >> >> ...
> > > >> >> >>> --- a/arch/arc/mm/init.c
> > > >> >> >>> +++ b/arch/arc/mm/init.c
> > > >> >> >>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> > > >> >> >>> {
> > > >> >> >>> free_initmem_default(-1);
> > > >> >> >>> }
> > > >> >> >>> -
> > > >> >> >>> -#ifdef CONFIG_BLK_DEV_INITRD
> > > >> >> >>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> > > >> >> >>> -{
> > > >> >> >>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> > > >> >> >>> -}
> > > >> >> >>> -#endif
> > > >> >> >>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > >> >> >>> index 3f972e83909b..19d1c5594e2d 100644
> > > >> >> >>> --- a/arch/arm/Kconfig
> > > >> >> >>> +++ b/arch/arm/Kconfig
> > > >> >> >>> @@ -47,6 +47,7 @@ config ARM
> > > >> >> >>> select HARDIRQS_SW_RESEND
> > > >> >> >>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> > > >> >> >>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> > > >> >> >>> + select HAVE_ARCH_FREE_INITRD_MEM
> > > >> >> >>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> > > >> >> >>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> > > >> >> >>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> > > >> >> >>
> > > >> >> >> Isn't this why weak symbols were invented?
> > > >> >> >
> > > >> >> > Weak symbols means that we end up with both the weakly-referenced code
> > > >> >> > and the arch code in the kernel image. That's fine if the weak code
> > > >> >> > is small.
> > > >> >>
> > > >> >> The kernel's been able to build with link time garbage collection since 2016:
> > > >> >>
> > > >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
> > > >> >>
> > > >> >> Wouldn't that remove the unused one?
> > > >> >
> > > >> > Probably, if anyone bothered to use that, which they don't.
> > > >> >
> > > >> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> > > >> > what I can see, nothing selects it. Therefore, the symbol is always
> > > >> > disabled, and so the feature never gets used in mainline kernels.
> > > >> >
> > > >> > Brings up the obvious question - why is it there if it's completely
> > > >> > unused? (Maybe to cause confusion, and allowing a justification
> > > >> > for __weak ?)
> > > >>
> > > >> IIRC Nick had some patches to do the arch enablement for powerpc, but
> > > >> I'm not sure what happened to them though. I suspect it just fell down
> > > >> Nick's ever growing TODO list.
> > > >
> > > > I've given it a go on ARM, marking every linker-built table with KEEP()
> > > > and comparing the System.map files. The resulting kernel is around
> > > > 150k smaller, which seems good.
> > > >
> > > > However, it doesn't boot - and I don't know why. Booting the kernel
> > > > under kvmtool in a VM using virtio-console, I can find no way to get
> > > > any kernel messages out of it. Using lkvm debug, I can see that the
> > > > PC is stuck inside die(), and that's the only information I have.
> > > > It dies before bringing up the other CPUs, so it's a very early death.
> > > >
> > > > I don't think other console types are available under ARM64.
> > >
> > > earlycon?
> >
> > Through what - as I say above, I think the only thing that's present is
> > virtio-console, and the virtio stack only get initialised much later in
> > boot.
> >
> > Eg, there's the memory-based virtio driver which interfaces any virtio
> > driver to a memory-based ring structures for communication with the host
> > (drivers/virtio/virtio_mmio.c) which is initialised at module_init()
> > time, and so isn't available for earlycon.
> >
> > I don't think merely changing the module_init() calls in the appropriate
> > virtio bits will suffice - it's why I pointed out that it dies before
> > SMP initialisation, which also means that it dies before we start
> > running the initcalls for subsystems and drivers.
> >
> > I'm not aware of there being an emulated UART in the guest's address
> > space, so serial based stuff doesn't work.
>
> "earlycon=uart,mmio,0x3f8" is what you're looking for:
Does that also mean that we have a RTC at the standard PC IO addresses
as well, but in mmio space?
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 17:32 ` Russell King - ARM Linux
@ 2018-03-29 17:53 ` Marc Zyngier
0 siblings, 0 replies; 26+ messages in thread
From: Marc Zyngier @ 2018-03-29 17:53 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Geert Uytterhoeven, Oliver, Rob Landley, Shea Levy, linux-riscv,
Linux Kernel Mailing List, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Catalin Marinas,
Will Deacon, Mark Salter, Aurelien Jacquiot, Mikael Starvik,
Jesper Nilsson, Yoshinori Sato, Richard Kuo, Tony Luck,
Fenghua Yu, James Hogan, Michal Simek, Ralf Baechle,
David Howells, Ley Foon Tan, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Palmer Dabbelt, Albert Ou, Martin Schwidefsky, Heiko Carstens,
Chen Liqin, Lennox Wu, Rich Felker, David S. Miller, Jeff Dike,
Richard Weinberger, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, the arch/x86 maintainers, Chris Zankel,
Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Rob Herring, Kees Cook, Vlastimil Babka, Balbir Singh,
Christophe Leroy, Joe Perches, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, alpha, arcml, Linux ARM,
adi-buildroot-devel, linux-c6x-dev, Cris,
moderated list:H8/300 ARCHITECTURE, open list:QUALCOMM HEXAGON...,
linux-ia64, linux-m68k, open list:METAG ARCHITECTURE,
Linux MIPS Mailing List, moderated list:PANASONIC MN10300...,
nios2-dev, Openrisc, Parisc List, linuxppc-dev, linux-s390,
Linux-sh list, sparclinux, uml-devel, uml-user, linux-xtensa,
Nicholas Piggin
On Thu, 29 Mar 2018 18:32:47 +0100,
Russell King - ARM Linux wrote:
>
> On Thu, Mar 29, 2018 at 05:53:14PM +0100, Marc Zyngier wrote:
> > On Thu, 29 Mar 2018 16:58:27 +0100,
> > Russell King - ARM Linux wrote:
[...]
> > > I'm not aware of there being an emulated UART in the guest's address
> > > space, so serial based stuff doesn't work.
> >
> > "earlycon=uart,mmio,0x3f8" is what you're looking for:
>
> Does that also mean that we have a RTC at the standard PC IO addresses
> as well, but in mmio space?
There is one, together with an i8042. Not exposed in the DT though.
M.
--
Jazz is not dead, it just smell funny.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 15:27 ` Russell King - ARM Linux
2018-03-29 15:43 ` Geert Uytterhoeven
@ 2018-03-29 17:43 ` Rob Landley
1 sibling, 0 replies; 26+ messages in thread
From: Rob Landley @ 2018-03-29 17:43 UTC (permalink / raw)
To: Russell King - ARM Linux, Oliver
Cc: Shea Levy, linux-riscv, linux-kernel, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches, Dan Williams,
Wei Yang, Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa, Nicholas Piggin
[-- Attachment #1: Type: text/plain, Size: 3072 bytes --]
On 03/29/2018 10:27 AM, Russell King - ARM Linux wrote:
> On Thu, Mar 29, 2018 at 09:37:52AM +1100, Oliver wrote:
>> On Thu, Mar 29, 2018 at 9:14 AM, Russell King - ARM Linux
>>> LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
>>> what I can see, nothing selects it. Therefore, the symbol is always
>>> disabled, and so the feature never gets used in mainline kernels.
>>>
>>> Brings up the obvious question - why is it there if it's completely
>>> unused? (Maybe to cause confusion, and allowing a justification
>>> for __weak ?)
>>
>> IIRC Nick had some patches to do the arch enablement for powerpc, but
>> I'm not sure what happened to them though. I suspect it just fell down
>> Nick's ever growing TODO list.
>
> I've given it a go on ARM, marking every linker-built table with KEEP()
> and comparing the System.map files. The resulting kernel is around
> 150k smaller, which seems good.
>
> However, it doesn't boot - and I don't know why. Booting the kernel
> under kvmtool in a VM using virtio-console, I can find no way to get
> any kernel messages out of it. Using lkvm debug, I can see that the
> PC is stuck inside die(), and that's the only information I have.
qemu-system-arm's "-s" option lets you hook to the hardware with gdb, as if
using one of those jtags that speaks gdbserver protocol. It stops waiting for
you to attach with 'target remote' it, then 'file vmlinux' to load the symbols...
The miniconfig and qemu invocation I use for arm64 are attached, tested with
2.11.0 on a 4.14 kernel. You should be able to just "qemu-aarch64.sh -s" and
then probably "target remote 127.0.0.1:1234"? (Been a while since I've used it,
don't have a cross-gdb for arm64 lying around...)
Sigh, I just tried -s and qemu 2.11.0 is _not_ waiting for gdb to attach on
arm64, despite what the docs say:
$ qemu-system-aarch64 --help | grep gdb
-gdb dev wait for gdb connection on 'dev'
-s shorthand for -gdb tcp::1234
Another random regression in qemu, gee what a surprise.
> It dies before bringing up the other CPUs, so it's a very early death.
>
> I don't think other console types are available under ARM64.
I've often found useful the two line version of:
https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/
Which is generally some variant of:
{char *XX = "blah"; while (*XX) {while (*SERIAL_STATUS_REGISTER & OUT_READY);
*SERIAL_OUT = *XX++;}}
(I.E. balu cheated not spinning checking the ready-for-next-byte bit, because
qemu's always angry.)
That trick lets you cut and paste a print statement into all sorts of early
hardware nonsense, on most architectures. You just have to look up
SERIAL_STATUS_REGISTER, OUT_OK_BIT, and SERIAL_OUT values for the serial port du
jour.
That said I've mostly used it in things like u-boot. I dunno at what point the
kernel's done enough setup that direct banging on registers would stop working.
(Works in the decompresion code, anyway.) And it assumes the port's set to the
right speed (usually left there by the bootloader)...
Rob
[-- Attachment #2: aarch64.miniconf --]
[-- Type: text/plain, Size: 1387 bytes --]
# make ARCH=arm64 allnoconfig KCONFIG_ALLCONFIG=aarch64.miniconf
# make ARCH=arm64 -j $(nproc)
# boot arch/arm64/boot/Image
CONFIG_MMU=y
CONFIG_ARCH_MULTI_V7=y
CONFIG_ARCH_VIRT=y
CONFIG_SOC_DRA7XX=y
CONFIG_ARCH_OMAP2PLUS_TYPICAL=y
CONFIG_ARCH_ALPINE=y
CONFIG_ARM_THUMB=y
CONFIG_VDSO=y
CONFIG_CPU_IDLE=y
CONFIG_ARM_CPUIDLE=y
CONFIG_KERNEL_MODE_NEON=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_DRV_PL031=y
CONFIG_NET_CORE=y
CONFIG_VIRTIO_NET=y
CONFIG_PCI=y
CONFIG_PCI_HOST_GENERIC=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_MMIO=y
CONFIG_ATA=y
CONFIG_ATA_SFF=y
CONFIG_ATA_BMDMA=y
CONFIG_ATA_PIIX=y
CONFIG_PATA_PLATFORM=y
CONFIG_PATA_OF_PLATFORM=y
CONFIG_ATA_GENERIC=y
# CONFIG_EMBEDDED is not set
CONFIG_EARLY_PRINTK=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_GZIP=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_UTF8=y
CONFIG_MISC_FILESYSTEMS=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_ZLIB=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IPV6=y
CONFIG_NETDEVICES=y
#CONFIG_NET_CORE=y
#CONFIG_NETCONSOLE=y
CONFIG_ETHERNET=y
[-- Attachment #3: qemu-aarch64.sh --]
[-- Type: application/x-shellscript, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 22:14 ` Russell King - ARM Linux
2018-03-28 22:37 ` Oliver
@ 2018-03-29 16:39 ` Rob Landley
2018-03-29 17:31 ` Russell King - ARM Linux
1 sibling, 1 reply; 26+ messages in thread
From: Rob Landley @ 2018-03-29 16:39 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Shea Levy, linux-riscv, linux-kernel, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On 03/28/2018 05:14 PM, Russell King - ARM Linux wrote:
> On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
>>
>>
>> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
>>> On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
>>>> On 03/28/2018 10:26 AM, Shea Levy wrote:
>>>>> Now only those architectures that have custom initrd free requirements
>>>>> need to define free_initrd_mem.
>>>> ...
>>>>> --- a/arch/arc/mm/init.c
>>>>> +++ b/arch/arc/mm/init.c
>>>>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
>>>>> {
>>>>> free_initmem_default(-1);
>>>>> }
>>>>> -
>>>>> -#ifdef CONFIG_BLK_DEV_INITRD
>>>>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
>>>>> -{
>>>>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
>>>>> -}
>>>>> -#endif
>>>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>>>>> index 3f972e83909b..19d1c5594e2d 100644
>>>>> --- a/arch/arm/Kconfig
>>>>> +++ b/arch/arm/Kconfig
>>>>> @@ -47,6 +47,7 @@ config ARM
>>>>> select HARDIRQS_SW_RESEND
>>>>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
>>>>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
>>>>> + select HAVE_ARCH_FREE_INITRD_MEM
>>>>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>>>>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
>>>>> select HAVE_ARCH_MMAP_RND_BITS if MMU
>>>>
>>>> Isn't this why weak symbols were invented?
>>>
>>> Weak symbols means that we end up with both the weakly-referenced code
>>> and the arch code in the kernel image. That's fine if the weak code
>>> is small.
>>
>> The kernel's been able to build with link time garbage collection since 2016:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
>>
>> Wouldn't that remove the unused one?
>
> Probably, if anyone bothered to use that, which they don't.
>
> LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> what I can see, nothing selects it. Therefore, the symbol is always
> disabled, and so the feature never gets used in mainline kernels.
It looks like there are per-architecture linker scripts that need to be updated?
So if an architecture supports it, it's always done (well, it probes for the
toolchain supporting the flag). And if the architecture doesn't support it, the
linker script needs to be updated to mark sections with "I know nothing seems to
reference this at the ELF level but keep it anyway, we're pulling an assembly
trick".
> Brings up the obvious question - why is it there if it's completely
> unused? (Maybe to cause confusion, and allowing a justification
> for __weak ?)
Presumably it will become the default on architectures as their linker scripts
are converted. Once they're all converted the config symbol can go away. (Given
the move to requiring gcc 4.7 or whatever it is, there can't be an architecture
depending on a toolchain that _doesn't_ support it after that point. I doubt you
can pair gcc 4.7 with a >12 year old binutils and expect good things...)
Rob
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-29 16:39 ` Rob Landley
@ 2018-03-29 17:31 ` Russell King - ARM Linux
0 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2018-03-29 17:31 UTC (permalink / raw)
To: Rob Landley
Cc: Shea Levy, linux-riscv, linux-kernel, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Florian Fainelli, linux-alpha, linux-snps-arc,
linux-arm-kernel, adi-buildroot-devel, linux-c6x-dev,
linux-cris-kernel, uclinux-h8-devel, linux-hexagon, linux-ia64,
linux-m68k, linux-metag, linux-mips, linux-am33-list, nios2-dev,
openrisc, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
On Thu, Mar 29, 2018 at 11:39:24AM -0500, Rob Landley wrote:
>
>
> On 03/28/2018 05:14 PM, Russell King - ARM Linux wrote:
> > On Wed, Mar 28, 2018 at 02:04:22PM -0500, Rob Landley wrote:
> >>
> >>
> >> On 03/28/2018 11:48 AM, Russell King - ARM Linux wrote:
> >>> On Wed, Mar 28, 2018 at 10:58:51AM -0500, Rob Landley wrote:
> >>>> On 03/28/2018 10:26 AM, Shea Levy wrote:
> >>>>> Now only those architectures that have custom initrd free requirements
> >>>>> need to define free_initrd_mem.
> >>>> ...
> >>>>> --- a/arch/arc/mm/init.c
> >>>>> +++ b/arch/arc/mm/init.c
> >>>>> @@ -229,10 +229,3 @@ void __ref free_initmem(void)
> >>>>> {
> >>>>> free_initmem_default(-1);
> >>>>> }
> >>>>> -
> >>>>> -#ifdef CONFIG_BLK_DEV_INITRD
> >>>>> -void __init free_initrd_mem(unsigned long start, unsigned long end)
> >>>>> -{
> >>>>> - free_reserved_area((void *)start, (void *)end, -1, "initrd");
> >>>>> -}
> >>>>> -#endif
> >>>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >>>>> index 3f972e83909b..19d1c5594e2d 100644
> >>>>> --- a/arch/arm/Kconfig
> >>>>> +++ b/arch/arm/Kconfig
> >>>>> @@ -47,6 +47,7 @@ config ARM
> >>>>> select HARDIRQS_SW_RESEND
> >>>>> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> >>>>> select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
> >>>>> + select HAVE_ARCH_FREE_INITRD_MEM
> >>>>> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> >>>>> select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU
> >>>>> select HAVE_ARCH_MMAP_RND_BITS if MMU
> >>>>
> >>>> Isn't this why weak symbols were invented?
> >>>
> >>> Weak symbols means that we end up with both the weakly-referenced code
> >>> and the arch code in the kernel image. That's fine if the weak code
> >>> is small.
> >>
> >> The kernel's been able to build with link time garbage collection since 2016:
> >>
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b67067f1176d
> >>
> >> Wouldn't that remove the unused one?
> >
> > Probably, if anyone bothered to use that, which they don't.
> >
> > LD_DEAD_CODE_DATA_ELIMINATION is a symbol without a prompt, and from
> > what I can see, nothing selects it. Therefore, the symbol is always
> > disabled, and so the feature never gets used in mainline kernels.
>
> It looks like there are per-architecture linker scripts that need to be updated?
> So if an architecture supports it, it's always done (well, it probes for the
> toolchain supporting the flag). And if the architecture doesn't support it, the
> linker script needs to be updated to mark sections with "I know nothing seems to
> reference this at the ELF level but keep it anyway, we're pulling an assembly
> trick".
It looks like it needs much more than just architecture changes as the
reason it fails on ARM is because the init thread structure is missing
due to missing KEEP()s in INIT_TASK_DATA(). Probably means it doesn't
work anywhere.
8<===
From: Russell King <rmk+kernel@armlinux.org.uk>
Subject: [PATCH] Fix LD_DEAD_CODE_DATA_ELIMINATION
LD_DEAD_CODE_DATA_ELIMINATION fails to boot on ARM because the linker
eliminates the init thread data from the bottom of the init threads
stack. This causes recursive faults that end up overwriting parts
of the kernel before they can print any message.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
include/asm-generic/vmlinux.lds.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 1ab0e520d6fc..41af8a74aae4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -279,8 +279,8 @@
VMLINUX_SYMBOL(__start_init_task) = .; \
VMLINUX_SYMBOL(init_thread_union) = .; \
VMLINUX_SYMBOL(init_stack) = .; \
- *(.data..init_task) \
- *(.data..init_thread_info) \
+ KEEP(*(.data..init_task)) \
+ KEEP(*(.data..init_thread_info)) \
. = VMLINUX_SYMBOL(__start_init_task) + THREAD_SIZE; \
VMLINUX_SYMBOL(__end_init_task) = .;
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:26 ` [PATCH] Extract initrd free logic from arch-specific code Shea Levy
2018-03-28 15:58 ` Rob Landley
@ 2018-03-28 16:55 ` Kees Cook
2018-03-29 1:12 ` Wei Yang
2018-03-30 1:43 ` kbuild test robot
` (2 subsequent siblings)
4 siblings, 1 reply; 26+ messages in thread
From: Kees Cook @ 2018-03-28 16:55 UTC (permalink / raw)
To: Shea Levy
Cc: linux-riscv, LKML, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Russell King,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, X86 ML,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Vlastimil Babka, Balbir Singh,
Christophe Leroy, Joe Perches, Oliver O'Halloran,
Dan Williams, Wei Yang, Christian König, Arnd Bergmann,
Deepa Dinamani, Daniel Thompson, Rob Landley, Florian Fainelli,
linux-alpha, linux-snps-arc, linux-arm-kernel,
adi-buildroot-devel, linux-c6x-dev, linux-cris-kernel,
uclinux-h8-devel, linux-hexagon, linux-ia64, linux-m68k,
linux-metag, Linux MIPS Mailing List, linux-am33-list, nios2-dev,
openrisc, linux-parisc, PowerPC, linux-s390, linux-sh, sparclinux,
user-mode-linux-devel, user-mode-linux-user, linux-xtensa
On Wed, Mar 28, 2018 at 8:26 AM, Shea Levy <shea@shealevy.com> wrote:
> Now only those architectures that have custom initrd free requirements
> need to define free_initrd_mem.
>
> Signed-off-by: Shea Levy <shea@shealevy.com>
Yay consolidation! :)
> --- a/usr/Kconfig
> +++ b/usr/Kconfig
> @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION
> default ".lzma" if RD_LZMA
> default ".bz2" if RD_BZIP2
> default ""
> +
> +config HAVE_ARCH_FREE_INITRD_MEM
> + bool
> + default n
If you keep the Kconfig, you can leave off "default n", and I'd
suggest adding a help section just to describe what the per-arch
responsibilities are when select-ing the config. (See
HAVE_ARCH_SECCOMP_FILTER for an example.)
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 16:55 ` Kees Cook
@ 2018-03-29 1:12 ` Wei Yang
0 siblings, 0 replies; 26+ messages in thread
From: Wei Yang @ 2018-03-29 1:12 UTC (permalink / raw)
To: Kees Cook
Cc: Shea Levy, linux-riscv, LKML, Christoph Hellwig,
Richard Henderson, Ivan Kokshaysky, Matt Turner, Vineet Gupta,
Russell King, Catalin Marinas, Will Deacon, Mark Salter,
Aurelien Jacquiot, Mikael Starvik, Jesper Nilsson, Yoshinori Sato,
Richard Kuo, Tony Luck, Fenghua Yu, Geert Uytterhoeven,
James Hogan, Michal Simek, Ralf Baechle, David Howells,
Ley Foon Tan, Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, X86 ML,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Vlastimil Babka, Balbir Singh,
Christophe Leroy, Joe Perches, Oliver O'Halloran,
Dan Williams, Wei Yang, Christian König, Arnd Bergmann,
Deepa Dinamani, Daniel Thompson, Rob Landley, Florian Fainelli,
linux-alpha, linux-snps-arc, linux-arm-kernel,
adi-buildroot-devel, linux-c6x-dev, linux-cris-kernel,
uclinux-h8-devel, linux-hexagon, linux-ia64, linux-m68k,
linux-metag, Linux MIPS Mailing List, linux-am33-list, nios2-dev,
openrisc, linux-parisc, PowerPC, linux-s390, linux-sh, sparclinux,
user-mode-linux-devel, user-mode-linux-user, linux-xtensa
On Wed, Mar 28, 2018 at 09:55:07AM -0700, Kees Cook wrote:
>On Wed, Mar 28, 2018 at 8:26 AM, Shea Levy <shea@shealevy.com> wrote:
>> Now only those architectures that have custom initrd free requirements
>> need to define free_initrd_mem.
>>
>> Signed-off-by: Shea Levy <shea@shealevy.com>
>
>Yay consolidation! :)
>
>> --- a/usr/Kconfig
>> +++ b/usr/Kconfig
>> @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION
>> default ".lzma" if RD_LZMA
>> default ".bz2" if RD_BZIP2
>> default ""
>> +
>> +config HAVE_ARCH_FREE_INITRD_MEM
>> + bool
>> + default n
>
>If you keep the Kconfig, you can leave off "default n", and I'd
>suggest adding a help section just to describe what the per-arch
>responsibilities are when select-ing the config. (See
>HAVE_ARCH_SECCOMP_FILTER for an example.)
>
One question about this change.
The original code would "select" HAVE_ARCH_FREE_INITRD_MEM on those arch.
After this change, we need to manually "select" this?
>-Kees
>
>--
>Kees Cook
>Pixel Security
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:26 ` [PATCH] Extract initrd free logic from arch-specific code Shea Levy
2018-03-28 15:58 ` Rob Landley
2018-03-28 16:55 ` Kees Cook
@ 2018-03-30 1:43 ` kbuild test robot
2018-03-30 1:43 ` kbuild test robot
2018-03-30 3:16 ` kbuild test robot
2018-03-30 11:15 ` Ingo Molnar
4 siblings, 1 reply; 26+ messages in thread
From: kbuild test robot @ 2018-03-30 1:43 UTC (permalink / raw)
To: Shea Levy
Cc: kbuild-all, linux-riscv, linux-kernel, linux-mips, linux-sh,
Linus Walleij, Will Deacon, Paul Mackerras, James E.J. Bottomley,
Christoph Hellwig, Geert Uytterhoeven, Catalin Marinas,
Matt Turner, Eugeniy Paltsev, uclinux-h8-devel, Vladimir Murzin,
Marc Zyngier, adi-buildroot-devel, Al Viro, Thomas Gleixner,
Richard Henderson, linux-cris-kernel, Greg Kroah-Hartman,
Ralf Baechle, Richard Kuo, Joe Perches, Andrew Morton, linux-ia64,
James Hogan, Palmer Dabbelt, Max Filippov, Oliver O'Halloran,
Deepa Dinamani, Chen Liqin, Jesper Nilsson, linux-c6x-dev,
Yoshinori Sato, David S. Miller, linux-hexagon, Helge Deller,
linux-xtensa, Albert Ou, Philippe Ombredanne, Aurelien Jacquiot,
linux-m68k, Stafford Horne, linux-metag, linux-arm-kernel,
Chris Zankel, Tony Luck, Sudip Mukherjee, Martin Schwidefsky,
Kate Stewart, Heiko Carstens, Michal Hocko, Guan Xuetao,
Lennox Wu, Rob Herring, Daniel Thompson, Florian Fainelli,
linux-snps-arc, Fenghua Yu, Kees Cook, Arnd Bergmann, Jeff Dike,
Ivan Kokshaysky, Dan Williams, linux-parisc, Rob Landley,
linux-alpha, Ley Foon Tan, Christian König, Rich Felker,
Wei Yang, David Howells, H. Peter Anvin, sparclinux, Jonas Bonn,
linux-am33-list, Richard Weinberger, x86, Russell King, Shea Levy,
Ingo Molnar, Mark Salter, user-mode-linux-devel, linux-s390,
Stefan Kristiansson, Mikael Starvik, openrisc,
user-mode-linux-user, Vlastimil Babka, Michal Simek, Vineet Gupta,
nios2-dev, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
Hi Shea,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shea-Levy/Extract-initrd-free-logic-from-arch-specific-code/20180330-085507
config: ia64-allnoconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All warnings (new ones prefixed by >>):
warning: (IA64) selects HAVE_ARCH_FREE_INITRD_MEM which has unmet direct dependencies (BLK_DEV_INITRD)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 5949 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-30 1:43 ` kbuild test robot
@ 2018-03-30 1:43 ` kbuild test robot
0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2018-03-30 1:43 UTC (permalink / raw)
To: Shea Levy
Cc: kbuild-all, linux-riscv, linux-kernel, linux-mips, linux-sh,
Linus Walleij, Will Deacon, Paul Mackerras, James E.J. Bottomley,
Christoph Hellwig, Geert Uytterhoeven, Catalin Marinas,
Matt Turner, Eugeniy Paltsev, uclinux-h8-devel, Vladimir Murzin,
Marc Zyngier, adi-buildroot-devel, Al Viro, Thomas Gleixner,
Richard Henderson, linux-cris-kernel, Greg Kroah-Hartman,
Ralf Baechle, Richard Kuo, Joe Perches, Andrew Morton, linux-ia64,
James Hogan, Palmer Dabbelt, Max Filippov, Oliver O'Halloran,
Deepa Dinamani, Chen Liqin, Jesper Nilsson, linux-c6x-dev,
Yoshinori Sato, David S. Miller, linux-hexagon, Helge Deller,
linux-xtensa, Albert Ou, Philippe Ombredanne, Aurelien Jacquiot,
linux-m68k, Stafford Horne, linux-metag, linux-arm-kernel,
Chris Zankel, Tony Luck, Sudip Mukherjee, Martin Schwidefsky,
Kate Stewart, Heiko Carstens, Michal Hocko, Guan Xuetao,
Lennox Wu, Rob Herring, Daniel Thompson, Florian Fainelli,
linux-snps-arc, Fenghua Yu, Kees Cook, Arnd Bergmann, Jeff Dike,
Ivan Kokshaysky, Dan Williams, linux-parisc, Rob Landley,
linux-alpha, Ley Foon Tan, Christian König, Rich Felker,
Wei Yang, David Howells, H. Peter Anvin, sparclinux, Jonas Bonn,
linux-am33-list, Richard Weinberger, x86, Russell King,
Ingo Molnar, Mark Salter, user-mode-linux-devel, linux-s390,
Stefan Kristiansson, Mikael Starvik, openrisc,
user-mode-linux-user, Vlastimil Babka, Michal Simek, Vineet Gupta,
nios2-dev, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
Hi Shea,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shea-Levy/Extract-initrd-free-logic-from-arch-specific-code/20180330-085507
config: ia64-allnoconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All warnings (new ones prefixed by >>):
warning: (IA64) selects HAVE_ARCH_FREE_INITRD_MEM which has unmet direct dependencies (BLK_DEV_INITRD)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 5949 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:26 ` [PATCH] Extract initrd free logic from arch-specific code Shea Levy
` (2 preceding siblings ...)
2018-03-30 1:43 ` kbuild test robot
@ 2018-03-30 3:16 ` kbuild test robot
2018-03-30 3:16 ` kbuild test robot
2018-03-30 11:15 ` Ingo Molnar
4 siblings, 1 reply; 26+ messages in thread
From: kbuild test robot @ 2018-03-30 3:16 UTC (permalink / raw)
To: Shea Levy
Cc: kbuild-all, linux-riscv, linux-kernel, linux-mips, linux-sh,
Linus Walleij, Will Deacon, Paul Mackerras, James E.J. Bottomley,
Christoph Hellwig, Geert Uytterhoeven, Catalin Marinas,
Matt Turner, Eugeniy Paltsev, uclinux-h8-devel, Vladimir Murzin,
Marc Zyngier, adi-buildroot-devel, Al Viro, Thomas Gleixner,
Richard Henderson, linux-cris-kernel, Greg Kroah-Hartman,
Ralf Baechle, Richard Kuo, Joe Perches, Andrew Morton, linux-ia64,
James Hogan, Palmer Dabbelt, Max Filippov, Oliver O'Halloran,
Deepa Dinamani, Chen Liqin, Jesper Nilsson, linux-c6x-dev,
Yoshinori Sato, David S. Miller, linux-hexagon, Helge Deller,
linux-xtensa, Albert Ou, Philippe Ombredanne, Aurelien Jacquiot,
linux-m68k, Stafford Horne, linux-metag, linux-arm-kernel,
Chris Zankel, Tony Luck, Sudip Mukherjee, Martin Schwidefsky,
Kate Stewart, Heiko Carstens, Michal Hocko, Guan Xuetao,
Lennox Wu, Rob Herring, Daniel Thompson, Florian Fainelli,
linux-snps-arc, Fenghua Yu, Kees Cook, Arnd Bergmann, Jeff Dike,
Ivan Kokshaysky, Dan Williams, linux-parisc, Rob Landley,
linux-alpha, Ley Foon Tan, Christian König, Rich Felker,
Wei Yang, David Howells, H. Peter Anvin, sparclinux, Jonas Bonn,
linux-am33-list, Richard Weinberger, x86, Russell King, Shea Levy,
Ingo Molnar, Mark Salter, user-mode-linux-devel, linux-s390,
Stefan Kristiansson, Mikael Starvik, openrisc,
user-mode-linux-user, Vlastimil Babka, Michal Simek, Vineet Gupta,
nios2-dev, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
Hi Shea,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shea-Levy/Extract-initrd-free-logic-from-arch-specific-code/20180330-085507
config: m32r-m32104ut_defconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m32r
All warnings (new ones prefixed by >>):
warning: (M32R) selects HAVE_ARCH_FREE_INITRD_MEM which has unmet direct dependencies (BLK_DEV_INITRD)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 11473 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-30 3:16 ` kbuild test robot
@ 2018-03-30 3:16 ` kbuild test robot
0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2018-03-30 3:16 UTC (permalink / raw)
To: Shea Levy
Cc: kbuild-all, linux-riscv, linux-kernel, linux-mips, linux-sh,
Linus Walleij, Will Deacon, Paul Mackerras, James E.J. Bottomley,
Christoph Hellwig, Geert Uytterhoeven, Catalin Marinas,
Matt Turner, Eugeniy Paltsev, uclinux-h8-devel, Vladimir Murzin,
Marc Zyngier, adi-buildroot-devel, Al Viro, Thomas Gleixner,
Richard Henderson, linux-cris-kernel, Greg Kroah-Hartman,
Ralf Baechle, Richard Kuo, Joe Perches, Andrew Morton, linux-ia64,
James Hogan, Palmer Dabbelt, Max Filippov, Oliver O'Halloran,
Deepa Dinamani, Chen Liqin, Jesper Nilsson, linux-c6x-dev,
Yoshinori Sato, David S. Miller, linux-hexagon, Helge Deller,
linux-xtensa, Albert Ou, Philippe Ombredanne, Aurelien Jacquiot,
linux-m68k, Stafford Horne, linux-metag, linux-arm-kernel,
Chris Zankel, Tony Luck, Sudip Mukherjee, Martin Schwidefsky,
Kate Stewart, Heiko Carstens, Michal Hocko, Guan Xuetao,
Lennox Wu, Rob Herring, Daniel Thompson, Florian Fainelli,
linux-snps-arc, Fenghua Yu, Kees Cook, Arnd Bergmann, Jeff Dike,
Ivan Kokshaysky, Dan Williams, linux-parisc, Rob Landley,
linux-alpha, Ley Foon Tan, Christian König, Rich Felker,
Wei Yang, David Howells, H. Peter Anvin, sparclinux, Jonas Bonn,
linux-am33-list, Richard Weinberger, x86, Russell King,
Ingo Molnar, Mark Salter, user-mode-linux-devel, linux-s390,
Stefan Kristiansson, Mikael Starvik, openrisc,
user-mode-linux-user, Vlastimil Babka, Michal Simek, Vineet Gupta,
nios2-dev, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
Hi Shea,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shea-Levy/Extract-initrd-free-logic-from-arch-specific-code/20180330-085507
config: m32r-m32104ut_defconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m32r
All warnings (new ones prefixed by >>):
warning: (M32R) selects HAVE_ARCH_FREE_INITRD_MEM which has unmet direct dependencies (BLK_DEV_INITRD)
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 11473 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-28 15:26 ` [PATCH] Extract initrd free logic from arch-specific code Shea Levy
` (3 preceding siblings ...)
2018-03-30 3:16 ` kbuild test robot
@ 2018-03-30 11:15 ` Ingo Molnar
2018-04-01 15:05 ` Shea Levy
4 siblings, 1 reply; 26+ messages in thread
From: Ingo Molnar @ 2018-03-30 11:15 UTC (permalink / raw)
To: Shea Levy
Cc: linux-riscv, linux-kernel, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Russell King,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Rob Landley, Florian Fainelli, linux-alpha,
linux-snps-arc, linux-arm-kernel, adi-buildroot-devel,
linux-c6x-dev, linux-cris-kernel, uclinux-h8-devel, linux-hexagon,
linux-ia64, linux-m68k, linux-metag, linux-mips, linux-am33-list,
nios2-dev, openrisc, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
* Shea Levy <shea@shealevy.com> wrote:
> Now only those architectures that have custom initrd free requirements
> need to define free_initrd_mem.
>
> Signed-off-by: Shea Levy <shea@shealevy.com>
Please put the Kconfig symbol name this patch introduces both into the title, so
that people know what to grep for.
> ---
> arch/alpha/mm/init.c | 8 --------
> arch/arc/mm/init.c | 7 -------
> arch/arm/Kconfig | 1 +
> arch/arm64/Kconfig | 1 +
> arch/blackfin/Kconfig | 1 +
> arch/c6x/mm/init.c | 7 -------
> arch/cris/Kconfig | 1 +
> arch/frv/mm/init.c | 11 -----------
> arch/h8300/mm/init.c | 7 -------
> arch/hexagon/Kconfig | 1 +
> arch/ia64/Kconfig | 1 +
> arch/m32r/Kconfig | 1 +
> arch/m32r/mm/init.c | 11 -----------
> arch/m68k/mm/init.c | 7 -------
> arch/metag/Kconfig | 1 +
> arch/microblaze/mm/init.c | 7 -------
> arch/mips/Kconfig | 1 +
> arch/mn10300/Kconfig | 1 +
> arch/nios2/mm/init.c | 7 -------
> arch/openrisc/mm/init.c | 7 -------
> arch/parisc/mm/init.c | 7 -------
> arch/powerpc/mm/mem.c | 7 -------
> arch/riscv/mm/init.c | 6 ------
> arch/s390/Kconfig | 1 +
> arch/score/Kconfig | 1 +
> arch/sh/mm/init.c | 7 -------
> arch/sparc/Kconfig | 1 +
> arch/tile/Kconfig | 1 +
> arch/um/kernel/mem.c | 7 -------
> arch/unicore32/Kconfig | 1 +
> arch/x86/Kconfig | 1 +
> arch/xtensa/Kconfig | 1 +
> init/initramfs.c | 7 +++++++
> usr/Kconfig | 4 ++++
> 34 files changed, 28 insertions(+), 113 deletions(-)
Please also put it into Documentation/features/.
> diff --git a/usr/Kconfig b/usr/Kconfig
> index 43658b8a975e..7a94f6df39bf 100644
> --- a/usr/Kconfig
> +++ b/usr/Kconfig
> @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION
> default ".lzma" if RD_LZMA
> default ".bz2" if RD_BZIP2
> default ""
> +
> +config HAVE_ARCH_FREE_INITRD_MEM
> + bool
> + default n
Help text would be nice, to tell arch maintainers what the purpose of this switch
is.
Also, a nit, I think this should be named "ARCH_HAS_FREE_INITRD_MEM", which is the
dominant pattern:
triton:~/tip> git grep 'select.*ARCH' arch/x86/Kconfig* | cut -f2 | cut -d_ -f1-2 | sort | uniq -c | sort -n
...
2 select ARCH_USES
2 select ARCH_WANTS
3 select ARCH_MIGHT
3 select ARCH_WANT
4 select ARCH_SUPPORTS
4 select ARCH_USE
16 select HAVE_ARCH
23 select ARCH_HAS
It also reads nicely in English:
"arch has free_initrd_mem()"
While the other makes little sense:
"have arch free_initrd_mem()"
?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-03-30 11:15 ` Ingo Molnar
@ 2018-04-01 15:05 ` Shea Levy
2018-04-02 5:59 ` Ingo Molnar
0 siblings, 1 reply; 26+ messages in thread
From: Shea Levy @ 2018-04-01 15:05 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-riscv, linux-kernel, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Russell King,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Rob Landley, Florian Fainelli, linux-alpha,
linux-snps-arc, linux-arm-kernel, adi-buildroot-devel,
linux-c6x-dev, linux-cris-kernel, uclinux-h8-devel, linux-hexagon,
linux-ia64, linux-m68k, linux-metag, linux-mips, linux-am33-list,
nios2-dev, openrisc, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
[-- Attachment #1: Type: text/plain, Size: 3181 bytes --]
Hi Ingo,
Ingo Molnar <mingo@kernel.org> writes:
> * Shea Levy <shea@shealevy.com> wrote:
>
>> Now only those architectures that have custom initrd free requirements
>> need to define free_initrd_mem.
>>
>> Signed-off-by: Shea Levy <shea@shealevy.com>
>
> Please put the Kconfig symbol name this patch introduces both into the title, so
> that people know what to grep for.
>
>> ---
>> arch/alpha/mm/init.c | 8 --------
>> arch/arc/mm/init.c | 7 -------
>> arch/arm/Kconfig | 1 +
>> arch/arm64/Kconfig | 1 +
>> arch/blackfin/Kconfig | 1 +
>> arch/c6x/mm/init.c | 7 -------
>> arch/cris/Kconfig | 1 +
>> arch/frv/mm/init.c | 11 -----------
>> arch/h8300/mm/init.c | 7 -------
>> arch/hexagon/Kconfig | 1 +
>> arch/ia64/Kconfig | 1 +
>> arch/m32r/Kconfig | 1 +
>> arch/m32r/mm/init.c | 11 -----------
>> arch/m68k/mm/init.c | 7 -------
>> arch/metag/Kconfig | 1 +
>> arch/microblaze/mm/init.c | 7 -------
>> arch/mips/Kconfig | 1 +
>> arch/mn10300/Kconfig | 1 +
>> arch/nios2/mm/init.c | 7 -------
>> arch/openrisc/mm/init.c | 7 -------
>> arch/parisc/mm/init.c | 7 -------
>> arch/powerpc/mm/mem.c | 7 -------
>> arch/riscv/mm/init.c | 6 ------
>> arch/s390/Kconfig | 1 +
>> arch/score/Kconfig | 1 +
>> arch/sh/mm/init.c | 7 -------
>> arch/sparc/Kconfig | 1 +
>> arch/tile/Kconfig | 1 +
>> arch/um/kernel/mem.c | 7 -------
>> arch/unicore32/Kconfig | 1 +
>> arch/x86/Kconfig | 1 +
>> arch/xtensa/Kconfig | 1 +
>> init/initramfs.c | 7 +++++++
>> usr/Kconfig | 4 ++++
>> 34 files changed, 28 insertions(+), 113 deletions(-)
>
> Please also put it into Documentation/features/.
>
I switched this patch series (the latest revision v6 was just posted) to
using weak symbols instead of Kconfig. Does it still warrant documentation?
>
>> diff --git a/usr/Kconfig b/usr/Kconfig
>> index 43658b8a975e..7a94f6df39bf 100644
>> --- a/usr/Kconfig
>> +++ b/usr/Kconfig
>> @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION
>> default ".lzma" if RD_LZMA
>> default ".bz2" if RD_BZIP2
>> default ""
>> +
>> +config HAVE_ARCH_FREE_INITRD_MEM
>> + bool
>> + default n
>
> Help text would be nice, to tell arch maintainers what the purpose of this switch
> is.
>
> Also, a nit, I think this should be named "ARCH_HAS_FREE_INITRD_MEM", which is the
> dominant pattern:
>
> triton:~/tip> git grep 'select.*ARCH' arch/x86/Kconfig* | cut -f2 | cut -d_ -f1-2 | sort | uniq -c | sort -n
> ...
> 2 select ARCH_USES
> 2 select ARCH_WANTS
> 3 select ARCH_MIGHT
> 3 select ARCH_WANT
> 4 select ARCH_SUPPORTS
> 4 select ARCH_USE
> 16 select HAVE_ARCH
> 23 select ARCH_HAS
>
> It also reads nicely in English:
>
> "arch has free_initrd_mem()"
>
> While the other makes little sense:
>
> "have arch free_initrd_mem()"
>
> ?
>
> Thanks,
>
> Ingo
Thanks,
Shea
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH] Extract initrd free logic from arch-specific code.
2018-04-01 15:05 ` Shea Levy
@ 2018-04-02 5:59 ` Ingo Molnar
0 siblings, 0 replies; 26+ messages in thread
From: Ingo Molnar @ 2018-04-02 5:59 UTC (permalink / raw)
To: Shea Levy
Cc: linux-riscv, linux-kernel, Christoph Hellwig, Richard Henderson,
Ivan Kokshaysky, Matt Turner, Vineet Gupta, Russell King,
Catalin Marinas, Will Deacon, Mark Salter, Aurelien Jacquiot,
Mikael Starvik, Jesper Nilsson, Yoshinori Sato, Richard Kuo,
Tony Luck, Fenghua Yu, Geert Uytterhoeven, James Hogan,
Michal Simek, Ralf Baechle, David Howells, Ley Foon Tan,
Jonas Bonn, Stefan Kristiansson, Stafford Horne,
James E.J. Bottomley, Helge Deller, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Palmer Dabbelt, Albert Ou,
Martin Schwidefsky, Heiko Carstens, Chen Liqin, Lennox Wu,
Rich Felker, David S. Miller, Jeff Dike, Richard Weinberger,
Guan Xuetao, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Chris Zankel, Max Filippov, Kate Stewart, Greg Kroah-Hartman,
Philippe Ombredanne, Eugeniy Paltsev, Al Viro, Vladimir Murzin,
Linus Walleij, Michal Hocko, Andrew Morton, Sudip Mukherjee,
Marc Zyngier, Rob Herring, Kees Cook, Vlastimil Babka,
Balbir Singh, Christophe Leroy, Joe Perches,
Oliver O'Halloran, Dan Williams, Wei Yang,
Christian König, Arnd Bergmann, Deepa Dinamani,
Daniel Thompson, Rob Landley, Florian Fainelli, linux-alpha,
linux-snps-arc, linux-arm-kernel, adi-buildroot-devel,
linux-c6x-dev, linux-cris-kernel, uclinux-h8-devel, linux-hexagon,
linux-ia64, linux-m68k, linux-metag, linux-mips, linux-am33-list,
nios2-dev, openrisc, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, user-mode-linux-devel, user-mode-linux-user,
linux-xtensa
* Shea Levy <shea@shealevy.com> wrote:
> > Please also put it into Documentation/features/.
>
> I switched this patch series (the latest revision v6 was just posted) to
> using weak symbols instead of Kconfig. Does it still warrant documentation?
Probably not.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 26+ messages in thread