[RFC PATCH 0/5] pgo: Add PGO support for module profile data

From: Jarmo Tiitto
Date: Fri Jun 11 2021 - 23:36:46 EST


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.

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.

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