Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp716778rwi; Thu, 13 Oct 2022 04:26:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68PTApFwSVQvSfw/53Bb7HPqYaF+i2m8CvcnD9i9OombD5CQJmlfA8wXbFaaSOMeXJLubv X-Received: by 2002:a17:902:eb8e:b0:17f:637b:9548 with SMTP id q14-20020a170902eb8e00b0017f637b9548mr34399799plg.158.1665660389057; Thu, 13 Oct 2022 04:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665660389; cv=none; d=google.com; s=arc-20160816; b=oFtKtVEzvUGWTVvdAXg6NkPENdpxeOpJXAaP99vT3+zXNlW4smyvLPn4JHhP6hGZD0 WI7JMykdZd3szGpbR1IqQe/RHxeUSztXK4xdrlVbHrMCr9tyGspY9tugEV0FhoKOfDsT 3UhdRxvR/Aroc2w8gswZpmfU4iHcJovywieSYF83DWCiSOr+HEIaUGhglNhlw/5qU98z hyiomLXTfdOqeaF9OJHqTtW1tjJgF3V6nQJOy5AxtGrrc4+I4rCWGiFK6jWbC4Uwurcp AzaGEo451/RNXUHKY51UY0XzUVXhr/vysrRErhBMdBKdY8fuSP32A4HZ7Os3W1n44tAn sR1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=LeeIhJhOgLNEdMHRkAsgW966dS6RNQe7LxClpbQBCY4=; b=hvN/62xyQaQeb2+R/jCemdw39BAkGcEyQpPlxK6n+spHaHAUCfW5TEFA1czYgRStVa 6AtTc3f++JEYeHy9fE7g9wNfIKXhRxuG4TI7zO+u+hTmEGlpdFbCdDfpKLuhl1tFnnzr 2+xRiWPCvspGQ+ZhnlOOUXfvohfbmfkR/6WvuE9CcnFEHU7cRYsb+nJf5TlLmIqZwzvE sSfgUwmi9tZfrImhiyNEpvr/n7gP84ZuSTWiHa5Nd6EcpwgEaVfMBwcvFszszeMaAjYb /ndyX0gwoG/vlGR2qOdtsALF0iuW9Moj+OJSEYRipw12ZAobtTrEEjq6H13kXlrqJpo1 5zlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=je2mEfiK; 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 r75-20020a632b4e000000b00439d86cf509si21402563pgr.645.2022.10.13.04.26.09; Thu, 13 Oct 2022 04:26:29 -0700 (PDT) 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=je2mEfiK; 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 S229686AbiJMLJP (ORCPT + 99 others); Thu, 13 Oct 2022 07:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbiJMLJH (ORCPT ); Thu, 13 Oct 2022 07:09:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5257E110B0C for ; Thu, 13 Oct 2022 04:09:06 -0700 (PDT) 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 AFDCAB81E1D for ; Thu, 13 Oct 2022 11:09:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A66EC433C1; Thu, 13 Oct 2022 11:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665659343; bh=mJSG3Ydey0D8JU11fE/SlVcGP6owZzI1lHl/NbqcfTo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=je2mEfiKTkOYfvV0MhUFOdagygdELrWt1GjDnOiWcenKEQ8XqOMCovkIG88IO+vYi HcOakqRS0q8ILHHQrBqi/+hZ0LHgP+sgmXFSqqg7mcIppwSw16vyQ725u8YVH0jH// GqHZLEHJSWYMFgNU6jN2M1xd0htll1Xry/lkRqUoTNDLIDR8M6DiNeAJtoZFqvN32j 51PszE1f0DxJnYeRyZ88CQSrfCesVlhcDPMOwivHfeywoXJXLivrEcxhqLojCfLcvj RGkC51wFcwVyAxiaWLhabUvvHuTjOLr93siCuuz+3oyJEPCtV4wvHe97SX/Wf3ttGm z5yw8AJkTXhoQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oiw5F-00GHc3-0t; Thu, 13 Oct 2022 12:09:01 +0100 Date: Thu, 13 Oct 2022 12:09:00 +0100 Message-ID: <86fsfsf0ab.wl-maz@kernel.org> From: Marc Zyngier To: Denis Nikitin Cc: Catalin Marinas , Will Deacon , James Morse , Alexandru Elisei , Nick Desaulniers , David Brazdil , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Manoj Gupta Subject: Re: [PATCH v2] KVM: arm64: nvhe: Fix build with profile optimization In-Reply-To: References: <20220920082005.2459826-1-denik@chromium.org> <20220922053145.944786-1-denik@chromium.org> <87h70zk83g.wl-maz@kernel.org> <87sfjxhh4k.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: denik@chromium.org, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, ndesaulniers@google.com, dbrazdil@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, manojgupta@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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 Tue, 11 Oct 2022 03:15:36 +0100, Denis Nikitin wrote: > > On Sat, Oct 8, 2022 at 7:22 PM Marc Zyngier wrote: > > > > On Thu, 06 Oct 2022 17:28:17 +0100, > > Denis Nikitin wrote: > > > > > > Hi Mark, > > > > s/k/c/ > > > > > > > > This problem currently blocks the PGO roll on the ChromeOS kernel and > > > we need some kind of a solution. > > > > I'm sorry, but I don't feel constrained by your internal deadlines. I > > have my own... > > > > > Could you please take a look? > > > > I have asked for a reproducer. All I got for an answer is "this is > > hard". Providing a profiling file would help, for example. > > Could you please try the following profile on the 5.15 branch? > > $ cat < prof.txt > kvm_pgtable_walk:100:10 > 2: 5 > 3: 5 > 5: 5 > 6: 5 > 10: 5 > 10: _kvm_pgtable_walk:50 > 5: 5 > 7: 5 > 10: 5 > 13.2: 5 > 14: 5 > 16: 5 __kvm_pgtable_walk:5 > 13: kvm_pgd_page_idx:30 > 2: __kvm_pgd_page_idx:30 > 2: 5 > 3: 5 > 5: 5 > 2: kvm_granule_shift:5 > 3: 5 > EOF > > $ make LLVM=1 ARCH=arm64 KCFLAGS=-fprofile-sample-use=prof.txt -j8 vmlinux Thanks, this was helpful, as I was able to reproduce the build failure. FWIW, it seems pretty easy to work around by filtering out the offending option, making it consistent with the mechanism we already use for tracing and the like. I came up with the hack below, which does the trick and is IMHO better than dropping the section (extra work) or adding the negation of this option (which depends on the compiler option evaluation order). M. diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile index 48f6ae7cc6e6..7df1b6afca7f 100644 --- a/arch/arm64/kvm/hyp/nvhe/Makefile +++ b/arch/arm64/kvm/hyp/nvhe/Makefile @@ -91,7 +91,7 @@ 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)) +KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_CFI) -fprofile-sample-use=%, $(KBUILD_CFLAGS)) # KVM nVHE code is run at a different exception code with a different map, so # compiler instrumentation that inserts callbacks or checks into the code may -- Without deviation from the norm, progress is not possible.