Skip to contentSkip to conversation

rtla/timerlat: Fix "Set OSNOISE_WORKLOAD for kernel threads"

PATCH In review Tomas Glozar 5 participants 12 messages Feb 28, 2025 – Mar 5, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

cover rtla/timerlat: Fix "Set OSNOISE_WORKLOAD for kernel threads"

Two rtla commits that fix a bug in setting OSNOISE_WORKLOAD (see the patches for details) were improperly backported to 6.6-stable, referencing non-existent field params->kernel_workload.

Revert the broken backports and backport this properly, using !params->user_hist and !params->user_top instead of the non-existent params->user_workload.

The patchset was tested to build and fix the bug.

Tomas Glozar (4):
Revert "rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads" Revert "rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads" rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

 tools/tracing/rtla/src/timerlat_hist.c | 2 +-
 tools/tracing/rtla/src/timerlat_top.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/4 Revert "rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads"

This reverts commit 41955b6c268154f81e34f9b61cf8156eec0730c0.

The commit breaks rtla build, since params->kernel_workload is not present on 6.6-stable.

---
 tools/tracing/rtla/src/timerlat_top.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
tools/tracing/rtla/src/timerlat_top.c +6 -9
index 1fed4c8d8520..832eb6ea6efe 100644
@@ -679,15 +679,12 @@ timerlat_top_apply_config(struct osnoise_tool *top, struct timerlat_top_params *
 		auto_house_keeping(&params->monitored_cpus);
 	}
 
