linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Denis Nikitin <denik@chromium.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	David Brazdil <dbrazdil@google.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	Manoj Gupta <manojgupta@google.com>
Subject: Re: [PATCH v2] KVM: arm64: nvhe: Fix build with profile optimization
Date: Thu, 13 Oct 2022 12:09:00 +0100	[thread overview]
Message-ID: <86fsfsf0ab.wl-maz@kernel.org> (raw)
In-Reply-To: <CADDJ8CVX5tZU9jL4FvTnvQxxVohhS76TVOoZAyy3k_Uit1efmA@mail.gmail.com>

On Tue, 11 Oct 2022 03:15:36 +0100,
Denis Nikitin <denik@chromium.org> wrote:
> 
> On Sat, Oct 8, 2022 at 7:22 PM Marc Zyngier <maz@kernel.org> wrote:
> >
> > On Thu, 06 Oct 2022 17:28:17 +0100,
> > Denis Nikitin <denik@chromium.org> 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 <<EOF > 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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-10-13 11:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  8:20 [PATCH] KVM: arm64: nvhe: Disable profile optimization Denis Nikitin
2022-09-20  9:33 ` Marc Zyngier
2022-09-21  0:08   ` Denis Nikitin
2022-09-21  6:02     ` Denis Nikitin
2022-09-21 17:25       ` Marc Zyngier
2022-09-22  5:31 ` [PATCH v2] KVM: arm64: nvhe: Fix build with " Denis Nikitin
2022-09-22 10:37   ` Marc Zyngier
2022-09-23  5:01     ` Denis Nikitin
     [not found]       ` <CAH=Qcsi3aQ51AsAE0WmAH9VmpqjOaQQt=ru5Nav4+d8F3fMPwQ@mail.gmail.com>
2022-09-29 16:13         ` Denis Nikitin
2022-10-06 16:28           ` Denis Nikitin
2022-10-09  2:20             ` Marc Zyngier
2022-10-11  2:15               ` Denis Nikitin
2022-10-13 11:09                 ` Marc Zyngier [this message]
2022-10-13 19:02                   ` Denis Nikitin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86fsfsf0ab.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dbrazdil@google.com \
    --cc=denik@chromium.org \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manojgupta@google.com \
    --cc=ndesaulniers@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).