From: Will Deacon <will@kernel.org>
To: Yabin Cui <yabinc@google.com>
Cc: Rong Xu <xur@google.com>, Han Shen <shenhan@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Catalin Marinas <catalin.marinas@arm.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Kees Cook <kees@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
workflows@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] arm64: Allow CONFIG_AUTOFDO_CLANG to be selected
Date: Mon, 9 Dec 2024 16:20:29 +0000 [thread overview]
Message-ID: <20241209162028.GD12428@willie-the-truck> (raw)
In-Reply-To: <20241118222540.27495-1-yabinc@google.com>
On Mon, Nov 18, 2024 at 02:25:40PM -0800, Yabin Cui wrote:
> Select ARCH_SUPPORTS_AUTOFDO_CLANG to allow AUTOFDO_CLANG to be
> selected.
>
> On ARM64, ETM traces can be recorded and converted to AutoFDO profiles.
> Experiments on Android show 4% improvement in cold app startup time
> and 13% improvement in binder benchmarks.
>
> Signed-off-by: Yabin Cui <yabinc@google.com>
> ---
>
> Change-Logs in V2:
>
> 1. Use "For ARM platforms with ETM trace" in autofdo.rst.
> 2. Create an issue and a change to use extbinary format in instructions:
> https://github.com/Linaro/OpenCSD/issues/65
> https://android-review.googlesource.com/c/platform/system/extras/+/3362107
>
> Documentation/dev-tools/autofdo.rst | 18 +++++++++++++++++-
> arch/arm64/Kconfig | 1 +
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/dev-tools/autofdo.rst b/Documentation/dev-tools/autofdo.rst
> index 1f0a451e9ccd..a890e84a2fdd 100644
> --- a/Documentation/dev-tools/autofdo.rst
> +++ b/Documentation/dev-tools/autofdo.rst
> @@ -55,7 +55,7 @@ process consists of the following steps:
> workload to gather execution frequency data. This data is
> collected using hardware sampling, via perf. AutoFDO is most
> effective on platforms supporting advanced PMU features like
> - LBR on Intel machines.
> + LBR on Intel machines, ETM traces on ARM machines.
>
> #. AutoFDO profile generation: Perf output file is converted to
> the AutoFDO profile via offline tools.
> @@ -141,6 +141,22 @@ Here is an example workflow for AutoFDO kernel:
>
> $ perf record --pfm-events RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a -N -b -c <count> -o <perf_file> -- <loadtest>
>
> + - For ARM platforms with ETM trace:
> +
> + Follow the instructions in the `Linaro OpenCSD document
> + https://github.com/Linaro/OpenCSD/blob/master/decoder/tests/auto-fdo/autofdo.md`_
> + to record ETM traces for AutoFDO::
> +
> + $ perf record -e cs_etm/@tmc_etr0/k -a -o <etm_perf_file> -- <loadtest>
> + $ perf inject -i <etm_perf_file> -o <perf_file> --itrace=i500009il
> +
> + For ARM platforms running Android, follow the instructions in the
> + `Android simpleperf document
> + <https://android.googlesource.com/platform/system/extras/+/main/simpleperf/doc/collect_etm_data_for_autofdo.md>`_
> + to record ETM traces for AutoFDO::
> +
> + $ simpleperf record -e cs-etm:k -a -o <perf_file> -- <loadtest>
> +
> 4) (Optional) Download the raw perf file to the host machine.
>
> 5) To generate an AutoFDO profile, two offline tools are available:
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index fd9df6dcc593..c3814df5e391 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -103,6 +103,7 @@ config ARM64
> select ARCH_SUPPORTS_PER_VMA_LOCK
> select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
> select ARCH_SUPPORTS_RT
> + select ARCH_SUPPORTS_AUTOFDO_CLANG
> select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
> select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
> select ARCH_WANT_DEFAULT_BPF_JIT
After this change, both arm64 and x86 select this option unconditionally
and with no apparent support code being added. So what is actually
required in order to select ARCH_SUPPORTS_AUTOFDO_CLANG and why isn't
it just available for all architectures instead?
Will
next prev parent reply other threads:[~2024-12-09 16:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 22:25 Yabin Cui
2024-11-18 23:49 ` Rong Xu
2024-11-20 0:04 ` Yabin Cui
2024-11-20 15:54 ` George Burgess
2024-11-20 17:59 ` Kees Cook
2024-12-09 16:20 ` Will Deacon [this message]
2024-12-09 17:30 ` Rong Xu
2024-12-09 18:56 ` Will Deacon
2024-12-09 23:51 ` Yabin Cui
2024-12-10 11:31 ` Will Deacon
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=20241209162028.GD12428@willie-the-truck \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=kees@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=ndesaulniers@google.com \
--cc=shenhan@google.com \
--cc=workflows@vger.kernel.org \
--cc=xur@google.com \
--cc=yabinc@google.com \
/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