[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQ5yNKvZDtJuvo9Lt4rZwLSv0UN4=Ff=WcCDy1CCEpQ7Q@mail.gmail.com>
Date: Mon, 21 Oct 2024 01:32:54 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Rong Xu <xur@...gle.com>
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
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'.
> +
> +- 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:
> + (https://github.com/google/autofdo), version v0.30.1 or later.
Please one space instead of two after the comma.
> 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.
> +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_*.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists