Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6984813rwd; Mon, 19 Jun 2023 16:12:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54NwqApKDJRcJgNxBrQRtHPQ48HCgXzpmMU9xo6AFahZnQU0SmUwY8KCzeCD4ZxJG4BGEZ X-Received: by 2002:a05:6808:d52:b0:39e:acaa:aea8 with SMTP id w18-20020a0568080d5200b0039eacaaaea8mr11974646oik.54.1687216338076; Mon, 19 Jun 2023 16:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687216338; cv=none; d=google.com; s=arc-20160816; b=i5zmT2KBiT+pol4pV+hv9EiRlGxBtdv/LPFRQcHpP0dX3YpZOsUAUAPMpO1B5FR3QZ GSQEIGc/MFHoTYRjrXOQflLVwMPUnSdXA7CiXPg0xR/UL5KxkTQaYDkDwb4n7q3lK9x5 mt2u+a/VRdt0xk08/AsOGN+PZ338t1gBYgfw5yiQGZo7hgGSWoyscRAgYfUQjUwUH4c7 i4of9CnPpELab7K/xK9WrqXKc6qjzoO+ur/xYTHsEmcmWfhaqt/dJcdY9e7TtInEXqX8 rQkBBpHkJONoPLa9jmm4lRIXzrAH35e8Gnk6bEu0oKNQtYIFGA23qD3B4xXRWfQDiN1X 8a1Q== 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=epHaUjkubRomEjpu/oKPC+kOjwKS/BUbVDRooU3Z4so=; b=Uvx+0z8My3tG2HH7Qzpg25KyEygAVXS4G7A+ITzMUYT8KRjSixtr62oTxJ/uLlGGlo v1DSnchmXHLAPkjkDIoXA75pWstSjIRwCQ8FT+DbCyXZkM0v0UMyIZGyMWTCD3iL0Rmq yzDngKS2B7xmv/SR+PeFcN5SsjHOlic1XezUrESrXRJpIjVtQsTka9De2InZ08lwr+4E ia3FWEHua+cbsHRYUVvDehYuBd7KW8k8gyH7jcJx1apWgaif8vz78fHSBpdhurGsSQ71 E9xJC4xJfQELeKYHeZ+C+K6Xy+5/7vKLpyZ9vUDW+wHnklU/9N7tFeFtr4/bEF/ql/3U BOHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=Clc4AYB6; 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 i24-20020a633c58000000b00530b2754b77si447805pgn.71.2023.06.19.16.12.03; Mon, 19 Jun 2023 16:12:18 -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=Clc4AYB6; 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 S229854AbjFSWGf (ORCPT + 99 others); Mon, 19 Jun 2023 18:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjFSWGe (ORCPT ); Mon, 19 Jun 2023 18:06:34 -0400 Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79206AF for ; Mon, 19 Jun 2023 15:06:32 -0700 (PDT) Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-4717089ae5bso793525e0c.0 for ; Mon, 19 Jun 2023 15:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20221208.gappssmtp.com; s=20221208; t=1687212391; x=1689804391; 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=epHaUjkubRomEjpu/oKPC+kOjwKS/BUbVDRooU3Z4so=; b=Clc4AYB6+dKRBg/IDg+ygozDHkBJRNn61FpjM6RVMm18cdgtaWY0cX5rcr9WOoyL5f m7u70nYbAuk2kaAZCxpqaLxARlP2YJoS64wUCYS+vmIGiqgwXTBcSll6d9X/2eD/SOng bnvSuhu3b16BWuqmdkF7tHs0c3d9r0mv4QvUGsldx7qxTme7ArCAoNuiCIBOokrzdVRE epGhqtrFxDpd0gMY9anaTfl+z9wKFgnv3qJSw5Snx0PtIhSGlt/z5JfEPVnEFHlTZ2gR oME2kHMtBN2/kFhbqPIZph5uY1swSYpVqA1TrM1J6JuowBy2eLA6cv0zprikuBxbJBIP JgeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687212391; x=1689804391; 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=epHaUjkubRomEjpu/oKPC+kOjwKS/BUbVDRooU3Z4so=; b=a5CMts2GoeYRmmt/HgVoknAWBDRbkQgKt0CR8khsBLfhECeIOhI2dJacVVoo4pCbWL vnSjaq20Ylb/MxihXrpW7oFQGm6V+BkNHZIll3lb/h9t4tlhslRCTpCnpP5gGoSeMadn VgfiSzRfngDqdRZqHliTKqS1q0ENzrVh4W+wGnAqllSMG4EyldzESE53+GqkDISJV2eQ 5Q5NA8gFaxJdbjIV4AVOvHVYGDwUcEs94xmY5flRF09HCaJQB9eW2urJJ02k02rHZBnH 5dTaDteBD+SjLz1leg9ukkeDPww5Z9H580jdvMl4HN/M/gN9tLNSI28PU8dYYabn/mxe WE6Q== X-Gm-Message-State: AC+VfDwiKW2HAXorxMZ95t/SnW07+YVBwb1/UsUUyrVCT5tQK+Uff1dL gZYmJ2xZxDSy7XRl3b7VpXAzSA== X-Received: by 2002:a1f:3d11:0:b0:465:fa30:d633 with SMTP id k17-20020a1f3d11000000b00465fa30d633mr2844926vka.0.1687212391496; Mon, 19 Jun 2023 15:06:31 -0700 (PDT) Received: from localhost ([135.180.227.0]) by smtp.gmail.com with ESMTPSA id g7-20020a635207000000b00528db73ed70sm165781pgb.3.2023.06.19.15.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 15:06:30 -0700 (PDT) Date: Mon, 19 Jun 2023 15:06:30 -0700 (PDT) X-Google-Original-Date: Mon, 19 Jun 2023 15:06:25 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, llvm@lists.linux.dev 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=ham 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 Thu, 15 Jun 2023 06:54:33 PDT (-0700), Palmer Dabbelt wrote: > 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. Sorry to be so slow here, but I think this is causing LLD to hang on allmodconfig. I'm still getting to the bottom of it, there's a few other things I have in flight still. > >> >> Thanks