[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF1bQ=Syxi46xnGbpZWhYfqKhQZqrBPPh5FGaqzmJTg6MMDJSA@mail.gmail.com>
Date: Mon, 21 Oct 2024 15:43:22 -0700
From: Rong Xu <xur@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>, Bill Wendling <morbo@...gle.com>, Borislav Petkov <bp@...en8.de>,
Breno Leitao <leitao@...ian.org>, Brian Gerst <brgerst@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, David Li <davidxl@...gle.com>,
Han Shen <shenhan@...gle.com>, Heiko Carstens <hca@...ux.ibm.com>, "H. Peter Anvin" <hpa@...or.com>,
Ingo Molnar <mingo@...hat.com>, Jann Horn <jannh@...gle.com>, Jonathan Corbet <corbet@....net>,
Josh Poimboeuf <jpoimboe@...nel.org>, Juergen Gross <jgross@...e.com>,
Justin Stitt <justinstitt@...gle.com>, Kees Cook <kees@...nel.org>,
"Mike Rapoport (IBM)" <rppt@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>, Nicolas Schier <nicolas@...sle.eu>,
"Paul E. McKenney" <paulmck@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Sami Tolvanen <samitolvanen@...gle.com>, Thomas Gleixner <tglx@...utronix.de>,
Wei Yang <richard.weiyang@...il.com>, workflows@...r.kernel.org,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Maksim Panchenko <max4bolt@...il.com>, x86@...nel.org,
linux-arch@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, Sriraman Tallam <tmsriram@...gle.com>,
Krzysztof Pszeniczny <kpszeniczny@...gle.com>, Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v4 1/6] Add AutoFDO support for Clang build
Thanks for the detailed suggestions! My comments are inlined below.
Best regards,
-Rong
On Sun, Oct 20, 2024 at 9:33 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> On Tue, Oct 15, 2024 at 6:33 AM Rong Xu <xur@...gle.com> wrote:
>
>
> > +Customization
> > +=============
> > +
> > +You can enable or disable AutoFDO build for individual file and directories by
> > +adding a line similar to the following to the respective kernel Makefile:
>
>
> Perhaps, it might be worth mentioning that kernel space objects are
> covered by default.
>
> Then, people would understand ':= y' will be less common than ':= n'.
>
Good point! How about I change to the following:
"
The default CONFIG_AUTOFDO_CLANG setting covers kernel space objects for
AutoFDO builds. One can, however, enable or disable AutoFDO build for
individual file and directories by adding a line similar to the following
to the respective kernel Makefile ...
>
>
>
> > +
> > +- For enabling a single file (e.g. foo.o) ::
> > +
> > + AUTOFDO_PROFILE_foo.o := y
> > +
> > +- For enabling all files in one directory ::
> > +
> > + AUTOFDO_PROFILE := y
> > +
> > +- For disabling one file ::
> > +
> > + AUTOFDO_PROFILE_foo.o := n
> > +
> > +- For disabling all files in one directory ::
> > +
> > + AUTOFDO_PROFILE := n
> > +
>
>
>
>
> > +3) Run the load tests. The '-c' option in perf specifies the sample
> > + event period. We suggest using a suitable prime number, like 500009,
> > + for this purpose.
> > +
> > + - For Intel platforms::
> > +
> > + $ perf record -e BR_INST_RETIRED.NEAR_TAKEN:k -a -N -b -c <count> -o <perf_file> -- <loadtest>
> > +
> > + - For AMD platforms: For Intel platforms:
>
>
> I guess this is a copy-paste mistake.
>
>
> For AMD platforms: For Intel platforms:
>
> ->
>
> For AMD platforms:
Thanks for catching this! Will fix this.
>
>
>
>
>
>
> > + (https://github.com/google/autofdo), version v0.30.1 or later.
>
>
> Please one space instead of two after the comma.
>
Will fix it.
>
>
>
>
>
>
> > diff --git a/scripts/Makefile.autofdo b/scripts/Makefile.autofdo
> > new file mode 100644
> > index 000000000000..1c9f224bc221
> > --- /dev/null
> > +++ b/scripts/Makefile.autofdo
> > @@ -0,0 +1,23 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +# Enable available and selected Clang AutoFDO features.
> > +
> > +CFLAGS_AUTOFDO_CLANG := -fdebug-info-for-profiling -mllvm -enable-fs-discriminator=true -mllvm -improved-fs-discriminator=true
> > +
> > +# If CONFIG_DEBUG_INFO is not enabled, set -gmlt option.
>
>
> Meaningless comment. It explains too obvious code.
Will remove this line of comment.
>
>
> > +ifndef CONFIG_DEBUG_INFO
> > + CFLAGS_AUTOFDO_CLANG += -gmlt
> > +endif
>
>
>
>
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 01a9f567d5af..e85d6ac31bd9 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -191,6 +191,16 @@ _c_flags += $(if $(patsubst n%,, \
> > -D__KCSAN_INSTRUMENT_BARRIERS__)
> > endif
> >
> > +#
> > +# Enable Clang's AutoFDO build flags for a file or directory depending on
> > +# variables AUTOFDO_PROFILE_obj.o and AUTOFDO_PROFILE.
> > +#
>
>
> This comment would give the wrong understanding that this flag is opt-in.
>
>
> The comment for KASAN correctly describes that it is enabled by default,
> and can be opted out using KASAN_SANITIZE_*.
>
I can change to use KASAN's expression:
"
# Enable Clang's AutoFDO build flags for kernel except some files or directories
# we don't want to enable (depends on variables AUTOFDO_PROFILE_obj.o
and AUTOFDO_PROFILE)
"
>
>
>
>
> --
> Best Regards
>
>
> Masahiro Yamada
Powered by blists - more mailing lists