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@xxxxxxxxxx> wrote: > > On Tue, Oct 15, 2024 at 6:33 AM Rong Xu <xur@xxxxxxxxxx> 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