Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1937717rwb; Thu, 17 Nov 2022 04:27:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf7zBK7gtHixq/4RbvqzZJPeIC7reMR2GSENmdPGIQxw29h5dVl2hMHDXKux8VMPNcpU33c5 X-Received: by 2002:a17:90b:3d8a:b0:20c:4f5b:f6cb with SMTP id pq10-20020a17090b3d8a00b0020c4f5bf6cbmr8617241pjb.153.1668688037259; Thu, 17 Nov 2022 04:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668688037; cv=none; d=google.com; s=arc-20160816; b=QMWoBH7FvMY/RWCj68d/H0hxZ5q8sJsbRBPdpDakkUGzh2iDmamCfbpP5NAAjYfB7k P5sNPLbO+41gVvkLvvjoQ2ann3m8x46m70t52chxe5wULEkKjlLSnebFLV+nMDhz+Jc3 VHp80O2Dm4A2HLtlsyjXEpVQtfIJW2p/LmchsYpZ0plyPWQswX1S+tq7JWOWd4gMmULz sTxYURkkuilp8qK+ABiqo4z7yNwbOqok1bahuriXQqGSAWRepBjem+N9xtSM/NpRdRZN 2uLNvZEEyJKxcHxnSb+GGEtkF7IE/dhGmH/PJWCzxi/xLv3kC+pY8TRcKc23sKpZLQJN MbXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JX9mNjEmsW62eiRcIwZIkLu17ge5BNv5zRaNDLlV3HA=; b=RBm2sHUiyvHl2s7RDU8ii8Yexx/3UBMUAorWtr5coo3l3BrqreuEY71Xc+1pmvhOcn eIA86hkrxH6gAq4gpARynGjdCFzlf7tZp5sKx1Cf1+rOUfEU1wTS7GwyPF8E36LCop9O ExX4ZDFwQ/BBDzqxI0sakAbA47b/V2otWILesmR1LQzyhy5A+WIFF3lrwvv0+qDTwhv/ 0eFc1eyn8NrW1mgf9UwK3R7qiWPNFFP7JYI49r8r0DEUhSsDDUyFAarTpf6FVz5QG+fQ nwvSHwsHM+QV49ULLYsB8pDsp8t9pPB10VcWRlQVt56p3OrS9jPxt219Oml/S3YD55e1 9cxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LR9+2Dbx; 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 k20-20020a056a00169400b005669b9f5e1bsi816745pfc.45.2022.11.17.04.26.47; Thu, 17 Nov 2022 04:27:17 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=LR9+2Dbx; 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 S239803AbiKQLnO (ORCPT + 92 others); Thu, 17 Nov 2022 06:43:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239445AbiKQLnG (ORCPT ); Thu, 17 Nov 2022 06:43:06 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32BA4B981 for ; Thu, 17 Nov 2022 03:43:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=JX9mNjEmsW62eiRcIwZIkLu17ge5BNv5zRaNDLlV3HA=; b=LR9+2Dbxn89cUivADHS7D5DKys x2PgMJmDClYkJp08aWpXORlJnAKNtEhPYEFZN2hArX4/xkpGd6vmAm1k6Drpm41sCe7N0aEj1wUYL acovvXKvD8/h/uxHjmXd6etyht1uEZF8lparJpiuS8IjceYaVZZo59bpwM/xID54k+sZTSYEmFLEw 13d5JkUUq+jEzV6j7SkBFWXnkScvv5eGPbBx7c0mdu3wjsQ6SQjuqn8tGt4SyKP4yUgD0bdSucRTC zfLtH2RLWwlfgks2NQaq/9pnQyQeCzmW3320KncHbTGYNsH3gu48JN9a4uBP+nJNqB86sPAplf+CV QLHL8PnA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovdIO-000y4h-2a; Thu, 17 Nov 2022 11:43:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1447C300462; Thu, 17 Nov 2022 12:42:57 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E3DB420B639A1; Thu, 17 Nov 2022 12:42:56 +0100 (CET) Date: Thu, 17 Nov 2022 12:42:56 +0100 From: Peter Zijlstra To: Richard Biener Cc: Ard Biesheuvel , "Jiri Slaby (SUSE)" , linux-kernel@vger.kernel.org, Alexander Potapenko , Alexander Shishkin , Alexei Starovoitov , Alexey Makhalov , Andrew Morton , Andrey Konovalov , Andrey Ryabinin , Andrii Nakryiko , Andy Lutomirski , Arnaldo Carvalho de Melo , Ben Segall , Borislav Petkov , Daniel Borkmann , Daniel Bristot de Oliveira , Dave Hansen , Dietmar Eggemann , Dmitry Vyukov , Don Zickus , Hao Luo , "H . J . Lu" , "H. Peter Anvin" , Huang Rui , Ingo Molnar , Jan Hubicka , Jason Baron , Jiri Kosina , Jiri Olsa , Joe Lawrence , John Fastabend , Josh Poimboeuf , Juergen Gross , Juri Lelli , KP Singh , Mark Rutland , Martin KaFai Lau , Martin Liska , Masahiro Yamada , Mel Gorman , Miguel Ojeda , Michal Marek , Miroslav Benes , Namhyung Kim , Nick Desaulniers , Oleksandr Tyshchenko , Petr Mladek , "Rafael J. Wysocki" , Richard Biener , Sedat Dilek , Song Liu , Stanislav Fomichev , Stefano Stabellini , Steven Rostedt , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Vincenzo Frascino , Viresh Kumar , VMware PV-Drivers Reviewers , Yonghong Song Subject: Re: [PATCH 00/46] gcc-LTO support for the kernel Message-ID: References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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, Nov 17, 2022 at 08:50:59AM +0000, Richard Biener wrote: > On Thu, 17 Nov 2022, Peter Zijlstra wrote: > > > On Mon, Nov 14, 2022 at 08:40:50PM +0100, Ard Biesheuvel wrote: > > > On Mon, 14 Nov 2022 at 12:44, Jiri Slaby (SUSE) wrote: > > > > > > > > Hi, > > > > > > > > this is the first call for comments (and kbuild complaints) for this > > > > support of gcc (full) LTO in the kernel. Most of the patches come from > > > > Andi. Me and Martin rebased them to new kernels and fixed the to-use > > > > known issues. Also I updated most of the commit logs and reordered the > > > > patches to groups of patches with similar intent. > > > > > > > > The very first patch comes from Alexander and is pending on some x86 > > > > queue already (I believe). I am attaching it only for completeness. > > > > Without that, the kernel does not boot (LTO reorders a lot). > > > > > > > > In our measurements, the performance differences are negligible. > > > > > > > > The kernel is bigger with gcc LTO due to more inlining. > > > > > > OK, so if I understand this correctly: > > > - the performance is the same > > > - the resulting image is bigger > > > - we need a whole lot of ugly hacks to placate the linker. > > > > > > Pardon my cynicism, but this cover letter does not mention any > > > advantages of LTO, so what is the point of all of this? > > > > Seconded; I really hate all the ugly required for the GCC-LTO > > 'solution'. There not actually being any benefit just makes it a very > > simple decision to drop all these patches on the floor. > > I'd say that instead a prerequesite for the series would be to actually > enforce hidden visibility for everything not part of the kernel module > API so the compiler can throw away unused functions. Currently it has > to keep everything because with a shared object there might be external > references to everything exported from individual TUs. I'm not sure what you're on about; only symbols annotated with EXPORT_SYMBOL*() are accessible from modules (aka DSOs) and those will have their address taken. You can feely eliminate any unused symbol. > There was a size benefit mentioned for module-less monolithic kernels > as likely used in embedded setups, not sure if that's enough motivation > to properly annotate symbols with visibility - and as far as I understand > all these 'required' are actually such fixes. I'm not seeing how littering __visible is useful or desired, doubly so for that static hack, that's just a crude work around for GCC LTO being inferior for not being able to read inline asm.