rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads
Subsystems (2)
Tomas Glozar
maintainercover rtla/timerlat: Set OSNOISE_WORKLOAD for kernel threads
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(-)
Signature · 1 line
2.47.1
Tomas Glozar
maintainerPATCH 1/3 rtla/osnoise: Distinguish missing workload option
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.
--- tools/tracing/rtla/src/osnoise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/src/osnoise.c +1 -1
@@ -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;
Signature · 1 line
2.47.1
Tomas Glozar
maintainerPATCH 2/3 rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
In reply to Tomas GlozarWhen 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.
--- tools/tracing/rtla/src/timerlat_hist.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/tracing/rtla/src/timerlat_hist.c +9 -6
@@ -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 ;
Signature · 1 line
2.47.1
Tomas Glozar
maintainerPATCH 3/3 rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
In reply to Tomas GlozarApply fix from previous commit also to timerlat-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
@@ -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)
Signature · 1 line
2.47.1
Steven Rostedt
maintainerQuoted 19 lines · On Tue, 7 Jan 2025 15:48:20 +0100 Tomas Glozar <[email protected]> wrote:
The patchset makes both rtla-timerlat-hist and rtla-timerlat-top set
OSNOISE_WORKLOADto 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_WORKLOADis set, either manually or by an abnormally exited earlier run of rtla timerlat -u.
osnoise_set_workloadis 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 theOSNOISE_WORKLOADoption.Tomas Glozar (3):
rtla/osnoise: Distinguish missing workload option rtla/timerlat_hist: SetOSNOISE_WORKLOADfor kernel threads rtla/timerlat_top: SetOSNOISE_WORKLOADfor kernel threads
Quoted 5 lines
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
Tomas Glozar
maintainerút 7. 1. 2025 v 22:43 odesílatel Steven Rostedt <[email protected]> napsal:
Quoted 3 lines
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/
Quoted 2 lines
-- Steve
Tomas