Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5512699rwp; Mon, 17 Jul 2023 05:32:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlG3Q8j0QrLslhrJCcFmrQYb8g9Nx67rGHIQh7gJ7w/tvZviq8cw/W+wLaAfSSlKR1Vi7Jfn X-Received: by 2002:a05:6a20:5486:b0:10f:1d33:d667 with SMTP id i6-20020a056a20548600b0010f1d33d667mr16734687pzk.5.1689597174363; Mon, 17 Jul 2023 05:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689597174; cv=none; d=google.com; s=arc-20160816; b=tfmNr7OiXia+7iTuA9VoxUOr+VukXJaMOTLwVpAuZxCoVm5SGSE/WlV8kaeiFakeiC i/JWfeN/X7U24yMDlWgsnm+xkPRycl65cL9QGlnww068jmfVlV2kUJyIRBD5TWGna+So kyIMVcDcuhbZJpTrxzrmJmZDynkkvuzd9TnhIEze8MOOEiBGh0Y+aQWYjiHjsGJtHFLR kn69+glZcC4fQSSmEb7r7mFgW/d2zaoWChVGzmea3y4fOscxqVrUrPNWh95iJWi/1GPc dRT1qwHXWERBqZAfdzCiWlJO7sa/FjiDSws1MBLRnYRKqfuB+4/9gJXksI9wKdgEw05g g1Ug== 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 :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=+ULW7oM8An9U4ls6c826oD5Bcf6KrlaTj6Zhq8Q4Cx4=; fh=SIY3YTGelo7u8DBV742tV8+BOAa20RGs/l3F6KITk0o=; b=AULgvzFKfDNrvthYK5ae5DF4F9EpPGO1O6bkU4alYw8ApzV2yBsv52gECGat47CpLT ONagpeXfXhmt1VvumHFA9WF54XnqZ0OVKHBLUMZdAnIMtPQf4BMzbTo8VYJsr4kyrcwQ SW2WhMLRnEEto4ksqmG/DBbmsAQpuv5soBPDob1246kgqwiiPMsSeMsZ+LHj3nzgAxU/ f/1lfjIQRT9bB5nrtFF3mS+1JyZFSOfMPmjhbpmVM5g2KrAZatLGzPSQdcHYfKfQZfti YR8obUEixJmSTFelCAPu2W+rWdIsVVy6mxY80OAGXn+Wn13nMq3I9JcV4OjtxhLXFlDK HMhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="nPGE6NL/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a634654000000b0055b7319a311si4444714pgk.356.2023.07.17.05.32.41; Mon, 17 Jul 2023 05:32:54 -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=@kernel.org header.s=k20201202 header.b="nPGE6NL/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbjGQMPZ (ORCPT + 99 others); Mon, 17 Jul 2023 08:15:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjGQMPX (ORCPT ); Mon, 17 Jul 2023 08:15:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282DB130 for ; Mon, 17 Jul 2023 05:15:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99BDE61033 for ; Mon, 17 Jul 2023 12:15:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05B4BC433C7; Mon, 17 Jul 2023 12:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689596121; bh=BiCDsyUlgBVwwo5xDN71eLLu5PGYOGmjWwwo6GQF6YI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nPGE6NL/9wvRdjAXNkXbcn6kpbwSeEB4INcqOSnz9XsBBNIwuffz+iuAwSC++jAVu kqJY9w0mC6o/0ydaSJBKGydAPM6VemC5hY4WYRSA2mM16XabGFtJU8Pw0cJ982BupU 6BLXUlzjhVpGKq1SuYqcegOBKdRUOAsbV3+254J3M6e94bd0faLWLLFfq38QMwP59W FT2Xq3JKVClBqZWQqPmUL/NrRyfPn0O9BXpN0iUSIoOvRW1oNAjiQWuFtjU0GgJ/R1 bQnpkkZXX4PAop8LcWwl2Yd6pFCcxhpbTL9gUs70Ww1ne7TSIG9MWpV7GXnOkzP/Mq oqPTHlLzCkXBg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qLN8I-00Dj4J-KQ; Mon, 17 Jul 2023 13:15:18 +0100 Date: Mon, 17 Jul 2023 13:15:18 +0100 Message-ID: <864jm2vind.wl-maz@kernel.org> From: Marc Zyngier To: Kefeng Wang Cc: Catalin Marinas , Will Deacon , , Subject: Re: [PATCH] arm64: enable dead code elimination In-Reply-To: <23d94414-b819-eaef-6fac-638bf713d341@huawei.com> References: <20230717080739.1000460-1-wangkefeng.wang@huawei.com> <801e30a093e41c3eebd675f0d224f8d7@kernel.org> <23d94414-b819-eaef-6fac-638bf713d341@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: wangkefeng.wang@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Mon, 17 Jul 2023 12:56:39 +0100, Kefeng Wang wrote: >=20 >=20 >=20 > On 2023/7/17 17:42, Marc Zyngier wrote: > > On 2023-07-17 09:07, Kefeng Wang wrote: > >> Select CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION for arm64, allowing t= he > >> user to enable dead code elimination. In order for this to work, ensure > >> that we keep the necessary tables by annotating them with KEEP, also it > >> requires further changes to linker script to KEEP some tables and > >> wildcard > >> compiler generated sections into the right place. > >>=20 > >> The following comparison is based 6.5-rc2 with defconfig, > >>=20 > >> $ ./scripts/bloat-o-meter vmlinux-base vmlinux-new > >> add/remove: 3/1106 grow/shrink: 4102/6964 up/down: 35704/-99980 (-6427= 6) > >> Function=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 old=C2=A0=C2=A0=C2=A0=C2=A0 new=C2=A0=C2=A0 delta > >> ... > >> Total: Before=3D17888959, After=3D17824683, chg -0.36% > >>=20 > >> add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-44 (-44) > >> Data=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 old=C2=A0=C2=A0=C2=A0=C2=A0 new=C2=A0=C2=A0 delta > >> ... > >> Total: Before=3D4820808, After=3D4820764, chg -0.00% > >>=20 > >> add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-1096 (-1096) > >> RO Data=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 old=C2=A0=C2=A0=C2=A0=C2=A0 new=C2=A0=C2=A0 delta > >> ... > >> Total: Before=3D5179123, After=3D5178027, chg -0.02% > >>=20 > >> $ size vmlinux-base vmlinux > >> =C2=A0=C2=A0 text=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 data=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bss=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dec= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 hex=C2=A0=C2=A0=C2=A0 filename > >> 25433734=C2=A0 15385766=C2=A0 630656=C2=A0 41450156=C2=A0 2787aac=C2= =A0=C2=A0=C2=A0 vmlinux-base > >> 24756738=C2=A0 15360870=C2=A0 629888=C2=A0 40747496=C2=A0 26dc1e8=C2= =A0=C2=A0=C2=A0 vmlinux-new > >>=20 > >> Memory available after booting, saving 704k on qemu, > >> base: 8084532K/8388608K > >> new:=C2=A0 8085236K/8388608K > >>=20 > >> Signed-off-by: Kefeng Wang > >=20 > > I took this patch for a spin in my tree, and ended up with: > >=20 > > =C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .vmlinux.export.o > > =C2=A0 UPD=C2=A0=C2=A0=C2=A0=C2=A0 include/generated/utsversion.h > > =C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 init/version-timestamp.o > > =C2=A0 LD=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .tmp_vmlinux.kallsyms1 > > ld: init/main.o(__patchable_function_entries): error: need linked-to > > section for --gc-sections > > make[2]: *** [scripts/Makefile.vmlinux:36: vmlinux] Error 1 > > make[1]: *** [/home/maz/hot-poop/arm-platforms/Makefile:1238: > > vmlinux] Error 2 > > make: *** [Makefile:234: __sub-make] Error 2 >=20 > I don't find this error with CONFIG_FTRACE_MCOUNT_RECORD or > allyesconfig, does it need special config or gcc version? You tell me! gcc (Debian 10.2.1-6) 10.2.1 20210110 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. so hardly something special. This is built with the current state of my NV tree, available here[1] As for the configuration, have a look here[2]. M. [1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/l= og/?h=3Dkvm-arm64/nv-6.6-WIP [2] https://paste.debian.net/1286106/ --=20 Without deviation from the norm, progress is not possible.