* [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads
@ 2025-01-07 14:48 Tomas Glozar
2025-01-07 14:48 ` [PATCH 1/3] rtla/osnoise: Distinguish missing workload option Tomas Glozar
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Tomas Glozar @ 2025-01-07 14:48 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-trace-kernel, linux-kernel, John Kacur, Luis Goncalves,
Tomas Glozar
The patchset makes both rtla-timerlat-hist and rtla-timerlat-top set
OSNOISE_WORKLOAD to the proper value ("on" when running with -k, "off"
when running with -u) every time the option is available instead of setting it
only when running with -u.
This prevents rtla timerlat -k from giving no results when
NO_OSNOISE_WORKLOAD is set, either manually or by an abnormally exited earlier
run of rtla timerlat -u.
osnoise_set_workload is made to distinguish between the option missing
altogether and it failing to be set. In the first case, rtla-timerlat will
ignore setting the option to preserve compatibility of kernel-thread mode
on older kernels without the OSNOISE_WORKLOAD option.
Tomas Glozar (3):
rtla/osnoise: Distinguish missing workload option
rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
tools/tracing/rtla/src/osnoise.c | 2 +-
tools/tracing/rtla/src/timerlat_hist.c | 15 +++++++++------
tools/tracing/rtla/src/timerlat_top.c | 15 +++++++++------
3 files changed, 19 insertions(+), 13 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] rtla/osnoise: Distinguish missing workload option
2025-01-07 14:48 [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
@ 2025-01-07 14:48 ` Tomas Glozar
2025-01-07 14:48 ` [PATCH 2/3] rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Tomas Glozar @ 2025-01-07 14:48 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-trace-kernel, linux-kernel, John Kacur, Luis Goncalves,
Tomas Glozar
osnoise_set_workload returns -1 for both missing OSNOISE_WORKLOAD option
and failure in setting the option.
Return -1 for missing and -2 for failure to distinguish them.
Cc: stable@vger.kernel.org
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/src/osnoise.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/tracing/rtla/src/osnoise.c b/tools/tracing/rtla/src/osnoise.c
index 245e9344932b..699a83f538a8 100644
--- a/tools/tracing/rtla/src/osnoise.c
+++ b/tools/tracing/rtla/src/osnoise.c
@@ -867,7 +867,7 @@ int osnoise_set_workload(struct osnoise_context *context, bool onoff)
retval = osnoise_options_set_option("OSNOISE_WORKLOAD", onoff);
if (retval < 0)
- return -1;
+ return -2;
context->opt_workload = onoff;
--
2.47.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
2025-01-07 14:48 [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
2025-01-07 14:48 ` [PATCH 1/3] rtla/osnoise: Distinguish missing workload option Tomas Glozar
@ 2025-01-07 14:48 ` Tomas Glozar
2025-01-07 14:48 ` [PATCH 3/3] rtla/timerlat_top: " Tomas Glozar
2025-01-07 21:44 ` [PATCH 0/3] rtla/timerlat: " Steven Rostedt
3 siblings, 0 replies; 6+ messages in thread
From: Tomas Glozar @ 2025-01-07 14:48 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-trace-kernel, linux-kernel, John Kacur, Luis Goncalves,
Tomas Glozar
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: stable@vger.kernel.org
Fixes: ed774f7481fa ("rtla/timerlat_hist: Add timerlat user-space support")
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/src/timerlat_hist.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 4403cc4eba30..66dbc034bdc7 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -1100,12 +1100,15 @@ timerlat_hist_apply_config(struct osnoise_tool *tool, struct timerlat_hist_param
}
}
- 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->kernel_workload);
+ if (retval < -1) {
+ err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+ goto out_err;
}
return 0;
--
2.47.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
2025-01-07 14:48 [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
2025-01-07 14:48 ` [PATCH 1/3] rtla/osnoise: Distinguish missing workload option Tomas Glozar
2025-01-07 14:48 ` [PATCH 2/3] rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
@ 2025-01-07 14:48 ` Tomas Glozar
2025-01-07 21:44 ` [PATCH 0/3] rtla/timerlat: " Steven Rostedt
3 siblings, 0 replies; 6+ messages in thread
From: Tomas Glozar @ 2025-01-07 14:48 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-trace-kernel, linux-kernel, John Kacur, Luis Goncalves,
Tomas Glozar
Apply fix from previous commit also to timerlat-top.
Cc: stable@vger.kernel.org
Fixes: cdca4f4e5e8e ("rtla/timerlat_top: Add timerlat user-space support")
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/src/timerlat_top.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 059b468981e4..521f9822e747 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -851,12 +851,15 @@ timerlat_top_apply_config(struct osnoise_tool *top, struct timerlat_top_params *
}
}
- 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->kernel_workload);
+ if (retval < -1) {
+ err_msg("Failed to set OSNOISE_WORKLOAD option\n");
+ goto out_err;
}
if (isatty(STDOUT_FILENO) && !params->quiet)
--
2.47.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads
2025-01-07 14:48 [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
` (2 preceding siblings ...)
2025-01-07 14:48 ` [PATCH 3/3] rtla/timerlat_top: " Tomas Glozar
@ 2025-01-07 21:44 ` Steven Rostedt
2025-01-09 9:50 ` Tomas Glozar
3 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2025-01-07 21:44 UTC (permalink / raw)
To: Tomas Glozar; +Cc: linux-trace-kernel, linux-kernel, John Kacur, Luis Goncalves
On Tue, 7 Jan 2025 15:48:20 +0100
Tomas Glozar <tglozar@redhat.com> wrote:
> The patchset makes both rtla-timerlat-hist and rtla-timerlat-top set
> OSNOISE_WORKLOAD to the proper value ("on" when running with -k, "off"
> when running with -u) every time the option is available instead of setting it
> only when running with -u.
>
> This prevents rtla timerlat -k from giving no results when
> NO_OSNOISE_WORKLOAD is set, either manually or by an abnormally exited earlier
> run of rtla timerlat -u.
>
> osnoise_set_workload is made to distinguish between the option missing
> altogether and it failing to be set. In the first case, rtla-timerlat will
> ignore setting the option to preserve compatibility of kernel-thread mode
> on older kernels without the OSNOISE_WORKLOAD option.
>
> Tomas Glozar (3):
> rtla/osnoise: Distinguish missing workload option
> rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
> rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
>
> tools/tracing/rtla/src/osnoise.c | 2 +-
> tools/tracing/rtla/src/timerlat_hist.c | 15 +++++++++------
> tools/tracing/rtla/src/timerlat_top.c | 15 +++++++++------
> 3 files changed, 19 insertions(+), 13 deletions(-)
>
BTW, are you going to be implementing any selftests for rtla so that it is
easy to test these changes and check for regressions?
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads
2025-01-07 21:44 ` [PATCH 0/3] rtla/timerlat: " Steven Rostedt
@ 2025-01-09 9:50 ` Tomas Glozar
0 siblings, 0 replies; 6+ messages in thread
From: Tomas Glozar @ 2025-01-09 9:50 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-trace-kernel, linux-kernel, John Kacur, Luis Goncalves
út 7. 1. 2025 v 22:43 odesílatel Steven Rostedt <rostedt@goodmis.org> napsal:
>
> BTW, are you going to be implementing any selftests for rtla so that it is
> easy to test these changes and check for regressions?
Ah right, I promised that some time ago. I have a simple test suite
adapted from CKI tests [1] that is close to being ready, I was having
some doubts about the implementation, but I will send it after adding
a few comments into the code so it can be discussed.
I have discovered already through the tests that this OSNOISE_WORKLOAD
issue also affects rtla-osnoise, not only rtla-timerlat, so it is
definitely at least somehow useful.
[1] - https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/blob/main/rt-tests/us/rtla/
> -- Steve
>
Tomas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-09 9:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 14:48 [PATCH 0/3] rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
2025-01-07 14:48 ` [PATCH 1/3] rtla/osnoise: Distinguish missing workload option Tomas Glozar
2025-01-07 14:48 ` [PATCH 2/3] rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads Tomas Glozar
2025-01-07 14:48 ` [PATCH 3/3] rtla/timerlat_top: " Tomas Glozar
2025-01-07 21:44 ` [PATCH 0/3] rtla/timerlat: " Steven Rostedt
2025-01-09 9:50 ` Tomas Glozar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).