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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A69A8C6FA82 for ; Wed, 21 Sep 2022 00:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9id7A/q5uvbP3d0eAMTVoiAwYvReFwOhCjUVmVrWCnU=; b=pBod1z8xqbqpuk nA784IibbvKtmCpklKXchos5LmiOJ9WK+QSHVTg61rco9NCm4OYg5dzlpgEi/qVYL3iMH4s4Oe2un p43wVUbYMK9OLZs16GMP+cefh5x6H+3674rlnUUImPZW8ItqX8ntXXsG5Bzi7x++iqWqfJDspEGXl OyZuNBRSW+CtUg0wMgSzzZuMNj0EPdZ9FKF2bDq7wcf0SjNQ8KAjCdEDI6xfhRGwU1hRZrlq4K7z9 M7fVBuW5jbFBFf6n6DCdQVmJby6laFKK1BR8K1w/6ImcszX8M/wkx9CduD7qdolhgfSWzPiqH9UDb Aj8FM5vELi6oK8/aE0Dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oanI2-007deI-O3; Wed, 21 Sep 2022 00:08:34 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oanHz-007dcE-He for linux-arm-kernel@lists.infradead.org; Wed, 21 Sep 2022 00:08:33 +0000 Received: by mail-pj1-x102d.google.com with SMTP id j6-20020a17090a694600b00200bba67dadso4040690pjm.5 for ; Tue, 20 Sep 2022 17:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=P+2TPNWdXXOCWAvqTb/n3Y3lh5Lh38PVwp86QKZPW/U=; b=l79CvKW56MUCcXospEUz9HzLbq84Cfb4nvfiZqwlGWLuDvqwo4gFUQugO1KgXZ9Feg F5QakQ/sjeAhCMC9RQW4hR6FDddJHvpXKeOgn212CjqVjQ8lXWaQka6F+KDFmCtzUUFp 886SmNU7eIDMwzOpAT29RFKvf+9dHNdY++bxzgSoE325sin8U4JmiBfqbOLUOgsuN+IB r5UKnDBMDxzngTWqQF8pu8lKhOXBWgwmc0yJdTx9JnyvITwzRwBJ0eYao/RNdCt6Xi5y jiathpY5irAfSmUkcV7YbeQT23gXpZ35jag3sLF87/vV36PSAfyOFfr0EVFCrePSB/vu 7WFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=P+2TPNWdXXOCWAvqTb/n3Y3lh5Lh38PVwp86QKZPW/U=; b=B78ZDW1KPWOf8ZBEYEohWordrOuXrL3rS4SKxRRg9poZbbjbMkOodCWhoRVdJ4I5+9 vGbRP1/MyEU5UJDu6kB6BBp7j5vbn3IxoCzdmtJfjle8VXFxCBnOqNIrg0WWyxP12KI5 UaJi9STrGAa31KChumi0lefX+jg+nlNKgYSMGI6JoocWlKAqLg3dlf9vE/oh+cSoqkYH pBFXy/gbXbMdOyePniMbvIrYYZC/EbEXbXzytNSJHv30oNoMyMS6SSUAlJoAchTb4iHs RYpcjQiicQr39PHHjLKviEgQoCta0Cb2dj+nqmLlhIgmd3EhNNxfaF4Y0/duRTPKlt+A KkNQ== X-Gm-Message-State: ACrzQf0qsehch/zqD/+6NBYFznGo+lAvXk61Ry3/MIc0Ym1owLn+Ecpl zDwxB5XqQyBnzE4wVxr63OukvMpSfAK63XgpXxji/Q== X-Google-Smtp-Source: AMsMyM7Hq+eK82DO64bRlQggpPM3rRQhxkz+7K4Da9DMNHl9amBFdTiPYROgJVmKyMQhJXyZ+2seMh8dbNV5Qz4qacQ= X-Received: by 2002:a17:902:d2c4:b0:178:32c4:6648 with SMTP id n4-20020a170902d2c400b0017832c46648mr2115146plc.88.1663718905205; Tue, 20 Sep 2022 17:08:25 -0700 (PDT) MIME-Version: 1.0 References: <20220920082005.2459826-1-denik@chromium.org> <877d1yl797.wl-maz@kernel.org> In-Reply-To: <877d1yl797.wl-maz@kernel.org> From: Denis Nikitin Date: Tue, 20 Sep 2022 17:08:09 -0700 Message-ID: Subject: Re: [PATCH] KVM: arm64: nvhe: Disable profile optimization To: Marc Zyngier Cc: Denis Nikitin , Catalin Marinas , Will Deacon , James Morse , Alexandru Elisei , Nick Desaulniers , Manoj Gupta , David Brazdil , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_170831_605649_A23A0D3A X-CRM114-Status: GOOD ( 30.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Hi Mark, Thank you for a quick response. On Tue, Sep 20, 2022 at 2:34 AM Marc Zyngier wrote: > > Hi Denis, > > On Tue, 20 Sep 2022 09:20:05 +0100, > Denis Nikitin wrote: > > > > Kernel build with -fprofile-sample-use raises the following failure: > > > > error: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.tmp.o: Unexpected SHT_REL > > section ".rel.llvm.call-graph-profile" > > How is this flag provided? I don't see any occurrence of it in the > kernel so far. On ChromeOS we build the kernel with sample profiles by adding -fprofile-sample-use=/path/to/gcov.profile to KCFLAGS. > > > > > SHT_REL is generated by the latest lld, see > > https://reviews.llvm.org/rGca3bdb57fa1ac98b711a735de048c12b5fdd8086. > > Is this part of a released toolchain? If so, can you spell out the > first version where this occurs? Yes, it was added in llvm-13. I will update the patch. > > > Disable profile optimization in kvm/nvhe to fix the build with > > AutoFDO. > > It'd be good to at least mention how AutoFDO and -fprofile-sample-use > relate to each other. Good point. AutoFDO is an example of sample profiles. It's not actually relevant for the bug. I will better remove it. > > > > > Signed-off-by: Denis Nikitin > > --- > > arch/arm64/kvm/hyp/nvhe/Makefile | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile > > index b5c5119c7396..6a6188374a52 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/Makefile > > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile > > @@ -89,6 +89,9 @@ quiet_cmd_hypcopy = HYPCOPY $@ > > # Remove ftrace, Shadow Call Stack, and CFI CFLAGS. > > # This is equivalent to the 'notrace', '__noscs', and '__nocfi' annotations. > > KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_CFI), $(KBUILD_CFLAGS)) > > +# Profile optimization creates SHT_REL section '.llvm.call-graph-profile' for > > +# the hot code. SHT_REL is currently not supported by the KVM tools. > > 'KVM tools' seems vague. Maybe call out the actual helper that > processes the relocations? Agreed. > > > +KBUILD_CFLAGS += $(call cc-option,-fno-profile-sample-use,-fno-profile-use) > > Why adding these options instead of filtering out the offending option > as it is done just above? That was actually the alternative solution and it worked as well. Let me double check if profile optimization doesn't mess up with other sections and if it doesn't I will remove the '.llvm.call-graph-profile' section instead. > > Also, is this the only place the kernel fails to compile? The EFI stub > does similar things AFAIR, and could potentially fail the same way. This was the only place in 5.15 where we tested it. Let me see if EFI has this section. > > Thanks, > > M. > > -- > Without deviation from the norm, progress is not possible. Thanks, Denis _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel