Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp8562pxk; Wed, 30 Sep 2020 16:09:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVWBP40Zvv6gGovghIPW0GY19Y4A6QKlJIsP21rDOa1JM0Q+u0Lkw7NjkzqWIox5kbao2t X-Received: by 2002:a17:906:4087:: with SMTP id u7mr5242631ejj.466.1601507345516; Wed, 30 Sep 2020 16:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601507345; cv=none; d=google.com; s=arc-20160816; b=Ek9BGGmiwWwI8wgZcHfNjE/9pA4Q7i8CB/py9jPvVWd9qPzh9nhn+WcBdP4TpgFLYJ VGatlfXxzvxe6JzjNNnqA0FfdGgpVkBNpsIHpQhuPRhEpvJwouMj3LORwQzshZKarQM7 0CBXuBR6/txeYDU3jGkXrc4dYdQo0e6lBhYVg9EOqH8kYCZQotwSVCufzI5Vflnrh/BO 6mtBS/0CGevpvZhEuplukr52k5ZNnq4ZiAe47RDEJ+39p5UPkBtAW2oDY058rJ24wdDo /qBcaYU3q284mQ6MMt5ItvsMlyNt2wqs10C4KrM199KSlB/rEdXCBrix1xe4n0lDYxCT QqTA== 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=/5JyINSMzWB8voXWZyV8ASlSh5pqRDmgZFl229b53xc=; b=hLnbgis8pa+FkFLfhjPvGe9H9n78fsngA85s/hIjWqYYpY9cSbmbeug9bKtSlz2Cro PCQp7TtzD15EelUej2OCgcXXW4OugOJ0iYaIgX3Z8hhFPOofxcnfljPMAGl0tQra7mtM S6y5dpADV/0PeyLG5rFPsGTas7kjMeqP6f9ZrsuNH5f2SFGtfzcbcx4oFObiBRI6+2pi 3gikRhiawvSPrOX0TBHntFUeFkp25wf2Bbwya1ZpDExR0DOtdmraLBPHYYQ5/sTDiaVh VLgTdFDivECjtX1Qeh19/OgBHrp6izMLAsfkxwfCDKt9mnyXZ6m9hjorn9YT0zazzXSj F9Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vIRIWKYp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si2411169edr.41.2020.09.30.16.08.43; Wed, 30 Sep 2020 16:09:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vIRIWKYp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730842AbgI3WND (ORCPT + 99 others); Wed, 30 Sep 2020 18:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731000AbgI3WNC (ORCPT ); Wed, 30 Sep 2020 18:13:02 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D199FC0613D2 for ; Wed, 30 Sep 2020 15:13:01 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id b12so3530557edz.11 for ; Wed, 30 Sep 2020 15:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/5JyINSMzWB8voXWZyV8ASlSh5pqRDmgZFl229b53xc=; b=vIRIWKYp7RTSUGB8ntUgtpTfuIX9PNECXrtz7OF4WuzjxaB6ucqKe+labxFFw91k3e QxLYAkxotsyYRcimIeAn7Z8xictu3hpLg464s+yhLPGoBBznroXq6KWSnvggTT+OKc+4 aDiohWxi2bv6qcv/jsb8X6MLhFKoc5VlhLVAgI9mvRP+ESLwvXgjzFulM/aycHPXZ43C 1PZWgQU//0UlvKQQQTsVxdhKKn2R1cZHSse1ucxAjFxlIjoTBB5mxWh5AjLIfsBpQ8Qr kwHSrW70qM469yHzjDZCiyJ6JH0YYN8N5o79By5EDLYjMuAR2Pr4Z/ShSwy2ytzZ+9o+ xxNw== 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:from:date :message-id:subject:to:cc; bh=/5JyINSMzWB8voXWZyV8ASlSh5pqRDmgZFl229b53xc=; b=MDr9odjs6qdHC+j/Dox8kTfnZzvlcAaykNzqFzZSLTC9PnCYmtF6+mqcCQRLXUTrY3 6aNz51DJMAKDCdecDOY4tOrshGCAsw3ZdAkauJYgB9DFIXgjxTvQU/H5F7b0gGjaGBWd SSluSO7V5Nfpk07k7n29Zc9tQsiEYHLMEuKFuE6V3GlnUPGZFB2cj4bZpKArN+Wzsfyr m344co0DXr0k/U+iyYSziD6fnrT48h1DQ4y2m7Wq7C4YsVAnm2F96ZbHrRaFsQwGbbUs fKV+z8TvmCn9DXeFfyfo6SkFY1HM2i9jn+2w4OpOE45r4xYXn9jEhl09W+iLCacOSIpM xlBg== X-Gm-Message-State: AOAM531RERFRAfDoi3+e+79X5W09P4JMjlbQ6UANGuaY8+8LGEWGgRW7 1zILTMz0jr6zcU6XP1HerowjIObcBP2PpIAyiUBktQ== X-Received: by 2002:aa7:c0d3:: with SMTP id j19mr5304520edp.40.1601503980129; Wed, 30 Sep 2020 15:13:00 -0700 (PDT) MIME-Version: 1.0 References: <20200929214631.3516445-1-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Wed, 30 Sep 2020 15:12:49 -0700 Message-ID: Subject: Re: [PATCH v4 00/29] Add support for Clang LTO To: Nick Desaulniers , Peter Zijlstra Cc: Masahiro Yamada , Will Deacon , Steven Rostedt , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , clang-built-linux , Kernel Hardening , linux-arch , Linux ARM , Linux Kbuild mailing list , LKML , linux-pci@vger.kernel.org, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 2:58 PM Nick Desaulniers wrote: > > On Tue, Sep 29, 2020 at 2:46 PM Sami Tolvanen wrote: > > > > This patch series adds support for building x86_64 and arm64 kernels > > with Clang's Link Time Optimization (LTO). > > > > In addition to performance, the primary motivation for LTO is > > to allow Clang's Control-Flow Integrity (CFI) to be used in the > > kernel. Google has shipped millions of Pixel devices running three > > major kernel versions with LTO+CFI since 2018. > > > > Most of the patches are build system changes for handling LLVM > > bitcode, which Clang produces with LTO instead of ELF object files, > > postponing ELF processing until a later stage, and ensuring initcall > > ordering. > > Sami, thanks for continuing to drive the series. I encourage you to > keep resending with fixes accumulated or dropped on a weekly cadence. > > The series worked well for me on arm64, but for x86_64 on mainline I > saw a stream of new objtool warnings: [...] Objtool normally won't print out these warnings when run on vmlinux.o, but we can't pass --vmlinux to objtool as that also implies noinstr validation right now. I think we'd have to split that from --vmlinux to avoid these. I can include a patch to add a --noinstr flag in v5. Peter, any thoughts about this? > I think those should be resolved before I provide any kind of tested > by tag. My other piece of feedback was that I like the default > ThinLTO, but I think the help text in the Kconfig which is visible > during menuconfig could be improved by informing the user the > tradeoffs. For example, if CONFIG_THINLTO is disabled, it should be > noted that full LTO will be used instead. Also, that full LTO may > produce slightly better optimized binaries than ThinLTO, at the cost > of not utilizing multiple cores when linking and thus significantly > slower to link. > > Maybe explaining that setting it to "n" implies a full LTO build, > which will be much slower to link but possibly slightly faster would > be good? It's not visible unless LTO_CLANG and ARCH_SUPPORTS_THINLTO > is enabled, so I don't think you need to explain that THINLTO without > those is *not* full LTO. I'll leave the precise wording to you. WDYT? Sure, sounds good. I'll update the help text in the next version. > Also, when I look at your treewide DISABLE_LTO patch, I think "does > that need to be a part of this series, or is it a cleanup that can > stand on its own?" I think it may be the latter? Maybe it would help > shed one more patch than to have to carry it to just send it? Or did > I miss something as to why it should remain a part of this series? I suppose it could be stand-alone, but as these patches are also disabling LTO by filtering out flags in some of the same files, removing the unused DISABLE_LTO flags first would reduce confusion. But I'm fine with sending it separately too if that's preferred. Sami