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 X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9501C433DB for ; Fri, 26 Feb 2021 00:37:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1D3D64F1F for ; Fri, 26 Feb 2021 00:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231270AbhBZAg4 (ORCPT ); Thu, 25 Feb 2021 19:36:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhBZAgx (ORCPT ); Thu, 25 Feb 2021 19:36:53 -0500 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB60C061574 for ; Thu, 25 Feb 2021 16:36:13 -0800 (PST) Received: by mail-io1-xd36.google.com with SMTP id o11so21267iob.1 for ; Thu, 25 Feb 2021 16:36:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=Sd2TROa1mctfXj+UUVvMkeau6EdMtkXhi9JcWQa1ABoOk15mmQEdyYhU+yxe/qx6s9 zp8p2HujWwDhdWUEeEB3fi5JHzUGeIGl/H/55kyI7XzRbVz5fSqE8bVGYnod2vvjJrlf x+0M7U2kJ/8v7oli95zqvEhfSHLYixt9T3XaHT4xjIMH98zWyMx9qKwoZYEJJVj/8PyR +JAsUJ53DqavDuoq3j1i1c16JjNXDpeTOH0UsZoGICAO41H3fAJlq3vhAB+j7AGKOFkp dbg+hXP55ZUefNxzbfLNYByV6X39QrDFgiuoLXPjArU66RoRoHjI/n7D/LpakwAnSztL ZDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=Yss5fLUsTdQ1GrNxmfdEStjFkpPmaKqo+jsCYAKM7oxLYiKU+Q4tIMOLAQ+B+FgUJ4 ViURU6Wny04ZH3/4fiRpfMtBS2vYLkUvtgCeTUTmBTGbI7QpjxVrxI7viWjIsBEd5sIh qFh8hb1UrZBSQ8Uu7EJrlBO3LE1QL4B2D2qsfyb2nsIRgkN4cUNHJqKHUZ866vmGgyzw qvIiCwYQZDeYyClaBHTo+18N3ONpwAmt1WyI7fwxRMhiGTqHEfPn8nnFEWho9V+0T05O y/rLn9NPk3wCtQ8R+G6Cuhb9EJKpKulU2arWwL2IwMi3uACNnT3nDTgkB+yqq2E3PpQM CJYA== X-Gm-Message-State: AOAM5334knY6JTZtUUjlBMPQm8dnbUN3yILr/HXWLZfzqcX2WYv3bI8P 3BHfOfkww6Cb1u90DxKse3w/r4u4A5/Ipkud6Yc= X-Google-Smtp-Source: ABdhPJy+HgJo8xZYh16y+XIWLiocSWn6g+3sgej1nJA5g8zRH7hTxPUUiakJxfGih26J0RCMxq0pOstjqZSE5Nxb+QU= X-Received: by 2002:a02:b890:: with SMTP id p16mr399359jam.138.1614299773124; Thu, 25 Feb 2021 16:36:13 -0800 (PST) MIME-Version: 1.0 References: <20210225112122.2198845-1-arnd@kernel.org> In-Reply-To: <20210225112122.2198845-1-arnd@kernel.org> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Fri, 26 Feb 2021 01:36:02 +0100 Message-ID: Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION To: Arnd Bergmann Cc: Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , Arnd Bergmann , Kees Cook , Mark Brown , Vincenzo Frascino , Geert Uytterhoeven , Kristina Martsenko , Ionela Voinescu , Mark Rutland , Andrew Scull , David Brazdil , Marc Zyngier , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Clang-Built-Linux ML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > From: Arnd Bergmann > > When looking at kernel size optimizations, I found that arm64 > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > which enables the --gc-sections flag to the linker. > > I see that for a defconfig build with llvm, there are some > notable improvements from enabling this, in particular when > combined with the recently added CONFIG_LTO_CLANG_THIN > and CONFIG_TRIM_UNUSED_KSYMS: > > text data bss dec hex filename > 16570322 10998617 506468 28075407 1ac658f defconfig/vmlinux > 16318793 10569913 506468 27395174 1a20466 trim_defconfig/vmlinux > 16281234 10984848 504291 27770373 1a7be05 gc_defconfig/vmlinux > 16029705 10556880 504355 27090940 19d5ffc gc+trim_defconfig/vmlinux > 17040142 11102945 504196 28647283 1b51f73 thinlto_defconfig/vmlinux > 16788613 10663201 504196 27956010 1aa932a thinlto+trim_defconfig/vmlinux > 16347062 11043384 502499 27892945 1a99cd1 gc+thinlto_defconfig/vmlinux > 15759453 10532792 502395 26794640 198da90 gc+thinlto+trim_defconfig/vmlinux > Thanks for the numbers. Does CONFIG_TRIM_UNUSED_KSYMS=y have an impact to the build-time (and disc-usage - negative way means longer/bigger)? Do you have any build-time for the above numbers? BTW, is CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y setable for x86 (64bit)? ( Did not look or check for it. ) - Sedat - > I needed a small change to the linker script to get clean randconfig > builds, but I have not done any meaningful boot testing on it to > see if it works. If there are no regressions, I wonder whether this > should be autmatically done for LTO builds, given that it improves > both kernel size and compile speed. > > Link: https://lore.kernel.org/lkml/CAK8P3a05VZ9hSKRzVTxTn+1nf9E+gqebJWTj6N23nfm+ELHt9A@mail.gmail.com/ > Signed-off-by: Arnd Bergmann > --- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/vmlinux.lds.S | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index b94a678afce4..75e13cc52928 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -2,6 +2,7 @@ > config ARM64 > def_bool y > select ACPI_CCA_REQUIRED if ACPI > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION > select ACPI_GENERIC_GSI if ACPI > select ACPI_GTDT if ACPI > select ACPI_IORT if ACPI > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S > index bad2b9eaab22..926cdb597a45 100644 > --- a/arch/arm64/kernel/vmlinux.lds.S > +++ b/arch/arm64/kernel/vmlinux.lds.S > @@ -217,7 +217,7 @@ SECTIONS > INIT_CALLS > CON_INITCALL > INIT_RAM_FS > - *(.init.altinstructions .init.bss .init.bss.*) /* from the EFI stub */ > + *(.init.altinstructions .init.data.* .init.bss .init.bss.*) /* from the EFI stub */ > } > .exit.data : { > EXIT_DATA > -- > 2.29.2 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210225112122.2198845-1-arnd%40kernel.org. 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 X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15928C433DB for ; Fri, 26 Feb 2021 00:37:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE8D960202 for ; Fri, 26 Feb 2021 00:37:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE8D960202 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:Reply-To:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8JF1JB/ruxKe/UayYOnR2EAKO+eQZd0NWcTTpvn0Atw=; b=IgJ8NCqHvhyQQhb3qi3TPKBw6 kiHTEh3ZgKdVxPAWw2Lftsb4JQ4Sqa4d4Pl9jCxbkHpXEWajHyqkHSjJzBZ++vRrHYctjeLBph9Ji /XqdX+HzrWMoadzC4kRSGxfxzZGToQA2KYU6CCBPZZBXwjv24fVm3xgUOAA1uHEr7BNwJuB1dUtBG 0DjGkqxOx2V3Zmv98cD6esfJQFYT1Wog2kBP4EydOVY83f6HvbI8H58/v/9LNdN3mvR2TuxLrScRY oc8xTq0rgn/H0zdZzmmYzAjgz9NCdlJKHk9cj8JdEFSbMqL0t0VpwBm9AQUjcxA3myGDyIJdiWk7j NaVT8lS2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFR7C-0007ut-D6; Fri, 26 Feb 2021 00:36:18 +0000 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFR7A-0007uV-5B for linux-arm-kernel@lists.infradead.org; Fri, 26 Feb 2021 00:36:17 +0000 Received: by mail-io1-xd31.google.com with SMTP id i8so7936653iog.7 for ; Thu, 25 Feb 2021 16:36:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=Sd2TROa1mctfXj+UUVvMkeau6EdMtkXhi9JcWQa1ABoOk15mmQEdyYhU+yxe/qx6s9 zp8p2HujWwDhdWUEeEB3fi5JHzUGeIGl/H/55kyI7XzRbVz5fSqE8bVGYnod2vvjJrlf x+0M7U2kJ/8v7oli95zqvEhfSHLYixt9T3XaHT4xjIMH98zWyMx9qKwoZYEJJVj/8PyR +JAsUJ53DqavDuoq3j1i1c16JjNXDpeTOH0UsZoGICAO41H3fAJlq3vhAB+j7AGKOFkp dbg+hXP55ZUefNxzbfLNYByV6X39QrDFgiuoLXPjArU66RoRoHjI/n7D/LpakwAnSztL ZDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=zSQkfXYILeFIsnw9KPEpR0PnZSHnbzsSZbKt0dU2Xn4=; b=dySNE1J1dCiL3ZfRqGfdGxZierNW9YX56kW5jcP8dCSN0npGjXemzEJkjrA0ZOGgSN F50e8MTq1FUqzGecJBv5a3EnqOjfc0WGTC60ygtY+Xfjm5V7GXC8WgKTOQkf1Hr9qV8e APci4peI++l+x6w9Lg57rv4D+GeXoskSnQ3MejWXfngLoWd9HTXBn6d7jcmpuW5AY/dz DA1w3rNkwufldV0hx9NMvsr2wb5eX70vONHsxBVAZCshLHCOcKFKlxlJ64tPBhxXlT0E uNgpKE24J64mGgyIuyDi7QMBRefNqHClE38qPl56vzCJ+/QeBHJTeiCdl+yjJnfhpmAA Lp+g== X-Gm-Message-State: AOAM5335DeDltBJu2r9SQ7qua2GJiBLP1g0KqUvCZRBf361AW7pIVSlE 4esaZG2atQV9AFAo/gkDa5wdL+rcI3nYM+qblwQ= X-Google-Smtp-Source: ABdhPJy+HgJo8xZYh16y+XIWLiocSWn6g+3sgej1nJA5g8zRH7hTxPUUiakJxfGih26J0RCMxq0pOstjqZSE5Nxb+QU= X-Received: by 2002:a02:b890:: with SMTP id p16mr399359jam.138.1614299773124; Thu, 25 Feb 2021 16:36:13 -0800 (PST) MIME-Version: 1.0 References: <20210225112122.2198845-1-arnd@kernel.org> In-Reply-To: <20210225112122.2198845-1-arnd@kernel.org> From: Sedat Dilek Date: Fri, 26 Feb 2021 01:36:02 +0100 Message-ID: Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION To: Arnd Bergmann X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_193616_261917_D8274643 X-CRM114-Status: GOOD ( 29.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sedat.dilek@gmail.com Cc: Mark Rutland , Ionela Voinescu , Kees Cook , Arnd Bergmann , Catalin Marinas , Nick Desaulniers , linux-kernel@vger.kernel.org, Kristina Martsenko , Ard Biesheuvel , Nathan Chancellor , Clang-Built-Linux ML , Mark Brown , Andrew Scull , Marc Zyngier , Geert Uytterhoeven , Vincenzo Frascino , Will Deacon , David Brazdil , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > From: Arnd Bergmann > > When looking at kernel size optimizations, I found that arm64 > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > which enables the --gc-sections flag to the linker. > > I see that for a defconfig build with llvm, there are some > notable improvements from enabling this, in particular when > combined with the recently added CONFIG_LTO_CLANG_THIN > and CONFIG_TRIM_UNUSED_KSYMS: > > text data bss dec hex filename > 16570322 10998617 506468 28075407 1ac658f defconfig/vmlinux > 16318793 10569913 506468 27395174 1a20466 trim_defconfig/vmlinux > 16281234 10984848 504291 27770373 1a7be05 gc_defconfig/vmlinux > 16029705 10556880 504355 27090940 19d5ffc gc+trim_defconfig/vmlinux > 17040142 11102945 504196 28647283 1b51f73 thinlto_defconfig/vmlinux > 16788613 10663201 504196 27956010 1aa932a thinlto+trim_defconfig/vmlinux > 16347062 11043384 502499 27892945 1a99cd1 gc+thinlto_defconfig/vmlinux > 15759453 10532792 502395 26794640 198da90 gc+thinlto+trim_defconfig/vmlinux > Thanks for the numbers. Does CONFIG_TRIM_UNUSED_KSYMS=y have an impact to the build-time (and disc-usage - negative way means longer/bigger)? Do you have any build-time for the above numbers? BTW, is CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y setable for x86 (64bit)? ( Did not look or check for it. ) - Sedat - > I needed a small change to the linker script to get clean randconfig > builds, but I have not done any meaningful boot testing on it to > see if it works. If there are no regressions, I wonder whether this > should be autmatically done for LTO builds, given that it improves > both kernel size and compile speed. > > Link: https://lore.kernel.org/lkml/CAK8P3a05VZ9hSKRzVTxTn+1nf9E+gqebJWTj6N23nfm+ELHt9A@mail.gmail.com/ > Signed-off-by: Arnd Bergmann > --- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/vmlinux.lds.S | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index b94a678afce4..75e13cc52928 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -2,6 +2,7 @@ > config ARM64 > def_bool y > select ACPI_CCA_REQUIRED if ACPI > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION > select ACPI_GENERIC_GSI if ACPI > select ACPI_GTDT if ACPI > select ACPI_IORT if ACPI > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S > index bad2b9eaab22..926cdb597a45 100644 > --- a/arch/arm64/kernel/vmlinux.lds.S > +++ b/arch/arm64/kernel/vmlinux.lds.S > @@ -217,7 +217,7 @@ SECTIONS > INIT_CALLS > CON_INITCALL > INIT_RAM_FS > - *(.init.altinstructions .init.bss .init.bss.*) /* from the EFI stub */ > + *(.init.altinstructions .init.data.* .init.bss .init.bss.*) /* from the EFI stub */ > } > .exit.data : { > EXIT_DATA > -- > 2.29.2 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210225112122.2198845-1-arnd%40kernel.org. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel