Skip to content

Commit 217f0b1

Browse files
lenticularis39rostedt
authored andcommitted
rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
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: [email protected] Cc: John Kacur <[email protected]> Cc: Luis Goncalves <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: cdca4f4 ("rtla/timerlat_top: Add timerlat user-space support") Signed-off-by: Tomas Glozar <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent d8d8661 commit 217f0b1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -851,12 +851,15 @@ timerlat_top_apply_config(struct osnoise_tool *top, struct timerlat_top_params *
851851
}
852852
}
853853

854-
if (params->user_top) {
855-
retval = osnoise_set_workload(top->context, 0);
856-
if (retval) {
857-
err_msg("Failed to set OSNOISE_WORKLOAD option\n");
858-
goto out_err;
859-
}
854+
/*
855+
* Set workload according to type of thread if the kernel supports it.
856+
* On kernels without support, user threads will have already failed
857+
* on missing timerlat_fd, and kernel threads do not need it.
858+
*/
859+
retval = osnoise_set_workload(top->context, params->kernel_workload);
860+
if (retval < -1) {
861+
err_msg("Failed to set OSNOISE_WORKLOAD option\n");
862+
goto out_err;
860863
}
861864

862865
if (isatty(STDOUT_FILENO) && !params->quiet)

0 commit comments

Comments
 (0)