* [PATCH v3] RISC-V: Enable dead code elimination
@ 2023-05-17 8:29 Zhangjin Wu
2023-05-17 8:41 ` Zhangjin Wu
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Zhangjin Wu @ 2023-05-17 8:29 UTC (permalink / raw)
To: palmer
Cc: falcon, conor, guoren, linux-riscv, npiggin, paul.walmsley,
paulburton, vincent.chen, tim.bird
Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
the user to enable dead code elimination. In order for this to work,
ensure that we keep the alternative table by annotating them with KEEP.
This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
it only shrinks their builds by ~1%, a smaller config is thereforce
customized to test this feature:
| rv32 | rv64
--------|------------------------|---------------------
No DCE | 4460684 | 4893488
DCE | 3986716 | 4376400
Shrink | 473968 (~10.6%) | 517088 (~10.5%)
The config used above only reserves necessary options to boot on qemu
with serial console, more like the size-critical embedded scenes:
- rv64 config: https://pastebin.com/crz82T0s
- rv32 config: rv64 config + 32-bit.config
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
arch/riscv/Kconfig | 1 +
arch/riscv/kernel/vmlinux.lds.S | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 348c0fa1fc8c..d2eb1a862ea8 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -111,6 +111,7 @@ config RISCV
select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
select HAVE_KRETPROBES if !XIP_KERNEL
select HAVE_RETHOOK if !XIP_KERNEL
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
select HAVE_MOVE_PMD
select HAVE_MOVE_PUD
select HAVE_PCI
diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index e5f9f4677bbf..0f5dfbc113d4 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -112,7 +112,7 @@ SECTIONS
. = ALIGN(8);
.alternative : {
__alt_start = .;
- *(.alternative)
+ KEEP(*(.alternative))
__alt_end = .;
}
__init_end = .;
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-17 8:29 [PATCH v3] RISC-V: Enable dead code elimination Zhangjin Wu
@ 2023-05-17 8:41 ` Zhangjin Wu
2023-05-21 2:23 ` guoren
` (3 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Zhangjin Wu @ 2023-05-17 8:41 UTC (permalink / raw)
To: palmer
Cc: falcon, conor, guoren, linux-riscv, npiggin, paul.walmsley,
paulburton, vincent.chen, tim.bird
Hello, Maintainers
No changes from v2 to v3, only rebased on v6.4-rc2, it compiled and
booted.
This is part of my tinylinux work for RISC-V, the other patches are
coming soon.
Thanks,
Zhangjin Wu
> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> the user to enable dead code elimination. In order for this to work,
> ensure that we keep the alternative table by annotating them with KEEP.
>
> This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> it only shrinks their builds by ~1%, a smaller config is thereforce
> customized to test this feature:
>
> | rv32 | rv64
> --------|------------------------|---------------------
> No DCE | 4460684 | 4893488
> DCE | 3986716 | 4376400
> Shrink | 473968 (~10.6%) | 517088 (~10.5%)
>
> The config used above only reserves necessary options to boot on qemu
> with serial console, more like the size-critical embedded scenes:
>
> - rv64 config: https://pastebin.com/crz82T0s
> - rv32 config: rv64 config + 32-bit.config
>
> Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> ---
> arch/riscv/Kconfig | 1 +
> arch/riscv/kernel/vmlinux.lds.S | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 348c0fa1fc8c..d2eb1a862ea8 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -111,6 +111,7 @@ config RISCV
> select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
> select HAVE_KRETPROBES if !XIP_KERNEL
> select HAVE_RETHOOK if !XIP_KERNEL
> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> select HAVE_MOVE_PMD
> select HAVE_MOVE_PUD
> select HAVE_PCI
> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> index e5f9f4677bbf..0f5dfbc113d4 100644
> --- a/arch/riscv/kernel/vmlinux.lds.S
> +++ b/arch/riscv/kernel/vmlinux.lds.S
> @@ -112,7 +112,7 @@ SECTIONS
> . = ALIGN(8);
> .alternative : {
> __alt_start = .;
> - *(.alternative)
> + KEEP(*(.alternative))
> __alt_end = .;
> }
> __init_end = .;
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-17 8:29 [PATCH v3] RISC-V: Enable dead code elimination Zhangjin Wu
2023-05-17 8:41 ` Zhangjin Wu
@ 2023-05-21 2:23 ` guoren
2023-05-21 4:09 ` Bin Meng
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: guoren @ 2023-05-21 2:23 UTC (permalink / raw)
To: falcon, guoren
Cc: conor, linux-riscv, npiggin, palmer, paul.walmsley, paulburton,
tim.bird, vincent.chen
>
> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> the user to enable dead code elimination. In order for this to work,
> ensure that we keep the alternative table by annotating them with KEEP.
>
> This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> it only shrinks their builds by ~1%, a smaller config is thereforce
> customized to test this feature:
>
> | rv32 | rv64
> --------|------------------------|---------------------
> No DCE | 4460684 | 4893488
> DCE | 3986716 | 4376400
> Shrink | 473968 (~10.6%) | 517088 (~10.5%)
Good point and other arch also support the feature e.g. commit:
c0436b503591 ("MIPS: Enable dead code elimination")
Reviewed-by: Guo Ren <guoren@kernel.org>
>
> The config used above only reserves necessary options to boot on qemu
> with serial console, more like the size-critical embedded scenes:
>
> - rv64 config: https://pastebin.com/crz82T0s
> - rv32 config: rv64 config + 32-bit.config
>
> Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> ---
> arch/riscv/Kconfig | 1 +
> arch/riscv/kernel/vmlinux.lds.S | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 348c0fa1fc8c..d2eb1a862ea8 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -111,6 +111,7 @@ config RISCV
> select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
> select HAVE_KRETPROBES if !XIP_KERNEL
> select HAVE_RETHOOK if !XIP_KERNEL
> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> select HAVE_MOVE_PMD
> select HAVE_MOVE_PUD
> select HAVE_PCI
> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> index e5f9f4677bbf..0f5dfbc113d4 100644
> --- a/arch/riscv/kernel/vmlinux.lds.S
> +++ b/arch/riscv/kernel/vmlinux.lds.S
> @@ -112,7 +112,7 @@ SECTIONS
> . = ALIGN(8);
> .alternative : {
> __alt_start = .;
> - *(.alternative)
> + KEEP(*(.alternative))
> __alt_end = .;
> }
> __init_end = .;
> --
> 2.25.1
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-17 8:29 [PATCH v3] RISC-V: Enable dead code elimination Zhangjin Wu
2023-05-17 8:41 ` Zhangjin Wu
2023-05-21 2:23 ` guoren
@ 2023-05-21 4:09 ` Bin Meng
2023-05-21 8:48 ` Jisheng Zhang
2023-06-20 20:13 ` Nick Desaulniers
4 siblings, 0 replies; 16+ messages in thread
From: Bin Meng @ 2023-05-21 4:09 UTC (permalink / raw)
To: falcon
Cc: conor, guoren, linux-riscv, npiggin, palmer, paul.walmsley,
paulburton, tim.bird, vincent.chen
> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> the user to enable dead code elimination. In order for this to work,
> ensure that we keep the alternative table by annotating them with KEEP.
>
> This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> it only shrinks their builds by ~1%, a smaller config is thereforce
> customized to test this feature:
>
> | rv32 | rv64
> --------|------------------------|---------------------
> No DCE | 4460684 | 4893488
> DCE | 3986716 | 4376400
> Shrink | 473968 (~10.6%) | 517088 (~10.5%)
>
> The config used above only reserves necessary options to boot on qemu
> with serial console, more like the size-critical embedded scenes:
>
> - rv64 config: https://pastebin.com/crz82T0s
> - rv32 config: rv64 config + 32-bit.config
>
> Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> ---
> arch/riscv/Kconfig | 1 +
> arch/riscv/kernel/vmlinux.lds.S | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
Tested-by: Bin Meng <bmeng@tinylab.org>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-17 8:29 [PATCH v3] RISC-V: Enable dead code elimination Zhangjin Wu
` (2 preceding siblings ...)
2023-05-21 4:09 ` Bin Meng
@ 2023-05-21 8:48 ` Jisheng Zhang
2023-05-21 8:51 ` Jisheng Zhang
2023-05-21 12:41 ` Zhangjin Wu
2023-06-20 20:13 ` Nick Desaulniers
4 siblings, 2 replies; 16+ messages in thread
From: Jisheng Zhang @ 2023-05-21 8:48 UTC (permalink / raw)
To: Zhangjin Wu
Cc: palmer, conor, guoren, linux-riscv, npiggin, paul.walmsley,
paulburton, vincent.chen, tim.bird
On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> the user to enable dead code elimination. In order for this to work,
> ensure that we keep the alternative table by annotating them with KEEP.
>
> This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> it only shrinks their builds by ~1%, a smaller config is thereforce
> customized to test this feature:
OOPS, I didn't noticed that you have sent out the patch and you are now
in v3. I may read your patch sevral months ago, but I forget it.
But your version missed an important preparation patch which is
to fix the typo in commom vmlinux.lds.h in asm-generic, thus LD_ORPHAN_WARN
will warn loudly. See[1] for more details.
Another missing point is we need to keep the .init.pi* and .init.bss*
sections. See[1] for more details.
Since you are the first person to send out the patch of
HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv, do you mind if I update
my series and take your patch in my series v2, make you as the commmit
author, use your commit msg, and add my co-developped tag etc?
Thanks
>
> | rv32 | rv64
> --------|------------------------|---------------------
> No DCE | 4460684 | 4893488
> DCE | 3986716 | 4376400
> Shrink | 473968 (~10.6%) | 517088 (~10.5%)
>
> The config used above only reserves necessary options to boot on qemu
> with serial console, more like the size-critical embedded scenes:
>
> - rv64 config: https://pastebin.com/crz82T0s
> - rv32 config: rv64 config + 32-bit.config
>
> Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> ---
> arch/riscv/Kconfig | 1 +
> arch/riscv/kernel/vmlinux.lds.S | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 348c0fa1fc8c..d2eb1a862ea8 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -111,6 +111,7 @@ config RISCV
> select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
> select HAVE_KRETPROBES if !XIP_KERNEL
> select HAVE_RETHOOK if !XIP_KERNEL
> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> select HAVE_MOVE_PMD
> select HAVE_MOVE_PUD
> select HAVE_PCI
> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> index e5f9f4677bbf..0f5dfbc113d4 100644
> --- a/arch/riscv/kernel/vmlinux.lds.S
> +++ b/arch/riscv/kernel/vmlinux.lds.S
> @@ -112,7 +112,7 @@ SECTIONS
> . = ALIGN(8);
> .alternative : {
> __alt_start = .;
> - *(.alternative)
> + KEEP(*(.alternative))
> __alt_end = .;
> }
> __init_end = .;
> --
> 2.25.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-21 8:48 ` Jisheng Zhang
@ 2023-05-21 8:51 ` Jisheng Zhang
2023-05-21 9:08 ` Jisheng Zhang
2023-05-21 12:41 ` Zhangjin Wu
1 sibling, 1 reply; 16+ messages in thread
From: Jisheng Zhang @ 2023-05-21 8:51 UTC (permalink / raw)
To: Zhangjin Wu
Cc: palmer, conor, guoren, linux-riscv, npiggin, paul.walmsley,
paulburton, vincent.chen, tim.bird
On Sun, May 21, 2023 at 04:48:47PM +0800, Jisheng Zhang wrote:
> On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> > Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> > the user to enable dead code elimination. In order for this to work,
> > ensure that we keep the alternative table by annotating them with KEEP.
> >
> > This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> > it only shrinks their builds by ~1%, a smaller config is thereforce
> > customized to test this feature:
>
> OOPS, I didn't noticed that you have sent out the patch and you are now
> in v3. I may read your patch sevral months ago, but I forget it.
> But your version missed an important preparation patch which is
> to fix the typo in commom vmlinux.lds.h in asm-generic, thus LD_ORPHAN_WARN
> will warn loudly. See[1] for more details.
>
> Another missing point is we need to keep the .init.pi* and .init.bss*
> sections. See[1] for more details.
>
> Since you are the first person to send out the patch of
> HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv, do you mind if I update
> my series and take your patch in my series v2, make you as the commmit
> author, use your commit msg, and add my co-developped tag etc?
forget to add Link reference:
[1] Link: https://lore.kernel.org/linux-riscv/20230511141211.2418-1-jszhang@kernel.org/
>
> Thanks
>
> >
> > | rv32 | rv64
> > --------|------------------------|---------------------
> > No DCE | 4460684 | 4893488
> > DCE | 3986716 | 4376400
> > Shrink | 473968 (~10.6%) | 517088 (~10.5%)
> >
> > The config used above only reserves necessary options to boot on qemu
> > with serial console, more like the size-critical embedded scenes:
> >
> > - rv64 config: https://pastebin.com/crz82T0s
> > - rv32 config: rv64 config + 32-bit.config
> >
> > Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> > ---
> > arch/riscv/Kconfig | 1 +
> > arch/riscv/kernel/vmlinux.lds.S | 2 +-
> > 2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 348c0fa1fc8c..d2eb1a862ea8 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -111,6 +111,7 @@ config RISCV
> > select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
> > select HAVE_KRETPROBES if !XIP_KERNEL
> > select HAVE_RETHOOK if !XIP_KERNEL
> > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> > select HAVE_MOVE_PMD
> > select HAVE_MOVE_PUD
> > select HAVE_PCI
> > diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> > index e5f9f4677bbf..0f5dfbc113d4 100644
> > --- a/arch/riscv/kernel/vmlinux.lds.S
> > +++ b/arch/riscv/kernel/vmlinux.lds.S
> > @@ -112,7 +112,7 @@ SECTIONS
> > . = ALIGN(8);
> > .alternative : {
> > __alt_start = .;
> > - *(.alternative)
> > + KEEP(*(.alternative))
> > __alt_end = .;
> > }
> > __init_end = .;
> > --
> > 2.25.1
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-21 8:51 ` Jisheng Zhang
@ 2023-05-21 9:08 ` Jisheng Zhang
0 siblings, 0 replies; 16+ messages in thread
From: Jisheng Zhang @ 2023-05-21 9:08 UTC (permalink / raw)
To: Zhangjin Wu
Cc: palmer, conor, guoren, linux-riscv, npiggin, paul.walmsley,
paulburton, vincent.chen, tim.bird
On Sun, May 21, 2023 at 04:51:14PM +0800, Jisheng Zhang wrote:
> On Sun, May 21, 2023 at 04:48:47PM +0800, Jisheng Zhang wrote:
> > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> > > Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> > > the user to enable dead code elimination. In order for this to work,
> > > ensure that we keep the alternative table by annotating them with KEEP.
> > >
> > > This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> > > it only shrinks their builds by ~1%, a smaller config is thereforce
> > > customized to test this feature:
> >
> > OOPS, I didn't noticed that you have sent out the patch and you are now
> > in v3. I may read your patch sevral months ago, but I forget it.
> > But your version missed an important preparation patch which is
> > to fix the typo in commom vmlinux.lds.h in asm-generic, thus LD_ORPHAN_WARN
> > will warn loudly. See[1] for more details.
> >
> > Another missing point is we need to keep the .init.pi* and .init.bss*
> > sections. See[1] for more details.
> >
> > Since you are the first person to send out the patch of
> > HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv, do you mind if I update
> > my series and take your patch in my series v2, make you as the commmit
> > author, use your commit msg, and add my co-developped tag etc?
Another option is: I remove patch4 from my series and you send out an
updated version to fix the missing .init.pi* and .init.bss* KEEP.
>
> forget to add Link reference:
>
> [1] Link: https://lore.kernel.org/linux-riscv/20230511141211.2418-1-jszhang@kernel.org/
>
> >
> > Thanks
> >
> > >
> > > | rv32 | rv64
> > > --------|------------------------|---------------------
> > > No DCE | 4460684 | 4893488
> > > DCE | 3986716 | 4376400
> > > Shrink | 473968 (~10.6%) | 517088 (~10.5%)
> > >
> > > The config used above only reserves necessary options to boot on qemu
> > > with serial console, more like the size-critical embedded scenes:
> > >
> > > - rv64 config: https://pastebin.com/crz82T0s
> > > - rv32 config: rv64 config + 32-bit.config
> > >
> > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> > > ---
> > > arch/riscv/Kconfig | 1 +
> > > arch/riscv/kernel/vmlinux.lds.S | 2 +-
> > > 2 files changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > > index 348c0fa1fc8c..d2eb1a862ea8 100644
> > > --- a/arch/riscv/Kconfig
> > > +++ b/arch/riscv/Kconfig
> > > @@ -111,6 +111,7 @@ config RISCV
> > > select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
> > > select HAVE_KRETPROBES if !XIP_KERNEL
> > > select HAVE_RETHOOK if !XIP_KERNEL
> > > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> > > select HAVE_MOVE_PMD
> > > select HAVE_MOVE_PUD
> > > select HAVE_PCI
> > > diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> > > index e5f9f4677bbf..0f5dfbc113d4 100644
> > > --- a/arch/riscv/kernel/vmlinux.lds.S
> > > +++ b/arch/riscv/kernel/vmlinux.lds.S
> > > @@ -112,7 +112,7 @@ SECTIONS
> > > . = ALIGN(8);
> > > .alternative : {
> > > __alt_start = .;
> > > - *(.alternative)
> > > + KEEP(*(.alternative))
> > > __alt_end = .;
> > > }
> > > __init_end = .;
> > > --
> > > 2.25.1
> > >
> > >
> > > _______________________________________________
> > > linux-riscv mailing list
> > > linux-riscv@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-21 8:48 ` Jisheng Zhang
2023-05-21 8:51 ` Jisheng Zhang
@ 2023-05-21 12:41 ` Zhangjin Wu
2023-05-21 13:32 ` Conor Dooley
1 sibling, 1 reply; 16+ messages in thread
From: Zhangjin Wu @ 2023-05-21 12:41 UTC (permalink / raw)
To: jszhang
Cc: conor, falcon, guoren, linux-riscv, npiggin, palmer,
paul.walmsley, paulburton, tim.bird, bmeng
Hi, Jisheng
> On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> > Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> > the user to enable dead code elimination. In order for this to work,
> > ensure that we keep the alternative table by annotating them with KEEP.
> >
> > This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> > it only shrinks their builds by ~1%, a smaller config is thereforce
> > customized to test this feature:
>
> OOPS, I didn't noticed that you have sent out the patch and you are now
> in v3. I may read your patch sevral months ago, but I forget it.
Yeah, I have sent this patch several times, but beside the suggestion from
conor, I have gotten no more responses (before v3), I even thought RISC-V
people are not interested in or not require size shrinking ;-)
As I can see from the mailing list, Guoren just sent out a new series of
patchset [0] about size shrink (-16%), and include the one [1] from you, so,
I'm not alone, the left patchsets I'm working on and upstreaming include dead
syscall elimination [2], vdso configuration [3], nolibc for rv32 [4] and even
the self-decompress vmlinuz support (RFC v1 will be sent out next week), all of
these patchsets are result of my tinylinux [5] porting to RISC-V (got 334k
non-MMU rv64 vmlinuz+nolibc hello).
Is it ok to add you to my future CC list of the coming tinylinux
patchsets for RISC-V? welcome your review suggestions ;-)
From Guoren:
[0]: https://lore.kernel.org/linux-riscv/mhng-24855381-7da8-4c77-bcaf-a3a53c8cb38b@palmer-ri-x1c9/T/
From Jisheng:
[1]: https://lore.kernel.org/linux-riscv/20230511141211.2418-1-jszhang@kernel.org/
From Zhangjin:
[2]: https://lore.kernel.org/linux-riscv/cover.1676594211.git.falcon@tinylab.org/
[3]: https://lore.kernel.org/linux-riscv/cover.1684430522.git.falcon@tinylab.org/T/#t
[4]: https://lore.kernel.org/linux-riscv/cover.1684425792.git.falcon@tinylab.org/T/#t
[5]: http://elinux.org/Work_on_Tiny_Linux_Kernel
> But your version missed an important preparation patch which is
> to fix the typo in commom vmlinux.lds.h in asm-generic, thus LD_ORPHAN_WARN
> will warn loudly. See[1] for more details.
>
ok, it is a great fix, .init.data.* are really critical sections, so, do we
need to select LD_ORPHAN_WARN by default for HAVE_LD_DEAD_CODE_DATA_ELIMINATION
to dig out such potential issues?
> Another missing point is we need to keep the .init.pi* and .init.bss*
> sections. See[1] for more details.
>
sorry, my v3 has forgotten re-checking the new changes of vmlinux.lds.S, just
checked it again, .init.bss* about efi was added from v6.2 and the .init.pi*
was really a new rv kernel feature from v6.3-rc1, just to mention, this may be
an important review part of the future vmlinux.lds.S changes: the sections
required but not explicitly used by any function or data must be KEEP'ed
manually, for more details, my old paper about kernel gc-sections [6] is a good
reference.
[6]: https://lwn.net/images/conf/rtlws-2011/proc/Yong.pdf
Another work I'm trying to do in toolchain side (in progress) is let the kernel
auto keep part of current KEEP'ed sections, this may eliminate more
functions/data and also reduce the maintain cost of manual KEEPing. This idea
derives from the coming RFC v2 of system call elimination patchset, some of the
unused syscalls can not be eliminated automatically because of the "rough"
exception table KEEPing.
> Since you are the first person to send out the patch of
> HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv, do you mind if I update
> my series and take your patch in my series v2, make you as the commmit
> author, use your commit msg, and add my co-developped tag etc?
>
I have found that you have fixed up some other issues, It is better to
merge mine in your series, please don't forget the Tested-by line from
Bin Meng [7] and the Reviewed-by line from Guoren [8].
[7]: https://lore.kernel.org/linux-riscv/20230521040949.1411220-1-bmeng@tinylab.org/#t
[8]: https://lore.kernel.org/linux-riscv/20230521022313.3758709-1-guoren@kernel.org/
Thanks very much,
Zhangjin
> Thanks
>
> >
> > | rv32 | rv64
> > --------|------------------------|---------------------
> > No DCE | 4460684 | 4893488
> > DCE | 3986716 | 4376400
> > Shrink | 473968 (~10.6%) | 517088 (~10.5%)
> >
> > The config used above only reserves necessary options to boot on qemu
> > with serial console, more like the size-critical embedded scenes:
> >
> > - rv64 config: https://pastebin.com/crz82T0s
> > - rv32 config: rv64 config + 32-bit.config
> >
> > Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> > ---
> > arch/riscv/Kconfig | 1 +
> > arch/riscv/kernel/vmlinux.lds.S | 2 +-
> > 2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 348c0fa1fc8c..d2eb1a862ea8 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -111,6 +111,7 @@ config RISCV
> > select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
> > select HAVE_KRETPROBES if !XIP_KERNEL
> > select HAVE_RETHOOK if !XIP_KERNEL
> > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> > select HAVE_MOVE_PMD
> > select HAVE_MOVE_PUD
> > select HAVE_PCI
> > diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> > index e5f9f4677bbf..0f5dfbc113d4 100644
> > --- a/arch/riscv/kernel/vmlinux.lds.S
> > +++ b/arch/riscv/kernel/vmlinux.lds.S
> > @@ -112,7 +112,7 @@ SECTIONS
> > . = ALIGN(8);
> > .alternative : {
> > __alt_start = .;
> > - *(.alternative)
> > + KEEP(*(.alternative))
> > __alt_end = .;
> > }
> > __init_end = .;
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-21 12:41 ` Zhangjin Wu
@ 2023-05-21 13:32 ` Conor Dooley
2023-05-21 14:56 ` Zhangjin Wu
0 siblings, 1 reply; 16+ messages in thread
From: Conor Dooley @ 2023-05-21 13:32 UTC (permalink / raw)
To: Zhangjin Wu
Cc: jszhang, guoren, linux-riscv, npiggin, palmer, paul.walmsley,
paulburton, tim.bird, bmeng
[-- Attachment #1.1: Type: text/plain, Size: 2748 bytes --]
Hey!
On Sun, May 21, 2023 at 08:41:34PM +0800, Zhangjin Wu wrote:
> > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> > > Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> > > the user to enable dead code elimination. In order for this to work,
> > > ensure that we keep the alternative table by annotating them with KEEP.
> > >
> > > This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> > > it only shrinks their builds by ~1%, a smaller config is thereforce
> > > customized to test this feature:
> >
> > OOPS, I didn't noticed that you have sent out the patch and you are now
> > in v3. I may read your patch sevral months ago, but I forget it.
>
> Yeah, I have sent this patch several times, but beside the suggestion from
> conor,
Half the time my comments are just me forwarding on stuff from
automation complaining. Otherwise I do my best to look at things that
are being ignored.
> I have gotten no more responses (before v3), I even thought RISC-V
> people are not interested in or not require size shrinking ;-)
IIRC, you sent a standalone patch, which might've been picked up had you
not followed it up with a series marked RFC containing the same patch.
The v2 which was sent on 14/2 was marked superseded after the RFC series
on 17/2. And I guess since the RFC generated no comments, but clearly
couldn't be merged, it was ignored?
To be honest, I am not quite sure why you are sending some of these
things as RFC. The VDSO thing looks like something that should be
considered/reviewed properly etc, rather than "hey I have this idea,
does anyone have suggestions".
> As I can see from the mailing list, Guoren just sent out a new series of
> patchset [0] about size shrink (-16%), and include the one [1] from you, so,
> I'm not alone, the left patchsets I'm working on and upstreaming include dead
> syscall elimination [2], vdso configuration [3], nolibc for rv32 [4] and even
> the self-decompress vmlinuz support (RFC v1 will be sent out next week), all of
> these patchsets are result of my tinylinux [5] porting to RISC-V (got 334k
> non-MMU rv64 vmlinuz+nolibc hello).
Ordinarily I would suggest that you contact these people and ask them to
review your work, so that there is less for Palmer to do when he is
going through the list on patchwork for stuff to merge - but it looks
like you are already doing that, which is great :)
> I have found that you have fixed up some other issues, It is better to
> merge mine in your series, please don't forget the Tested-by line from
> Bin Meng [7] and the Reviewed-by line from Guoren [8].
I'll mark this patch as superseded then, yeah?
Thanks,
Conor.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-21 13:32 ` Conor Dooley
@ 2023-05-21 14:56 ` Zhangjin Wu
2023-05-21 15:06 ` Conor Dooley
0 siblings, 1 reply; 16+ messages in thread
From: Zhangjin Wu @ 2023-05-21 14:56 UTC (permalink / raw)
To: conor
Cc: bmeng, falcon, guoren, jszhang, linux-riscv, npiggin, palmer,
paul.walmsley, paulburton, tim.bird
Hi, Conor.
> Hi,
>
> On Sun, May 21, 2023 at 08:41:34PM +0800, Zhangjin Wu wrote:
> > > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> > > > Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> > > > the user to enable dead code elimination. In order for this to work,
> > > > ensure that we keep the alternative table by annotating them with KEEP.
> > > >
> > > > This boots well on qemu with both rv32_defconfig & rv64 defconfig, but
> > > > it only shrinks their builds by ~1%, a smaller config is thereforce
> > > > customized to test this feature:
> > >
> > > OOPS, I didn't noticed that you have sent out the patch and you are now
> > > in v3. I may read your patch sevral months ago, but I forget it.
> >
> > Yeah, I have sent this patch several times, but beside the suggestion from
> > conor,
>
> Half the time my comments are just me forwarding on stuff from
> automation complaining. Otherwise I do my best to look at things that
> are being ignored.
>
> > I have gotten no more responses (before v3), I even thought RISC-V
> > people are not interested in or not require size shrinking ;-)
>
> IIRC, you sent a standalone patch, which might've been picked up had you
> not followed it up with a series marked RFC containing the same patch.
> The v2 which was sent on 14/2 was marked superseded after the RFC series
> on 17/2. And I guess since the RFC generated no comments, but clearly
> couldn't be merged, it was ignored?
>
Yeah, v2 has no feedback (I have put it in the dead syscall elimination
series who depends on it), so, I rebased it on latest v6.4-rc2
and send a v3 ;-)
Btw, where can I check the patch status? 10 years ago, when I worked on
MIPS architecture, I used patchwork to track the status, not sure, which
web site we are currently using, lore.kernel.org or still
patchwork.kernel.org? I use lore to read and send patches now.
> To be honest, I am not quite sure why you are sending some of these
> things as RFC. The VDSO thing looks like something that should be
> considered/reviewed properly etc, rather than "hey I have this idea,
> does anyone have suggestions".
>
"RFC" added in my recent patchset is really want to get some feedbacks,
especially, to learn if it is valuable to continue. As you know, the
VDSO is required by most of the system, so, touch it should be
carefully, and dead syscall elimination is another "big" change.
Thanks for your kindly suggestion, I will remove "RFC" if it is not that
necessary.
> > As I can see from the mailing list, Guoren just sent out a new series of
> > patchset [0] about size shrink (-16%), and include the one [1] from you, so,
> > I'm not alone, the left patchsets I'm working on and upstreaming include dead
> > syscall elimination [2], vdso configuration [3], nolibc for rv32 [4] and even
> > the self-decompress vmlinuz support (RFC v1 will be sent out next week), all of
> > these patchsets are result of my tinylinux [5] porting to RISC-V (got 334k
> > non-MMU rv64 vmlinuz+nolibc hello).
>
> Ordinarily I would suggest that you contact these people and ask them to
> review your work, so that there is less for Palmer to do when he is
> going through the list on patchwork for stuff to merge - but it looks
> like you are already doing that, which is great :)
>
Yeah, In the past 2 or 3 months, I'm focusing on implementing the other
tinylinux patchsets for RISC-V, and have no enough time to ping
reviewers ;-)
> > I have found that you have fixed up some other issues, It is better to
> > merge mine in your series, please don't forget the Tested-by line from
> > Bin Meng [7] and the Reviewed-by line from Guoren [8].
>
> I'll mark this patch as superseded then, yeah?
>
Yes, of course.
Thanks,
Zhangjin
> Thanks,
> Conor.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-21 14:56 ` Zhangjin Wu
@ 2023-05-21 15:06 ` Conor Dooley
0 siblings, 0 replies; 16+ messages in thread
From: Conor Dooley @ 2023-05-21 15:06 UTC (permalink / raw)
To: Zhangjin Wu
Cc: bmeng, guoren, jszhang, linux-riscv, npiggin, palmer,
paul.walmsley, paulburton, tim.bird
[-- Attachment #1.1: Type: text/plain, Size: 1416 bytes --]
On Sun, May 21, 2023 at 10:56:03PM +0800, Zhangjin Wu wrote:
> > On Sun, May 21, 2023 at 08:41:34PM +0800, Zhangjin Wu wrote:
> > > > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> Btw, where can I check the patch status? 10 years ago, when I worked on
> MIPS architecture, I used patchwork to track the status, not sure, which
> web site we are currently using, lore.kernel.org or still
> patchwork.kernel.org? I use lore to read and send patches now.
Yup, still patchwork for status tracking.
https://patchwork.kernel.org/project/linux-riscv/list/
>
> > To be honest, I am not quite sure why you are sending some of these
> > things as RFC. The VDSO thing looks like something that should be
> > considered/reviewed properly etc, rather than "hey I have this idea,
> > does anyone have suggestions".
> >
>
> "RFC" added in my recent patchset is really want to get some feedbacks,
> especially, to learn if it is valuable to continue. As you know, the
> VDSO is required by most of the system, so, touch it should be
> carefully, and dead syscall elimination is another "big" change.
>
> Thanks for your kindly suggestion, I will remove "RFC" if it is not that
> necessary.
Yea, I understand why you're doing it, but if you do & noone replies
there's a good chance that it'll just get skipped for non-RFC patches
when Palmer is merging stuff.
Cheers,
Conor.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-05-17 8:29 [PATCH v3] RISC-V: Enable dead code elimination Zhangjin Wu
` (3 preceding siblings ...)
2023-05-21 8:48 ` Jisheng Zhang
@ 2023-06-20 20:13 ` Nick Desaulniers
2023-06-20 20:17 ` Palmer Dabbelt
4 siblings, 1 reply; 16+ messages in thread
From: Nick Desaulniers @ 2023-06-20 20:13 UTC (permalink / raw)
To: Zhangjin Wu
Cc: palmer, conor, guoren, linux-riscv, npiggin, paul.walmsley,
paulburton, vincent.chen, tim.bird, llvm
On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> the user to enable dead code elimination. In order for this to work,
> ensure that we keep the alternative table by annotating them with KEEP.
>
Just cross referencing the report from Palmer against v2; I see orphan
section warnings from the linker related to the EFI stub when building
allmodconfig with this patch applied.
v2: thread for reference.
https://lore.kernel.org/linux-riscv/CAKwvOdmsgMN5oQpDLh12D0X-CfQDtHC-EtxHcBnADkhnyitMKQ@mail.gmail.com/
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-06-20 20:13 ` Nick Desaulniers
@ 2023-06-20 20:17 ` Palmer Dabbelt
2023-06-20 20:22 ` Conor Dooley
2023-06-20 20:26 ` Nick Desaulniers
0 siblings, 2 replies; 16+ messages in thread
From: Palmer Dabbelt @ 2023-06-20 20:17 UTC (permalink / raw)
To: ndesaulniers
Cc: falcon, Conor Dooley, guoren, linux-riscv, npiggin, Paul Walmsley,
paulburton, vincent.chen, tim.bird, llvm
On Tue, 20 Jun 2023 13:13:06 PDT (-0700), ndesaulniers@google.com wrote:
> On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
>> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
>> the user to enable dead code elimination. In order for this to work,
>> ensure that we keep the alternative table by annotating them with KEEP.
>>
>
> Just cross referencing the report from Palmer against v2; I see orphan
> section warnings from the linker related to the EFI stub when building
> allmodconfig with this patch applied.
>
> v2: thread for reference.
> https://lore.kernel.org/linux-riscv/CAKwvOdmsgMN5oQpDLh12D0X-CfQDtHC-EtxHcBnADkhnyitMKQ@mail.gmail.com/
Sorry for replying to the v2, I'm marking that as superseeded in
patchwork. IIUC it is a real issue on your end too? I'm also not 100%
sure about the hang, I just let LLD cook for about 10 minutes before I
noticed it was still running and posted.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-06-20 20:17 ` Palmer Dabbelt
@ 2023-06-20 20:22 ` Conor Dooley
2023-06-20 20:26 ` Nick Desaulniers
1 sibling, 0 replies; 16+ messages in thread
From: Conor Dooley @ 2023-06-20 20:22 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: ndesaulniers, falcon, guoren, linux-riscv, npiggin, Paul Walmsley,
paulburton, vincent.chen, tim.bird, llvm
[-- Attachment #1.1: Type: text/plain, Size: 1314 bytes --]
On Tue, Jun 20, 2023 at 01:17:26PM -0700, Palmer Dabbelt wrote:
> On Tue, 20 Jun 2023 13:13:06 PDT (-0700), ndesaulniers@google.com wrote:
> > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> > > Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> > > the user to enable dead code elimination. In order for this to work,
> > > ensure that we keep the alternative table by annotating them with KEEP.
> > >
> >
> > Just cross referencing the report from Palmer against v2; I see orphan
> > section warnings from the linker related to the EFI stub when building
> > allmodconfig with this patch applied.
> >
> > v2: thread for reference.
> > https://lore.kernel.org/linux-riscv/CAKwvOdmsgMN5oQpDLh12D0X-CfQDtHC-EtxHcBnADkhnyitMKQ@mail.gmail.com/
>
> Sorry for replying to the v2, I'm marking that as superseeded in patchwork.
> IIUC it is a real issue on your end too? I'm also not 100% sure about the
> hang, I just let LLD cook for about 10 minutes before I noticed it was still
> running and posted.
Repeating myself for the sake of the archives or w/e, two different
submitters with differing version numbers. The v2 from Jisheng is more
recent than the v3 here from Zhangjin, they agreed in this mail thread
to merge their work.
Cheers,
Conor.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-06-20 20:17 ` Palmer Dabbelt
2023-06-20 20:22 ` Conor Dooley
@ 2023-06-20 20:26 ` Nick Desaulniers
2023-06-20 20:41 ` Palmer Dabbelt
1 sibling, 1 reply; 16+ messages in thread
From: Nick Desaulniers @ 2023-06-20 20:26 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: falcon, Conor Dooley, guoren, linux-riscv, npiggin, Paul Walmsley,
paulburton, vincent.chen, tim.bird, llvm
On Tue, Jun 20, 2023 at 4:17 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> On Tue, 20 Jun 2023 13:13:06 PDT (-0700), ndesaulniers@google.com wrote:
> > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
> >> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
> >> the user to enable dead code elimination. In order for this to work,
> >> ensure that we keep the alternative table by annotating them with KEEP.
> >>
> >
> > Just cross referencing the report from Palmer against v2; I see orphan
> > section warnings from the linker related to the EFI stub when building
> > allmodconfig with this patch applied.
> >
> > v2: thread for reference.
> > https://lore.kernel.org/linux-riscv/CAKwvOdmsgMN5oQpDLh12D0X-CfQDtHC-EtxHcBnADkhnyitMKQ@mail.gmail.com/
>
> Sorry for replying to the v2, I'm marking that as superseeded in
> patchwork. IIUC it is a real issue on your end too? I'm also not 100%
> sure about the hang, I just let LLD cook for about 10 minutes before I
> noticed it was still running and posted.
Yes; if this is merged, our CI builds of ARCH=riscv allmodconfig will go red.
I assume a linker script somewhere needs to be updated, but I haven't
found if/where the efi stub's is.
drivers/firmware/efi/libstub/zboot.lds perhaps?
On Tue, Jun 20, 2023 at 4:22 PM Conor Dooley <conor@kernel.org> wrote:
>
> Repeating myself for the sake of the archives or w/e, two different
> submitters with differing version numbers. The v2 from Jisheng is more
> recent than the v3 here from Zhangjin, they agreed in this mail thread
> to merge their work.
--
Thanks,
~Nick Desaulniers
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3] RISC-V: Enable dead code elimination
2023-06-20 20:26 ` Nick Desaulniers
@ 2023-06-20 20:41 ` Palmer Dabbelt
0 siblings, 0 replies; 16+ messages in thread
From: Palmer Dabbelt @ 2023-06-20 20:41 UTC (permalink / raw)
To: ndesaulniers
Cc: falcon, Conor Dooley, guoren, linux-riscv, npiggin, Paul Walmsley,
paulburton, vincent.chen, tim.bird, llvm
On Tue, 20 Jun 2023 13:26:53 PDT (-0700), ndesaulniers@google.com wrote:
> On Tue, Jun 20, 2023 at 4:17 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>>
>> On Tue, 20 Jun 2023 13:13:06 PDT (-0700), ndesaulniers@google.com wrote:
>> > On Wed, May 17, 2023 at 04:29:36PM +0800, Zhangjin Wu wrote:
>> >> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for RISC-V, allowing
>> >> the user to enable dead code elimination. In order for this to work,
>> >> ensure that we keep the alternative table by annotating them with KEEP.
>> >>
>> >
>> > Just cross referencing the report from Palmer against v2; I see orphan
>> > section warnings from the linker related to the EFI stub when building
>> > allmodconfig with this patch applied.
>> >
>> > v2: thread for reference.
>> > https://lore.kernel.org/linux-riscv/CAKwvOdmsgMN5oQpDLh12D0X-CfQDtHC-EtxHcBnADkhnyitMKQ@mail.gmail.com/
>>
>> Sorry for replying to the v2, I'm marking that as superseeded in
>> patchwork. IIUC it is a real issue on your end too? I'm also not 100%
>> sure about the hang, I just let LLD cook for about 10 minutes before I
>> noticed it was still running and posted.
>
> Yes; if this is merged, our CI builds of ARCH=riscv allmodconfig will go red.
>
> I assume a linker script somewhere needs to be updated, but I haven't
> found if/where the efi stub's is.
>
> drivers/firmware/efi/libstub/zboot.lds perhaps?
>
> On Tue, Jun 20, 2023 at 4:22 PM Conor Dooley <conor@kernel.org> wrote:
>>
>> Repeating myself for the sake of the archives or w/e, two different
>> submitters with differing version numbers. The v2 from Jisheng is more
>> recent than the v3 here from Zhangjin, they agreed in this mail thread
>> to merge their work.
Thanks, so we're going to jump over there.
>
> --
> Thanks,
> ~Nick Desaulniers
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-06-20 20:41 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17 8:29 [PATCH v3] RISC-V: Enable dead code elimination Zhangjin Wu
2023-05-17 8:41 ` Zhangjin Wu
2023-05-21 2:23 ` guoren
2023-05-21 4:09 ` Bin Meng
2023-05-21 8:48 ` Jisheng Zhang
2023-05-21 8:51 ` Jisheng Zhang
2023-05-21 9:08 ` Jisheng Zhang
2023-05-21 12:41 ` Zhangjin Wu
2023-05-21 13:32 ` Conor Dooley
2023-05-21 14:56 ` Zhangjin Wu
2023-05-21 15:06 ` Conor Dooley
2023-06-20 20:13 ` Nick Desaulniers
2023-06-20 20:17 ` Palmer Dabbelt
2023-06-20 20:22 ` Conor Dooley
2023-06-20 20:26 ` Nick Desaulniers
2023-06-20 20:41 ` Palmer Dabbelt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox