Skip to content

Commit

Permalink
pgo: rename the raw profile file to vmlinux.profraw
Browse files Browse the repository at this point in the history
Future PGO features may create other files in /sys/kernel/debug/pgo. So
rename the kernel's raw profile data file to "vmlinux.profraw" to make
which part of the kernel the file is for more explicit.

Note that future files in /sys/kernel/debug/pgo should follow a similar
naming convention.

Signed-off-by: Bill Wendling <morbo@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210531202044.426578-1-morbo@google.com
  • Loading branch information
bwendling authored and kees committed Jun 1, 2021
1 parent 9c783b6 commit 5d0cda6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Documentation/dev-tools/pgo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The PGO kernel support creates the following files in debugfs:
``/sys/kernel/debug/pgo/reset``
Global reset file: resets all coverage data to zero when written to.

``/sys/kernel/debug/profraw``
``/sys/kernel/debug/pgo/vmlinux.profraw``
The raw PGO data that must be processed with ``llvm_profdata``.


Expand Down Expand Up @@ -108,7 +108,7 @@ using the result to optimize the kernel:

.. code-block:: sh
$ cp -a /sys/kernel/debug/pgo/profraw /tmp/vmlinux.profraw
$ cp -a /sys/kernel/debug/pgo/vmlinux.profraw /tmp/vmlinux.profraw
5) (Optional) Download the raw profile data to the HOST machine.

Expand All @@ -120,7 +120,7 @@ using the result to optimize the kernel:
Note that multiple raw profile data files can be merged during this step.

7) Rebuild the kernel using the profile data (PGO disabled)
7) Rebuild the kernel using the processed profile data (PGO disabled)

.. code-block:: sh
Expand Down
7 changes: 4 additions & 3 deletions kernel/pgo/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ config PGO_CLANG

Run a representative workload for your application on a kernel
compiled with this option and download the raw profile file from
/sys/kernel/debug/pgo/profraw. This file needs to be processed with
llvm-profdata. It may be merged with other collected raw profiles.
/sys/kernel/debug/pgo/vmlinux.profraw. This file needs to be
processed with llvm-profdata. It may be merged with other collected
raw profiles.

Copy the resulting profile file into vmlinux.profdata, and enable
Copy the processed profile file into vmlinux.profdata, and enable
KCFLAGS=-fprofile-use=vmlinux.profdata to produce an optimized
kernel.

Expand Down
2 changes: 1 addition & 1 deletion kernel/pgo/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static int __init pgo_init(void)
if (!directory)
goto err_remove;

if (!debugfs_create_file("profraw", 0600, directory, NULL,
if (!debugfs_create_file("vmlinux.profraw", 0600, directory, NULL,
&prf_fops))
goto err_remove;

Expand Down

0 comments on commit 5d0cda6

Please sign in to comment.