Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1902702rwb; Thu, 17 Nov 2022 03:55:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf65LFK205YHApyRWrdh0VH8aG2+oh2BSVt44ApzZFV6XG80uHAGJVimz+pNOOlaxXBXpLf/ X-Received: by 2002:a17:90b:234d:b0:212:c06c:47ba with SMTP id ms13-20020a17090b234d00b00212c06c47bamr8606246pjb.131.1668686150211; Thu, 17 Nov 2022 03:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668686150; cv=none; d=google.com; s=arc-20160816; b=n9tpYBT5qN/wN2n5VS3oAjdpktBRGxgVQ06gbGpfv/7/+9SPcr/kGUoRZWi+tDJQHj CwyMrtUDC2mUOHczKHcXty8Zzgj2S9ZL3niBcSTHMYt4uBS3qQmo3Zy66fLypvUZ8bJ5 oPvS0xY2nWf3PNrfntsTOfUB/H+rKFsNfo1Nmwgt1LQqvEiX18hCJ0EyDM3S4fL2efma xtF7BTojWjkWD5/b+NL1hyvgPG3UQ4OHwzJ0iDZ9tHqRz0ftisJX8fnNvMUMPS0CCvgh ed/8NBIrFW2/4s/qsjc6viayKY+oqM0gE/81/0g4PnzS2yGtMclfWz2oBzIvFcQXDMNF xx2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wfeyEzDPXEfqatxdUXFHCatxYQUDB7CCYwFuCVuJsSk=; b=qSkR2TAzbKvJ1F+yhKUnLOjAdN0hSg8+2h90XXm4wOCVGsU29TqXCJPwmKbAI8PICF mqbKWMqrbqgPN1ge1Q/BrOe+3drGe3QzAx/7i+smytHEKFk71MCab+yiophywOGy8b7E 00M74j69XOY9k37sdLw0BCTByQkUQrnEd/FWV+x2F6hV79i1WgpyPXS2RKeRvbEOyRfm 5GLAzXIUIjiB1nwIolkHXAwmMTYF1Px6hceF3nB+IAiwR/p4Dm6ChGPk+c2ONVXQuuMH 25fxXTJuQ5g9xuDE6Q18j1AHoqOOZveh/M6PpO/woybtHi60BiMekkNxlhxWWocRosgw Kqyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QESBDutZ; 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 b13-20020a17090a550d00b0021332d10601si577942pji.183.2022.11.17.03.55.38; Thu, 17 Nov 2022 03:55:50 -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=@kernel.org header.s=k20201202 header.b=QESBDutZ; 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 S239684AbiKQLuA (ORCPT + 92 others); Thu, 17 Nov 2022 06:50:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234522AbiKQLtc (ORCPT ); Thu, 17 Nov 2022 06:49:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D47E54B22 for ; Thu, 17 Nov 2022 03:49:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4A878B82008 for ; Thu, 17 Nov 2022 11:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB9EC43151 for ; Thu, 17 Nov 2022 11:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668685768; bh=/gvUDPMaBmVufSBFDI6VBbgyRnWOM3lrsRBBcgosYTg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QESBDutZsdoSjbOM8sJbjS6yhsbNYzatlVYgRgEvDZ3r9fHuow3Bx6XmRrKxlS9xI +ilgZj+qGMqmQPHC2BhoP7MIzSEMzmBZ0wAKIB19Lu9J1sUMHfbckiNHtOrhIV++v/ 3qxbMIHXDbqGkFkLjPJhaIPBCXBGsFSOuHGXAbwrubaFy6dzah6vMpN/3Ocdj1Pbl+ HFgYHLiHw22rMzNa2Rkkn8aBQi2AtDL7lvJo3vBrm8qT0kGO+3kxepssM7GQiOGdA6 j2y/R7cLMSGYkIPvph+/o9ez1i07ahx4hRymnCKfypMOzrFp5HMdsenoeW4c33B2GB HZM9d/LgLpHag== Received: by mail-lj1-f171.google.com with SMTP id s24so2335181ljs.11 for ; Thu, 17 Nov 2022 03:49:27 -0800 (PST) X-Gm-Message-State: ANoB5pnylcW5rlW0Hd47gt2zNcbp27I6LB9rwaTlxajspHrGWc/keMMv oQXYCm0vpoU7ARFD0nicxO2Q9r03vfkMsZhUrKc= X-Received: by 2002:a05:651c:1603:b0:26d:d603:8df2 with SMTP id f3-20020a05651c160300b0026dd6038df2mr807834ljq.189.1668685765600; Thu, 17 Nov 2022 03:49:25 -0800 (PST) MIME-Version: 1.0 References: <20221114114344.18650-1-jirislaby@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Thu, 17 Nov 2022 12:49:14 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/46] gcc-LTO support for the kernel To: Peter Zijlstra Cc: Richard Biener , "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 Content-Type: text/plain; charset="UTF-8" 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 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, 17 Nov 2022 at 12:43, Peter Zijlstra wrote: > > 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. We have an __ADDRESSABLE() macro and asmlinkage modifier to annotate symbols that may appear to the compiler as though they are never referenced. Would it be possible to repurpose those so that the LTO code knows which symbols it must not remove?