public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Jarmo Tiitto <jarmo.tiitto@gmail.com>
Cc: Sami Tolvanen <samitolvanen@google.com>,
	Bill Wendling <wcw@google.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	morbo@google.com
Subject: Re: [RFC PATCH 0/5] pgo: Add PGO support for module profile data
Date: Mon, 14 Jun 2021 09:05:40 -0700	[thread overview]
Message-ID: <202106140904.484E2337C@keescook> (raw)
In-Reply-To: <20210612032425.11425-1-jarmo.tiitto@gmail.com>

[oops, I failed to CC correctly -- resending]

On Sat, Jun 12, 2021 at 06:24:21AM +0300, Jarmo Tiitto wrote:
> This patch series intends to extend the current Clang PGO code to
> support profile data from modules. Note that current PGO can and *does* 
> instrument all kernel code, including modules, but this profile data
> is inaccessible.
> 
> This patch series adds pgo/<module>.profraw files from what
> per loaded module profile data can be read.
> 
> The final profile can be generated by merging all these profile files:
> llvm-profdata merge --output=vmlinux.profdata vmlinux.profraw ...
> and then building the optimized kernel.
> 
> This v2 patch series is still an bit of RFC so I'd like feedback how
> to do things better still.

This looks pretty good; thank you! I sent some notes, which are mostly
just clean-ups and patch hunk moves.

> The patches itself are based on Kees/for-next/clang/features tree
> where I have two of my bug fix patches already in. :-)
> 
> I have done some initial testing:
>  * Booted the instrumented kernel on qemu *and* bare hardware.
>  * Module un/loading via test_module in QEMU.
>  * Built optimized kernel using the new profile data.

If you haven't already, can you also test this with lock testing
enabled? i.e. these configs:

# Detect potential deadlocks.
CONFIG_PROVE_LOCKING=y
# Detect sleep-while-atomic.
CONFIG_DEBUG_ATOMIC_SLEEP=y

Thanks!

-Kees

> 
> Jarmo Tiitto (5):
>   pgo: Expose module sections for clang PGO instumentation.
>   pgo: Make serializing functions to take prf_object
>   pgo: Wire up the new more generic code for modules
>   pgo: Add module notifier machinery
>   pgo: Cleanup code in pgo/fs.c
> 
>  include/linux/module.h  |  15 +++
>  kernel/Makefile         |   6 +
>  kernel/module.c         |   7 ++
>  kernel/pgo/fs.c         | 241 ++++++++++++++++++++++++++++++++++------
>  kernel/pgo/instrument.c |  57 +++++++---
>  kernel/pgo/pgo.h        |  85 ++++++++++----
>  6 files changed, 342 insertions(+), 69 deletions(-)
> 
> 
> base-commit: 0039303120c0065f3952698597e0c9916b76ebd5
> -- 
> 2.32.0
> 

-- 
Kees Cook

  parent reply	other threads:[~2021-06-14 16:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12  3:24 [RFC PATCH 0/5] pgo: Add PGO support for module profile data Jarmo Tiitto
2021-06-12  3:24 ` [RFC PATCH 1/5] pgo: Expose module sections for clang PGO instumentation Jarmo Tiitto
2021-06-12  3:24 ` [RFC PATCH 2/5] pgo: Make serializing functions to take prf_object Jarmo Tiitto
2021-06-12  3:24 ` [RFC PATCH 3/5] pgo: Wire up the new more generic code for modules Jarmo Tiitto
2021-06-14 15:55   ` Kees Cook
2021-06-14 19:08     ` jarmo.tiitto
2021-06-12  3:24 ` [RFC PATCH 4/5] pgo: Add module notifier machinery Jarmo Tiitto
2021-06-14 16:00   ` Kees Cook
2021-06-14 18:31     ` jarmo.tiitto
2021-06-12  3:24 ` [RFC PATCH 5/5] pgo: Cleanup code in pgo/fs.c Jarmo Tiitto
2021-06-14 15:50   ` Kees Cook
2021-06-14 16:05 ` Kees Cook [this message]
2021-06-14 21:57   ` [RFC PATCH 0/5] pgo: Add PGO support for module profile data Kees Cook
2021-06-14 22:27     ` jarmo.tiitto

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=202106140904.484E2337C@keescook \
    --to=keescook@chromium.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jarmo.tiitto@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=samitolvanen@google.com \
    --cc=wcw@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