Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1199738rwd; Thu, 15 Jun 2023 07:34:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78tnOB8ATutyBGfUa9WJQT/w7HFXaR5P62sgKMp7af0uprg3l3x8xcgGOsnYp6FoMHBOzS X-Received: by 2002:aa7:d796:0:b0:515:3103:631e with SMTP id s22-20020aa7d796000000b005153103631emr13405545edq.25.1686839677125; Thu, 15 Jun 2023 07:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686839677; cv=none; d=google.com; s=arc-20160816; b=e14lF+pUVZn3xWzPKMzcsZrmid8yv7s33+vGe7sybJBQNCzUXqucug7CwD9b3MIst1 PgfFQ9BeK9XbOBiNppvp5R2HrZGjYOoEcVPYRkrPcbPETGcw+TCJ3bZAbDUKKuyy6QCe QFO8Ab38gqf2EWv6Vf46nLaka0slPfGTkr581Euf39ugFQsYeM9cKCav7Kk0mc7FZAV+ n8nRDI042boOwfafDLTFbnJ6ckQ0J9Fff1LusGGpZbwkyD9up803acP3tCmeNLU7DOEt VJ1N9PZ+REC1sQCw3vNupCqvGxgN6MIpxAH3q7nTRgaz/ak1MQkFBt5f2kzHnwfuIkZv kvYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=8aL6s+S70COXWhSW1xa78Cs58KFjDmq4WzqQOCdiOiQ=; b=qSwdeB2+u5I1Tm/3bpAuJT1f4NblRWK7p72K5do/yvIiFNz546c/JASAu/5lYO01uX N1QZ+m3SQacE5DXjxwqjFkHkDCut1Evxj/kROo1I2PpribCZR0gLjDVlBK31KPaTRmbY bjMoPkPYnC5NX3r0cmQZ23Ue/2BLyBYJd/GYaW7cPfGbDQeyj+i8gKogo2fHnFsePLQ4 c9a+BmiPve1j8tBZvozdqgOXphJYTk58sjZ/RjIl64YvogFv5by0ZLm1g/EvGyFfTLgt 57O8t8aLx1a1RlZLcjHoFp9x2c2S2TWCDeNTQ+DKOOzxo1Fp1Db5GJr4ahYTBbACnrFP FE2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b="gO90/AdN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020aa7c442000000b0051a2cc8c485si589406edr.295.2023.06.15.07.34.12; Thu, 15 Jun 2023 07:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b="gO90/AdN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbjFONyi (ORCPT + 99 others); Thu, 15 Jun 2023 09:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238051AbjFONyg (ORCPT ); Thu, 15 Jun 2023 09:54:36 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70CF81BDB for ; Thu, 15 Jun 2023 06:54:35 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6b2f0a140b7so3724267a34.3 for ; Thu, 15 Jun 2023 06:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20221208.gappssmtp.com; s=20221208; t=1686837274; x=1689429274; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=8aL6s+S70COXWhSW1xa78Cs58KFjDmq4WzqQOCdiOiQ=; b=gO90/AdNIolSs15osNgKPkFkIycjW7AtQYUlLN1kYKDXG53CQt5/HpTfPL0SNKfV+q SBWNbTDKbv/9XgznIq3QER7UkD+YWke3zclHBDwZ2nHPc4ylAj5ge1f1IcR3+d2kahjh FjwxFrj3VTydDLQ8yv1GwQc4oPAYYSqq6rAimwqpm4MWQF1ys3owYsjib5W9t3oPlflv CDxfBNyUSej0G/0GHx04kNAQv57eAAF0dPazGO3Io2PRLrW6FNWGhJg1fsAUgp5GjzPp UgoQUCxffIfRWnbiqH/Yl9jZh0limMMAjS//SbPA5K1ihbmZnzRuFEVkb1B+JtDuEwVQ cs3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686837274; x=1689429274; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8aL6s+S70COXWhSW1xa78Cs58KFjDmq4WzqQOCdiOiQ=; b=S4yRz7p+gCSri5SNleksO5gsTakWbqnBD/fKzOLvmS6j7STh43wWAaOF+JVHz30dWE 3lf9/DVart/JFO6BD4IwrspQyrO7D+pnYrWbx7IymfgsARY3SExONoe2Fn7qcsADRSLg eaJ0dK0Y+hzrnlhrgT5n9ND77WqxOwScjuUgUqJzUWjAPBjBrZ//u5iCeVwldSyBw+FG 5PQ0kOkEwupV34CvVjO0piYVQMIrXW9dNHrjsbSD70AX4RoP820iH0unZ+TOj78LqDbY sQ1zCer58GgG0vChznaxqTXfiVsBbCGgerKiPfiGS2PZ81ccSyZDqkn097ejXsZaGJ1g sb0Q== X-Gm-Message-State: AC+VfDxplh5nJx/Y2um8jzMFdwkiMziS3Z/VGZYdaJmIxCw0eObMqmwy wt6ZP2JFfRHLzJvDmdOWfamqYQ== X-Received: by 2002:a05:6358:cb2f:b0:129:c6d6:ce40 with SMTP id gr47-20020a056358cb2f00b00129c6d6ce40mr12848161rwb.15.1686837274461; Thu, 15 Jun 2023 06:54:34 -0700 (PDT) Received: from localhost ([135.180.227.0]) by smtp.gmail.com with ESMTPSA id g25-20020a633759000000b0051afa49e07asm12980492pgn.50.2023.06.15.06.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 06:54:33 -0700 (PDT) Date: Thu, 15 Jun 2023 06:54:33 -0700 (PDT) X-Google-Original-Date: Wed, 14 Jun 2023 09:58:00 PDT (-0700) Subject: Re: [PATCH v2 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION In-Reply-To: CC: Paul Walmsley , aou@eecs.berkeley.edu, Arnd Bergmann , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org From: Palmer Dabbelt To: jszhang@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Jun 2023 09:25:49 PDT (-0700), jszhang@kernel.org wrote: > > On Wed, Jun 14, 2023 at 07:49:17AM -0700, Palmer Dabbelt wrote: >> On Tue, 23 May 2023 09:54:58 PDT (-0700), jszhang@kernel.org wrote: >> > When trying to run linux with various opensource riscv core on >> > resource limited FPGA platforms, for example, those FPGAs with less >> > than 16MB SDRAM, I want to save mem as much as possible. One of the >> > major technologies is kernel size optimizations, I found that riscv >> > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which >> > passes -fdata-sections, -ffunction-sections to CFLAGS and passes the >> > --gc-sections flag to the linker. >> > >> > This not only benefits my case on FPGA but also benefits defconfigs. >> > Here are some notable improvements from enabling this with defconfigs: >> > >> > nommu_k210_defconfig: >> > text data bss dec hex >> > 1112009 410288 59837 1582134 182436 before >> > 962838 376656 51285 1390779 1538bb after >> > >> > rv32_defconfig: >> > text data bss dec hex >> > 8804455 2816544 290577 11911576 b5c198 before >> > 8692295 2779872 288977 11761144 b375f8 after >> > >> > defconfig: >> > text data bss dec hex >> > 9438267 3391332 485333 13314932 cb2b74 before >> > 9285914 3350052 483349 13119315 c82f53 after >> > >> > patch1 and patch2 are clean ups. >> > patch3 fixes a typo. >> > patch4 finally enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv. >> > >> > NOTE: Zhangjin Wu firstly sent out a patch to enable dead code >> > elimination for riscv several months ago, I didn't notice it until >> > yesterday. Although it missed some preparations and some sections's >> > keeping, he is the first person to enable this feature for riscv. To >> > ease merging, this series take his patch into my entire series and >> > makes patch4 authored by him after getting his ack to reflect >> > the above fact. >> > >> > Since v1: >> > - collect Reviewed-by, Tested-by tag >> > - Make patch4 authored by Zhangjin Wu, add my co-developed-by tag >> > >> > Jisheng Zhang (3): >> > riscv: move options to keep entries sorted >> > riscv: vmlinux-xip.lds.S: remove .alternative section >> > vmlinux.lds.h: use correct .init.data.* section name >> > >> > Zhangjin Wu (1): >> > riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION >> > >> > arch/riscv/Kconfig | 13 +- >> > arch/riscv/kernel/vmlinux-xip.lds.S | 6 - >> > arch/riscv/kernel/vmlinux.lds.S | 6 +- >> > include/asm-generic/vmlinux.lds.h | 2 +- >> > 4 files changed, 11 insertions(+), 16 deletions(-) >> >> Do you have a base commit for this? It's not applying to 6.4-rc1 and the >> patchwork bot couldn't find one either. > > Hi Palmer, > > Commit 3b90b09af5be ("riscv: Fix orphan section warnings caused by > kernel/pi") touches vmlinux.lds.S, so to make the merge easy, this > series is based on 6.4-rc2. Thanks. > > Thanks