2021-05-21 09:03:12

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH 0/3] hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN

Hi all,

This series fixes an error with ARCH=hexagon that was pointed out by
the patch "mm/slub: use stackdepot to save stack trace in objects",
which is in -mm/-next.

The first patch fixes that error by handling the '.irqentry.text' and
'.softirqentry.text' sections.

The second patch switches Hexagon over to the common DISCARDS macro,
which should have been done when Hexagon was merged into the tree to
match commit 023bf6f1b8bf ("linker script: unify usage of discard
definition").

The third patch selects CONFIG_ARCH_WANT_LD_ORPHAN_WARN so that
something like this does not happen again.

Nathan Chancellor (3):
hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
hexagon: Use common DISCARDS macro
hexagon: Select ARCH_WANT_LD_ORPHAN_WARN

arch/hexagon/Kconfig | 1 +
arch/hexagon/kernel/vmlinux.lds.S | 9 +++------
2 files changed, 4 insertions(+), 6 deletions(-)


base-commit: 7a42b92b6d30c3f09629c7d5ada9e3de2aba01af
--
2.32.0.rc0


2021-05-21 09:03:25

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH 3/3] hexagon: Select ARCH_WANT_LD_ORPHAN_WARN

Now that we handle all of the sections in a Hexagon defconfig, select
ARCH_WANT_LD_ORPHAN_WARN so that unhandled sections are warned about by
default.

Signed-off-by: Nathan Chancellor <[email protected]>
---
arch/hexagon/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 44a409967af1..e5a852080730 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -30,6 +30,7 @@ config HEXAGON
select MODULES_USE_ELF_RELA
select GENERIC_CPU_DEVICES
select SET_FS
+ select ARCH_WANT_LD_ORPHAN_WARN
help
Qualcomm Hexagon is a processor architecture designed for high
performance and low power across a wide variety of applications.
--
2.32.0.rc0

2021-05-21 20:05:30

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH 2/3] hexagon: Use common DISCARDS macro

ld.lld warns that the '.modinfo' section is not currently handled:

ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed in '.modinfo'
ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being placed in '.modinfo'
ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being placed in '.modinfo'
ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being placed in '.modinfo'

The '.modinfo' section was added in commit 898490c010b5 ("moduleparam:
Save information about built-in modules in separate file") to the
DISCARDS macro but Hexagon has never used that macro. The unification of
DISCARDS happened in commit 023bf6f1b8bf ("linker script: unify usage of
discard definition") in 2009, prior to Hexagon being added in 2011.

Switch Hexagon over to the DISCARDS macro so that anything that is
expected to be discarded gets discarded.

Fixes: e95bf452a9e2 ("Hexagon: Add configuration and makefiles for the Hexagon architecture.")
Signed-off-by: Nathan Chancellor <[email protected]>
---
arch/hexagon/kernel/vmlinux.lds.S | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S
index 20f19539c5fc..57465bff1fe4 100644
--- a/arch/hexagon/kernel/vmlinux.lds.S
+++ b/arch/hexagon/kernel/vmlinux.lds.S
@@ -61,14 +61,9 @@ SECTIONS

_end = .;

- /DISCARD/ : {
- EXIT_TEXT
- EXIT_DATA
- EXIT_CALL
- }
-
STABS_DEBUG
DWARF_DEBUG
ELF_DETAILS

+ DISCARDS
}
--
2.32.0.rc0

2021-06-01 19:21:27

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH 2/3] hexagon: Use common DISCARDS macro

On Thu, May 20, 2021 at 6:13 PM Nathan Chancellor <[email protected]> wrote:
>
> ld.lld warns that the '.modinfo' section is not currently handled:
>
> ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed in '.modinfo'
> ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being placed in '.modinfo'
> ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being placed in '.modinfo'
> ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being placed in '.modinfo'
>
> The '.modinfo' section was added in commit 898490c010b5 ("moduleparam:
> Save information about built-in modules in separate file") to the
> DISCARDS macro but Hexagon has never used that macro. The unification of
> DISCARDS happened in commit 023bf6f1b8bf ("linker script: unify usage of
> discard definition") in 2009, prior to Hexagon being added in 2011.
>
> Switch Hexagon over to the DISCARDS macro so that anything that is
> expected to be discarded gets discarded.
>
> Fixes: e95bf452a9e2 ("Hexagon: Add configuration and makefiles for the Hexagon architecture.")
> Signed-off-by: Nathan Chancellor <[email protected]>

Thanks for the patch.
Reviewed-by: Nick Desaulniers <[email protected]>

> ---
> arch/hexagon/kernel/vmlinux.lds.S | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S
> index 20f19539c5fc..57465bff1fe4 100644
> --- a/arch/hexagon/kernel/vmlinux.lds.S
> +++ b/arch/hexagon/kernel/vmlinux.lds.S
> @@ -61,14 +61,9 @@ SECTIONS
>
> _end = .;
>
> - /DISCARD/ : {
> - EXIT_TEXT
> - EXIT_DATA
> - EXIT_CALL
> - }
> -
> STABS_DEBUG
> DWARF_DEBUG
> ELF_DETAILS
>
> + DISCARDS
> }
> --
> 2.32.0.rc0
>


--
Thanks,
~Nick Desaulniers

2021-06-01 19:22:55

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH 3/3] hexagon: Select ARCH_WANT_LD_ORPHAN_WARN

