Skip to contentSkip to conversation

pgo: rename the raw profile file to vmlinux.profraw

PATCH Applied Bill Wendling 4 participants 7 messages May 31, 2021 – Jun 1, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pgo: rename the raw profile file to vmlinux.profraw

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.

---
 Documentation/dev-tools/pgo.rst | 6 +++---
 kernel/pgo/Kconfig              | 7 ++++---
 kernel/pgo/fs.c                 | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)
Documentation/dev-tools/pgo.rst +3 -3
index b7f11d8405b7..0200449c4843 100644
@@ -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``.
 
 
@@ -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.
 
@@ -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
 
kernel/pgo/Kconfig +4 -3
index 76a640b6cf6e..d2053df1111c 100644
@@ -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.
 
kernel/pgo/fs.c +1 -1
index 449f16beb2cf..ef985159dad3 100644
@@ -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;
 
Signature · 1 line
2.32.0.rc0.204.g9fa02ecfa5-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bill Wendling

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.

Guess this clears up my confusion around the module patches :)

Quoted 70 lines
---
  Documentation/dev-tools/pgo.rst | 6 +++---
  kernel/pgo/Kconfig              | 7 ++++---
  kernel/pgo/fs.c                 | 2 +-
  3 files changed, 8 insertions(+), 7 deletions(-)
Documentation/dev-tools/pgo.rst +3 -3
index b7f11d8405b7..0200449c4843 100644
@@ -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``.
 
 
@@ -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.
 
@@ -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
 
kernel/pgo/Kconfig +4 -3
index 76a640b6cf6e..d2053df1111c 100644
@@ -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.
 
kernel/pgo/fs.c +1 -1
index 449f16beb2cf..ef985159dad3 100644
@@ -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;
 
#2 lore raw
Quoted 6 lines · Nathan Chancellor
Quoted 4 lines · Bill Wendling

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.

Quoted 7 lines
Quoted 4 lines

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

Guess this clears up my confusion around the module patches :)

To clarify, Jarmo did those patches on his own. I just wanted to clarify the naming convention. :-)

-bw

Quoted 72 lines
Quoted 70 lines
---
  Documentation/dev-tools/pgo.rst | 6 +++---
  kernel/pgo/Kconfig              | 7 ++++---
  kernel/pgo/fs.c                 | 2 +-
  3 files changed, 8 insertions(+), 7 deletions(-)
Documentation/dev-tools/pgo.rst +3 -3
index b7f11d8405b7..0200449c4843 100644
@@ -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``.
 
 
@@ -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.
 
@@ -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
 
kernel/pgo/Kconfig +4 -3
index 76a640b6cf6e..d2053df1111c 100644
@@ -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.
 
kernel/pgo/fs.c +1 -1
index 449f16beb2cf..ef985159dad3 100644
@@ -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;
 
#3 lore raw
Quoted 10 lines · Bill Wendling' via Clang Built Linux
Quoted 9 lines · Nathan Chancellor
Quoted 7 lines · Bill Wendling

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.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Guess this clears up my confusion around the module patches :)

To clarify, Jarmo did those patches on his own. I just wanted to clarify the naming convention. :-)

Is the expectation that there would be 1 file per module in /sys/kernel/debug/pgo/ after the modules patch?

Quoted 24 lines

-bw

Quoted 21 lines
Quoted 19 lines
---
  Documentation/dev-tools/pgo.rst | 6 +++---
  kernel/pgo/Kconfig              | 7 ++++---
  kernel/pgo/fs.c                 | 2 +-
  3 files changed, 8 insertions(+), 7 deletions(-)
Documentation/dev-tools/pgo.rst +1 -1
index b7f11d8405b7..0200449c4843 100644
@@ -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``.
 
 
Quoted 6 lines
Quoted 6 lines

Documentation/dev-tools/pgo.rst using the result to optimize the kernel: · line 111

Quoted 6 lines
Documentation/dev-tools/pgo.rst +1 -1
@@ -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

And if so, these instructions would change (in the future) to something like:

     $ cp -a /sys/kernel/debug/pgo/*.profraw /tmp/prof/

?

-Kees

Signature · 1 line
Kees Cook
#4 lore raw

Kees Cook wrote tiistaina 1. kesäkuuta 2021 22.13.21 EEST:

Quoted 1 line

On Tue, Jun 01, 2021 at 01:24:39AM -0700, 'Bill Wendling' via Clang Built

Quoted 1 line · Linux
Quoted 1 line

On Mon, May 31, 2021 at 1:29 PM Nathan Chancellor <[email protected]>

Quoted 31 lines · wrote:
Quoted 10 lines
Quoted 10 lines · Bill Wendling
Quoted 9 lines

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Guess this clears up my confusion around the module patches :)

To clarify, Jarmo did those patches on his own. I just wanted to clarify the naming convention. :-)

Is the expectation that there would be 1 file per module in /sys/kernel/debug/pgo/ after the modules patch?

Quoted 11 lines

-bw

Quoted 9 lines
Quoted 7 lines

---

  Documentation/dev-tools/pgo.rst | 6 +++---
  kernel/pgo/Kconfig              | 7 ++++---
  kernel/pgo/fs.c                 | 2 +-
  3 files changed, 8 insertions(+), 7 deletions(-)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Documentation/dev-tools/pgo.rst The PGO kernel support creates the following files in

Quoted 7 lines
(quoted diff) +0 -0

b/Documentation/dev-tools/pgo.rst index b7f11d8405b7..0200449c4843 100644

Documentation/dev-tools/pgo.rst +0 -0
@@ -76,7 +76,7 @@ The PGO kernel support creates the following files in 

debugfs:

Quoted 20 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/dev-tools/pgo.rst +1 -1
  ``/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``
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The raw PGO data that must be processed with ``llvm_profdata``.

Documentation/dev-tools/pgo.rst +1 -1
@@ -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

And if so, these instructions would change (in the future) to something like:

Quoted 5 lines
     $ cp -a /sys/kernel/debug/pgo/*.profraw /tmp/prof/

?

-Kees

Hi,

To be clear the mucked up patches I sent are more like of RFC to get in contact with the development.
Back to the code:

Yes, my future intention is that there will be one *.profraw file per module. And curiously I would also have renamed the current profile data file to "vmlinux.profraw" to disambiguate it from what part of kernel generated it.

I already wrote an small fix up that I think should be part of the upstream code so that profiling the vmlinux works better.
It filters out any module originated content from vmlinux.profraw.

Above will be probably a good exercise for me.

Next, my future v2 module profiling machinery
would probably follow on top of your work.

-Jarmo

#5 lore raw
Quoted 4 lines · On Wed, Jun 02, 2021 at 12:40:25AM +0300, [email protected] wrote:

Yes, my future intention is that there will be one *.profraw file per module. And curiously I would also have renamed the current profile data file to "vmlinux.profraw" to disambiguate it from what part of kernel generated it.

Quoted 8 lines

I already wrote an small fix up that I think should be part of the upstream code so that profiling the vmlinux works better.
It filters out any module originated content from vmlinux.profraw.

Above will be probably a good exercise for me.

Next, my future v2 module profiling machinery
would probably follow on top of your work.

Okay, great; thanks for digging into it! :)

Signature · 1 line
Kees Cook
Applied
#6 lore raw
In reply to Bill Wendling
Quoted 6 lines · Bill Wendling

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.

Applied to for-next/clang/features, thanks!

[1/1] pgo: rename the raw profile file to vmlinux.profraw

      https://git.kernel.org/kees/c/001eaf3fd0e3
Signature · 1 line
Kees Cook