-	/*
-	* Set workload according to type of thread if the kernel supports it.
-	* On kernels without support, user threads will have already failed
-	* on missing timerlat_fd, and kernel threads do not need it.
-	*/
-	retval = osnoise_set_workload(top->context, params->kernel_workload);
-	if (retval < -1) {
-		err_msg("Failed to set OSNOISE_WORKLOAD option\n");
-		goto out_err;
+	if (params->user_top) {
+		retval = osnoise_set_workload(top->context, 0);
+		if (retval) {
+			err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+			goto out_err;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.48.1
maintainer
#2 lore raw

Re: [PATCH 6.6 1/4] Revert "rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads"

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Could not find matching upstream commit

No upstream commit was identified. Using temporary commit for testing.

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
#3 lore raw

PATCH 2/4 Revert "rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads"

In reply to Tomas Glozar

This reverts commit 83b74901bdc9b58739193b8ee6989254391b6ba7.

The commit breaks rtla build, since params->kernel_workload is not present on 6.6-stable.

---
 tools/tracing/rtla/src/timerlat_hist.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
tools/tracing/rtla/src/timerlat_hist.c +6 -9
index a985e5795482..ab13a9392bff 100644
@@ -900,15 +900,12 @@ timerlat_hist_apply_config(struct osnoise_tool *tool, struct timerlat_hist_param
 		auto_house_keeping(&params->monitored_cpus);
 	}
 
-	/*
-	* Set workload according to type of thread if the kernel supports it.
-	* On kernels without support, user threads will have already failed
-	* on missing timerlat_fd, and kernel threads do not need it.
-	*/
-	retval = osnoise_set_workload(tool->context, params->kernel_workload);
-	if (retval < -1) {
-		err_msg("Failed to set OSNOISE_WORKLOAD option\n");
-		goto out_err;
+	if (params->user_hist) {
+		retval = osnoise_set_workload(tool->context, 0);
+		if (retval) {
+			err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+			goto out_err;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.48.1
maintainer
#4 lore raw

Re: [PATCH 6.6 2/4] Revert "rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads"

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
ℹ️ This is part 2/4 of a series
⚠️ Could not find matching upstream commit

No upstream commit was identified. Using temporary commit for testing.

NOTE: These results are for this patch alone. Full series testing will be performed when all parts are received.

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
#5 lore raw

PATCH 3/4 rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads

In reply to Tomas Glozar

commit d8d866171a414ed88bd0d720864095fd75461134 upstream.

When using rtla timerlat with userspace threads (-u or -U), rtla disables the OSNOISE_WORKLOAD option in /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a subsequent run with kernel-space threads, leading to rtla collecting no results if the previous run exited abnormally:

$ rtla timerlat hist -u
^\Quit (core dumped)
$ rtla timerlat hist -k -d 1s
Index
over:
count:
min:
avg:
max:
ALL:        IRQ       Thr       Usr
count:        0         0         0
min:          -         -         -
avg:          -         -         -
max:          -         -         -

The issue persists until OSNOISE_WORKLOAD is set manually by running:

$ echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options

Set OSNOISE_WORKLOAD when running rtla with kernel-space threads if available to fix the issue.

Cc John Kacur <[email protected]>
Cc Luis Goncalves <[email protected]>
Fixes ed774f7481fa ("rtla/timerlat_hist: Add timerlat user-space support")

[ params->kernel_workload does not exist in 6.6, use !params->user_hist ]

---
 tools/tracing/rtla/src/timerlat_hist.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
tools/tracing/rtla/src/timerlat_hist.c +9 -6
index ab13a9392bff..198cdf75c837 100644
@@ -900,12 +900,15 @@ timerlat_hist_apply_config(struct osnoise_tool *tool, struct timerlat_hist_param
 		auto_house_keeping(&params->monitored_cpus);
 	}
 
-	if (params->user_hist) {
-		retval = osnoise_set_workload(tool->context, 0);
-		if (retval) {
-			err_msg("Failed to set OSNOISE_WORKLOAD option\n");
-			goto out_err;
-		}
+	/*
+	* Set workload according to type of thread if the kernel supports it.
+	* On kernels without support, user threads will have already failed
+	* on missing timerlat_fd, and kernel threads do not need it.
+	*/
+	retval = osnoise_set_workload(tool->context, !params->user_hist);
+	if (retval < -1) {
+		err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+		goto out_err;
 	}
 
 	return 0;
Signature · 1 line
2.48.1
maintainer
#6 lore raw

Re: [PATCH 6.6 3/4] rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: d8d866171a414ed88bd0d720864095fd75461134

Note: The patch differs from the upstream commit:
---
1: d8d866171a414 ! 1: 2b6c95fecd276 rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
@@ Metadata
## Commit message ##
rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads

+ commit d8d866171a414ed88bd0d720864095fd75461134 upstream.
+
When using rtla timerlat with userspace threads (-u or -U), rtla disables the OSNOISE_WORKLOAD option in /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a
@@ Commit message

Fixes ed774f7481fa ("rtla/timerlat_hist: Add timerlat user-space support")

+ [ params->kernel_workload does not exist in 6.6, use
+ !params->user_hist ]
+ Signed-off-by: Tomas Glozar <[email protected]>

## tools/tracing/rtla/src/timerlat_hist.c ##
@@ tools/tracing/rtla/src/timerlat_hist.c: timerlat_hist_apply_config(struct osnoise_tool *tool, struct timerlat_hist_param
- }
+ auto_house_keeping(&params->monitored_cpus);
}

- if (params->user_hist) {
@@ tools/tracing/rtla/src/timerlat_hist.c: timerlat_hist_apply_config(struct osnois
+ * On kernels without support, user threads will have already failed
+ * on missing timerlat_fd, and kernel threads do not need it.
+ */
-+ retval = osnoise_set_workload(tool->context, params->kernel_workload);
++ retval = osnoise_set_workload(tool->context, !params->user_hist);
+ if (retval < -1) {
+ err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+ goto out_err;
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
#7 lore raw

PATCH 4/4 rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

In reply to Tomas Glozar

commit 217f0b1e990e30a1f06f6d531fdb4530f4788d48 upstream.

When using rtla timerlat with userspace threads (-u or -U), rtla disables the OSNOISE_WORKLOAD option in /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a subsequent run with kernel-space threads, leading to rtla collecting no results if the previous run exited abnormally:

$ rtla timerlat top -u
^\Quit (core dumped)
$ rtla timerlat top -k -d 1s
                                     Timer Latency
  0 00:00:01   |          IRQ Timer Latency (us)        |         Thread Timer Latency (us)
CPU COUNT      |      cur       min       avg       max |      cur       min       avg       max

The issue persists until OSNOISE_WORKLOAD is set manually by running:

$ echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options

Set OSNOISE_WORKLOAD when running rtla with kernel-space threads if available to fix the issue.

Cc John Kacur <[email protected]>
Cc Luis Goncalves <[email protected]>
Fixes cdca4f4e5e8e ("rtla/timerlat_top: Add timerlat user-space support")

[ params->kernel_workload does not exist in 6.6, use !params->user_top ]

---
 tools/tracing/rtla/src/timerlat_top.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
tools/tracing/rtla/src/timerlat_top.c +9 -6
index 832eb6ea6efe..7212855d3364 100644
@@ -679,12 +679,15 @@ timerlat_top_apply_config(struct osnoise_tool *top, struct timerlat_top_params *
 		auto_house_keeping(&params->monitored_cpus);
 	}
 
-	if (params->user_top) {
-		retval = osnoise_set_workload(top->context, 0);
-		if (retval) {
-			err_msg("Failed to set OSNOISE_WORKLOAD option\n");
-			goto out_err;
-		}
+	/*
+	* Set workload according to type of thread if the kernel supports it.
+	* On kernels without support, user threads will have already failed
+	* on missing timerlat_fd, and kernel threads do not need it.
+	*/
+	retval = osnoise_set_workload(top->context, !params->user_top);
+	if (retval < -1) {
+		err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+		goto out_err;
 	}
 
 	return 0;
Signature · 1 line
2.48.1
maintainer
#8 lore raw

Re: [PATCH 6.6 4/4] rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: 217f0b1e990e30a1f06f6d531fdb4530f4788d48

Note: The patch differs from the upstream commit:
---
1: 217f0b1e990e3 ! 1: c364e187bdf5b rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
@@ Metadata
## Commit message ##
rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

+ commit 217f0b1e990e30a1f06f6d531fdb4530f4788d48 upstream.
+
When using rtla timerlat with userspace threads (-u or -U), rtla disables the OSNOISE_WORKLOAD option in /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a
@@ Commit message

Fixes cdca4f4e5e8e ("rtla/timerlat_top: Add timerlat user-space support")

+ [ params->kernel_workload does not exist in 6.6, use
+ !params->user_top ]
+ Signed-off-by: Tomas Glozar <[email protected]>

## tools/tracing/rtla/src/timerlat_top.c ##
@@ tools/tracing/rtla/src/timerlat_top.c: timerlat_top_apply_config(struct osnoise_tool *top, struct timerlat_top_params *
- }
+ auto_house_keeping(&params->monitored_cpus);
}

- if (params->user_top) {
@@ tools/tracing/rtla/src/timerlat_top.c: timerlat_top_apply_config(struct osnoise_
+ * On kernels without support, user threads will have already failed
+ * on missing timerlat_fd, and kernel threads do not need it.
+ */
-+ retval = osnoise_set_workload(top->context, params->kernel_workload);
++ retval = osnoise_set_workload(top->context, !params->user_top);
+ if (retval < -1) {
+ err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+ goto out_err;
}

- if (isatty(STDOUT_FILENO) && !params->quiet)
+ return 0;
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
Acked-by on the v1 series
#9 lore raw
In reply to Tomas Glozar
Quoted 16 lines · On Fri, 28 Feb 2025 14:57:04 +0100 Tomas Glozar <[email protected]> wrote:

Two rtla commits that fix a bug in setting OSNOISE_WORKLOAD (see the patches for details) were improperly backported to 6.6-stable, referencing non-existent field params->kernel_workload.

Revert the broken backports and backport this properly, using !params->user_hist and !params->user_top instead of the non-existent params->user_workload.

The patchset was tested to build and fix the bug.

Tomas Glozar (4):
Revert "rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads" Revert "rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads" rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

Quoted 4 lines
 tools/tracing/rtla/src/timerlat_hist.c | 2 +-
 tools/tracing/rtla/src/timerlat_top.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Greg, can you pull these into 6.6?

Thanks,

-- Steve

#10 lore raw
Quoted 19 lines · Steven Rostedt
Quoted 16 lines · On Fri, 28 Feb 2025 14:57:04 +0100 Tomas Glozar <[email protected]> wrote:

Two rtla commits that fix a bug in setting OSNOISE_WORKLOAD (see the patches for details) were improperly backported to 6.6-stable, referencing non-existent field params->kernel_workload.

Revert the broken backports and backport this properly, using !params->user_hist and !params->user_top instead of the non-existent params->user_workload.

The patchset was tested to build and fix the bug.

Tomas Glozar (4):
Revert "rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads" Revert "rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads" rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

Quoted 8 lines
Quoted 4 lines
 tools/tracing/rtla/src/timerlat_hist.c | 2 +-
 tools/tracing/rtla/src/timerlat_top.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Greg, can you pull these into 6.6?

Will do, thanks.

greg k-h

Tested-by on the v1 series
#11 lore raw
In reply to Tomas Glozar
Quoted 16 lines · Tomas Glozar

Two rtla commits that fix a bug in setting OSNOISE_WORKLOAD (see the patches for details) were improperly backported to 6.6-stable, referencing non-existent field params->kernel_workload.

Revert the broken backports and backport this properly, using !params->user_hist and !params->user_top instead of the non-existent params->user_workload.

The patchset was tested to build and fix the bug.

Tomas Glozar (4):
Revert "rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads" Revert "rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads" rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads

Quoted 4 lines
 tools/tracing/rtla/src/timerlat_hist.c | 2 +-
 tools/tracing/rtla/src/timerlat_top.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Thanks for a quick fix, it now builds again and the tool appears to work.

With kind regards,
Jan