[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202104071419.AA35EEAF@keescook>
Date: Wed, 7 Apr 2021 14:22:47 -0700
From: Kees Cook <keescook@...omium.org>
To: Bill Wendling <morbo@...gle.com>,
Masahiro Yamada <masahiroy@...nel.org>
Cc: Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org,
clang-built-linux@...glegroups.com,
Andrew Morton <akpm@...ux-foundation.org>,
Nathan Chancellor <natechancellor@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Fangrui Song <maskray@...gle.com>
Subject: Re: [PATCH v9] pgo: add clang's Profile Guided Optimization
infrastructure
On Wed, Apr 07, 2021 at 02:17:04PM -0700, 'Bill Wendling' via Clang Built Linux wrote:
> From: Sami Tolvanen <samitolvanen@...gle.com>
>
> Enable the use of clang's Profile-Guided Optimization[1]. To generate a
> profile, the kernel is instrumented with PGO counters, a representative
> workload is run, and the raw profile data is collected from
> /sys/kernel/debug/pgo/profraw.
>
> The raw profile data must be processed by clang's "llvm-profdata" tool
> before it can be used during recompilation:
>
> $ cp /sys/kernel/debug/pgo/profraw vmlinux.profraw
> $ llvm-profdata merge --output=vmlinux.profdata vmlinux.profraw
>
> Multiple raw profiles may be merged during this step.
>
> The data can now be used by the compiler:
>
> $ make LLVM=1 KCFLAGS=-fprofile-use=vmlinux.profdata ...
>
> This initial submission is restricted to x86, as that's the platform we
> know works. This restriction can be lifted once other platforms have
> been verified to work with PGO.
>
> Note that this method of profiling the kernel is clang-native, unlike
> the clang support in kernel/gcov.
>
> [1] https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization
>
> Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>
> Co-developed-by: Bill Wendling <morbo@...gle.com>
> Signed-off-by: Bill Wendling <morbo@...gle.com>
> Tested-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Reviewed-by: Fangrui Song <maskray@...gle.com>
Thanks for sending this again! I'm looking forward to using it.
Masahiro and Andrew, unless one of you would prefer to take this in your
tree, I figure I can snag it to send to Linus.
Anyone else have feedback?
Thanks!
-Kees
--
Kees Cook
Powered by blists - more mailing lists