On Thu, May 20, 2021 at 6:13 PM Nathan Chancellor <[email protected]> wrote:
>
> Now that we handle all of the sections in a Hexagon defconfig, select
> ARCH_WANT_LD_ORPHAN_WARN so that unhandled sections are warned about by
> default.

Great to see another arch using this build-safety feature!
Reviewed-by: Nick Desaulniers <[email protected]>

>
> Signed-off-by: Nathan Chancellor <[email protected]>
> ---
> arch/hexagon/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
> index 44a409967af1..e5a852080730 100644
> --- a/arch/hexagon/Kconfig
> +++ b/arch/hexagon/Kconfig
> @@ -30,6 +30,7 @@ config HEXAGON
> select MODULES_USE_ELF_RELA
> select GENERIC_CPU_DEVICES
> select SET_FS
> + select ARCH_WANT_LD_ORPHAN_WARN
> help
> Qualcomm Hexagon is a processor architecture designed for high
> performance and low power across a wide variety of applications.
> --
> 2.32.0.rc0
>


--
Thanks,
~Nick Desaulniers

2021-06-03 01:18:25

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 0/3] hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN

On 5/20/2021 6:12 PM, Nathan Chancellor wrote:
> Hi all,
>
> This series fixes an error with ARCH=hexagon that was pointed out by
> the patch "mm/slub: use stackdepot to save stack trace in objects",
> which is in -mm/-next.
>
> The first patch fixes that error by handling the '.irqentry.text' and
> '.softirqentry.text' sections.
>
> The second patch switches Hexagon over to the common DISCARDS macro,
> which should have been done when Hexagon was merged into the tree to
> match commit 023bf6f1b8bf ("linker script: unify usage of discard
> definition").
>
> The third patch selects CONFIG_ARCH_WANT_LD_ORPHAN_WARN so that
> something like this does not happen again.
>
> Nathan Chancellor (3):
> hexagon: Handle {,SOFT}IRQENTRY_TEXT in linker script
> hexagon: Use common DISCARDS macro
> hexagon: Select ARCH_WANT_LD_ORPHAN_WARN
>
> arch/hexagon/Kconfig | 1 +
> arch/hexagon/kernel/vmlinux.lds.S | 9 +++------
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
>
> base-commit: 7a42b92b6d30c3f09629c7d5ada9e3de2aba01af
>

Brian, did you have any comments on this series? ARCH=hexagon defconfig
is currently broken in -next, it would be a real shame if this continued
to regress after you just got Hexagon building in mainline. These
patches seem like they would be worthy of a 5.13 pull request.
Otherwise, Andrew could pick them up with your ack and stick them in
front of "mm/slub: use stackdepot to save stack trace in objects" so
that there is no build regression.

Cheers,
Nathan

2021-06-03 17:01:45

by Brian Cain

[permalink] [raw]
Subject: RE: [PATCH 0/3] hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN

> -----Original Message-----
> From: Nathan Chancellor <[email protected]>
...
> On 5/20/2021 6:12 PM, Nathan Chancellor wrote:
> > Hi all,
...
> Brian, did you have any comments on this series? ARCH=hexagon defconfig
> is currently broken in -next, it would be a real shame if this continued
> to regress after you just got Hexagon building in mainline. These
> patches seem like they would be worthy of a 5.13 pull request.

I have started the internal review process to get these queued up in my tree. But I don't know if I would have it in time for 5.13.

> Otherwise, Andrew could pick them up with your ack and stick them in
> front of "mm/slub: use stackdepot to save stack trace in objects" so
> that there is no build regression.

Of course: I'll send my ack for the sake of keeping the build green.

-Brian

2021-06-03 17:02:47

by Brian Cain

[permalink] [raw]
Subject: RE: [PATCH 2/3] hexagon: Use common DISCARDS macro



> -----Original Message-----
> From: Nathan Chancellor <[email protected]>
> Sent: Thursday, May 20, 2021 8:13 PM
> To: Brian Cain <[email protected]>; Andrew Morton <akpm@linux-
> foundation.org>
> Cc: Nick Desaulniers <[email protected]>; linux-
> [email protected]; [email protected]; clang-built-
> [email protected]; Nathan Chancellor <[email protected]>
> Subject: [PATCH 2/3] hexagon: Use common DISCARDS macro
>
> ld.lld warns that the '.modinfo' section is not currently handled:
>
> ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed
in
> '.modinfo'
> ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being
placed in
> '.modinfo'
> ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being
placed in
> '.modinfo'
> ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being
placed in
> '.modinfo'
>
> The '.modinfo' section was added in commit 898490c010b5 ("moduleparam:
> Save information about built-in modules in separate file") to the
> DISCARDS macro but Hexagon has never used that macro. The unification of
> DISCARDS happened in commit 023bf6f1b8bf ("linker script: unify usage of
> discard definition") in 2009, prior to Hexagon being added in 2011.
>
> Switch Hexagon over to the DISCARDS macro so that anything that is
> expected to be discarded gets discarded.
>
> Fixes: e95bf452a9e2 ("Hexagon: Add configuration and makefiles for the
> Hexagon architecture.")
> Signed-off-by: Nathan Chancellor <[email protected]>
> ---
> arch/hexagon/kernel/vmlinux.lds.S | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/hexagon/kernel/vmlinux.lds.S
> b/arch/hexagon/kernel/vmlinux.lds.S
> index 20f19539c5fc..57465bff1fe4 100644
> --- a/arch/hexagon/kernel/vmlinux.lds.S
> +++ b/arch/hexagon/kernel/vmlinux.lds.S
> @@ -61,14 +61,9 @@ SECTIONS
>
> _end = .;
>
> - /DISCARD/ : {
> - EXIT_TEXT
> - EXIT_DATA
> - EXIT_CALL
> - }
> -
> STABS_DEBUG
> DWARF_DEBUG
> ELF_DETAILS
>
> + DISCARDS
> }
> --
> 2.32.0.rc0

Acked-by: Brian Cain <[email protected]>

2021-06-03 17:03:02

by Brian Cain

[permalink] [raw]
Subject: RE: [PATCH 3/3] hexagon: Select ARCH_WANT_LD_ORPHAN_WARN



> -----Original Message-----
> From: Nathan Chancellor <[email protected]>
> Sent: Thursday, May 20, 2021 8:13 PM
> To: Brian Cain <[email protected]>; Andrew Morton <akpm@linux-
> foundation.org>
> Cc: Nick Desaulniers <[email protected]>; linux-
> [email protected]; [email protected]; clang-built-
> [email protected]; Nathan Chancellor <[email protected]>
> Subject: [PATCH 3/3] hexagon: Select ARCH_WANT_LD_ORPHAN_WARN
>
> Now that we handle all of the sections in a Hexagon defconfig, select
> ARCH_WANT_LD_ORPHAN_WARN so that unhandled sections are warned
> about by
> default.
>
> Signed-off-by: Nathan Chancellor <[email protected]>
> ---
> arch/hexagon/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
> index 44a409967af1..e5a852080730 100644
> --- a/arch/hexagon/Kconfig
> +++ b/arch/hexagon/Kconfig
> @@ -30,6 +30,7 @@ config HEXAGON
> select MODULES_USE_ELF_RELA
> select GENERIC_CPU_DEVICES
> select SET_FS
> + select ARCH_WANT_LD_ORPHAN_WARN
> help
> Qualcomm Hexagon is a processor architecture designed for high
> performance and low power across a wide variety of applications.
> --
> 2.32.0.rc0

Acked-by: Brian Cain <[email protected]>

2021-06-15 17:27:19

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 0/3] hexagon: Fix build error with CONFIG_STACKDEPOT and select CONFIG_ARCH_WANT_LD_ORPHAN_WARN

On Thu, Jun 03, 2021 at 11:59:43AM -0500, Brian Cain wrote:
> > -----Original Message-----
> > From: Nathan Chancellor <[email protected]>
> ...
> > On 5/20/2021 6:12 PM, Nathan Chancellor wrote:
> > > Hi all,
> ...
> > Brian, did you have any comments on this series? ARCH=hexagon defconfig
> > is currently broken in -next, it would be a real shame if this continued
> > to regress after you just got Hexagon building in mainline. These
> > patches seem like they would be worthy of a 5.13 pull request.
>
> I have started the internal review process to get these queued up in my tree. But I don't know if I would have it in time for 5.13.
>
> > Otherwise, Andrew could pick them up with your ack and stick them in
> > front of "mm/slub: use stackdepot to save stack trace in objects" so
> > that there is no build regression.
>
> Of course: I'll send my ack for the sake of keeping the build green.
>
> -Brian

Andrew, is there any way you can pick this up so that the Hexagon build
can start being green? I explained the issue in the cover letter so that
you know where to stick this patch set in your stack. If you have any
more questions, please let me know.

Cheers,
Nathan