From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B258AC7EE23 for ; Sun, 21 May 2023 09:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JjB35Wn06VHYcSWTZFksDnMJ/s1GAJUckWAhT07j++k=; b=Uh1g0V+1Hax+oL bTXktaaXMrRl66RQejCB+/5VWSof9HIP3uw/92lwGKwgrObR7kFAo8f7kbWDGWuESVroxztbm8agr fC2NrpI8RHAyk/I49LWFp+HLPqr7Nnp1byLZxcKFE1E3+rIS+XP0U7bSzC9mVDc9LgZlNqC04DxCu /lb6eZa1vTsLfD15ocGqujEs5UdOWDBW8/wQLS7ViQhs0lDwHDN77QEP7+rln1KjKOv9VxzwV/Q6C jG1tJKBJs1Qsi22fgSeE/8MsO5Q7o2cfLf2/mwZ9lidhVsruHQFswma1UqMCXF3OpZ4jo+io5eum1 NQqEtO73+XoZcTmw1Nrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q0exQ-003Sx4-2C; Sun, 21 May 2023 09:02:28 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q0exN-003SwN-1H for linux-riscv@lists.infradead.org; Sun, 21 May 2023 09:02:27 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78DE660ABF; Sun, 21 May 2023 09:02:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E706AC433D2; Sun, 21 May 2023 09:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684659740; bh=0wVmcFT1RxYQYuJVaHasMN3QWpPYSvs11kpfb8n7vpA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AphrmWzijdOEQ5osnWGlzGsTkLkEdG9+uV37xlS4qz0npXDLkpySGH7xr8dqF3iEC N6daKKBA20XOln+k/K4SZvc3PS/umzchin0QgvZ3/DOkIoIyvVpKwWcRdClVD7QVOe f/4VltQQUZ3fNvHWAMRM8rngX390bRiSs2QnD83XA5POQnte6N/egv/pu7RkQkMmTd ZEGtWTskT3yON8eIhyvTo+t1A8V5YBZOYn67MnXl/W/+bFsBDqf288p6m4t6KpJVwJ DZM1n4HBHD1xma2zN3bdvZwZu024eG/4THdYogdpibc3t84/hfUpmZhyy4YENamAdR Jg1+Bpx2qmKCA== Date: Sun, 21 May 2023 16:51:10 +0800 From: Jisheng Zhang To: Zhangjin Wu Cc: palmer@rivosinc.com, conor@kernel.org, guoren@kernel.org, linux-riscv@lists.infradead.org, npiggin@gmail.com, paul.walmsley@sifive.com, paulburton@kernel.org, vincent.chen@sifive.com, tim.bird@sony.com Subject: Re: [PATCH v3] RISC-V: Enable dead code elimination Message-ID: References: <20230517082936.37563-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230521_020225_514630_EA529806 X-CRM114-Status: GOOD ( 31.99 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 > > --- > > 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