Skip to contentSkip to conversation

RISC-V: Enable dead code elimination

PATCH In review Zhangjin Wu 7 participants 16 messages May 17, 2023 – Jun 20, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 RISC-V: Enable dead code elimination

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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +1 -1
index e5f9f4677bbf..0f5dfbc113d4 100644
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;
Signature · 7 lines
2.25.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

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

Quoted 43 lines

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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +0 -0
index e5f9f4677bbf..0f5dfbc113d4 100644

arch/riscv/kernel/vmlinux.lds.S SECTIONS · line 118

Quoted 8 lines
arch/riscv/kernel/vmlinux.lds.S +1 -1
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Reviewed-by on v3 1/1
#2 lore raw
In reply to Zhangjin Wu
Quoted 9 lines

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:

Quoted 5 lines
          | 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")

Quoted 41 lines

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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +1 -1
index e5f9f4677bbf..0f5dfbc113d4 100644
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;
Signature · 1 line
2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Tested-by on v3 1/1
#3 lore raw
In reply to Zhangjin Wu
Quoted 17 lines

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:

Quoted 8 lines

- rv64 config: https://pastebin.com/crz82T0s
- rv32 config: rv64 config + 32-bit.config

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#4 lore raw
In reply to Zhangjin Wu
Quoted 7 lines · 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:

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

Quoted 52 lines
          | 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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +1 -1
index e5f9f4677bbf..0f5dfbc113d4 100644
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;
Signature · 7 lines
2.25.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#5 lore raw
Quoted 15 lines · Jisheng Zhang
Quoted 7 lines · 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:

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.

Quoted 7 lines

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/[email protected]/

Quoted 51 lines

Thanks

Quoted 48 lines
          | 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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +1 -1
index e5f9f4677bbf..0f5dfbc113d4 100644
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;
Signature · 1 line
2.25.1
Quoted 4 lines
Quoted 4 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#6 lore raw
Quoted 16 lines · Jisheng Zhang
Quoted 15 lines · Jisheng Zhang
Quoted 7 lines · 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:

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.

Quoted 7 lines
Quoted 7 lines

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.

Quoted 56 lines

forget to add Link reference:

[1] Link: https://lore.kernel.org/linux-riscv/[email protected]/

Quoted 51 lines

Thanks

Quoted 48 lines
          | 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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +1 -1
index e5f9f4677bbf..0f5dfbc113d4 100644
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;
Signature · 1 line
2.25.1
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#7 lore raw
In reply to Jisheng Zhang

Hi, Jisheng

Quoted 11 lines · Zhangjin Wu
Quoted 7 lines

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/[email protected]/

From Zhangjin:
[2]: https://lore.kernel.org/linux-riscv/[email protected]/
[3]: https://lore.kernel.org/linux-riscv/[email protected]/T/#t
[4]: https://lore.kernel.org/linux-riscv/[email protected]/T/#t
[5]: http://elinux.org/Work_on_Tiny_Linux_Kernel

Quoted 4 lines

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?

Quoted 3 lines

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.

Quoted 5 lines

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/[email protected]/#t
[8]: https://lore.kernel.org/linux-riscv/[email protected]/

Thanks very much,
Zhangjin

Quoted 38 lines

Thanks

Quoted 36 lines
          | 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

---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index 348c0fa1fc8c..d2eb1a862ea8 100644
@@ -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
arch/riscv/kernel/vmlinux.lds.S +0 -0
index e5f9f4677bbf..0f5dfbc113d4 100644
@@ -112,7 +112,7 @@ SECTIONS
Quoted 8 lines

arch/riscv/kernel/vmlinux.lds.S SECTIONS · line 118

Quoted 8 lines
arch/riscv/kernel/vmlinux.lds.S +1 -1
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#8 lore raw

Hey!

Quoted 9 lines · Zhangjin Wu
Quoted 9 lines · Zhangjin Wu
Quoted 7 lines

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:

Quoted 5 lines
Quoted 2 lines

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.

Quoted 2 lines

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

Quoted 7 lines

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

Quoted 3 lines

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.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#9 lore raw

Hi, Conor.

Quoted 22 lines

Hi,

Quoted 9 lines · Zhangjin Wu
Quoted 9 lines · Zhangjin Wu
Quoted 7 lines

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:

Quoted 5 lines
Quoted 2 lines

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.

Quoted 9 lines
Quoted 2 lines

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.

Quoted 5 lines

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.

Quoted 8 lines
Quoted 7 lines

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

Quoted 5 lines

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

Quoted 6 lines
Quoted 3 lines

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

Quoted 2 lines

Thanks,
Conor.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#10 lore raw
Quoted 7 lines · Zhangjin Wu
Quoted 2 lines · Zhangjin Wu
Quoted 1 line
Quoted 1 line · Zhangjin Wu

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/

Quoted 7 lines
Quoted 6 lines

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

Quoted 7 lines

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

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#11 lore raw
In reply to Zhangjin Wu
Quoted 4 lines · 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.

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/

#12 lore raw
Quoted 6 lines · On Tue, 20 Jun 2023 13:13:06 PDT (-0700), [email protected] wrote:
Quoted 4 lines · 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.

Quoted 6 lines

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.

#13 lore raw
Quoted 11 lines · Palmer Dabbelt
Quoted 10 lines · On Tue, 20 Jun 2023 13:13:06 PDT (-0700), [email protected] wrote:
Quoted 4 lines · 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.

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.

Quoted 7 lines
Quoted 2 lines

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.

#14 lore raw
In reply to Palmer Dabbelt
Quoted 12 lines · Palmer Dabbelt
Quoted 10 lines · On Tue, 20 Jun 2023 13:13:06 PDT (-0700), [email protected] wrote:
Quoted 4 lines · 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.

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.

Quoted 7 lines
Quoted 2 lines

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?

Quoted 5 lines · Conor Dooley

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.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#15 lore raw
Quoted 21 lines · On Tue, 20 Jun 2023 13:26:53 PDT (-0700), [email protected] wrote:
Quoted 12 lines · Palmer Dabbelt
Quoted 10 lines · On Tue, 20 Jun 2023 13:13:06 PDT (-0700), [email protected] wrote:
Quoted 4 lines · 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.

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.

Quoted 7 lines
Quoted 2 lines

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.

Quoted 13 lines

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?

Quoted 5 lines · Conor Dooley

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.

Quoted 4 lines
Signature · 3 lines
-- 
Thanks,
~Nick Desaulniers