Skip to content

Commit 2784d74

Browse files
committed
Merge tag 'trace-tools-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing tooling updates from Steven Rostedt: - Add cgroup support for rtla via the -C option - Add --house-keeping option that tells rtla where to place the housekeeping threads - Have rtla/timerlat have its own tracing instance instead of using the top level tracing instance that is the default for other tracing users to use - Add auto analysis to timerlat_hist - Have rtla start the tracers after creating the instances - Reduce rtla hwnoise down to 75% from 100% as it runs with preemption disabled and can cause system instability at 100% - Add support to run timerlat_top and timerlat_hist threads in user-space instead of just using the kernel tasks - Some minor clean ups and documentation changes * tag 'trace-tools-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: Documentation: Add tools/rtla timerlat -u option documentation rtla/timerlat_hist: Add timerlat user-space support rtla/timerlat_top: Add timerlat user-space support rtla/hwnoise: Reduce runtime to 75% rtla: Start the tracers after creating all instances rtla/timerlat_hist: Add auto-analysis support rtla/timerlat: Give timerlat auto analysis its own instance rtla: Automatically move rtla to a house-keeping cpu rtla: Change monitored_cpus from char * to cpu_set_t rtla: Add --house-keeping option rtla: Add -C cgroup support
2 parents 2a95b03 + 6127383 commit 2784d74

17 files changed

+1277
-106
lines changed

Documentation/tools/rtla/common_options.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Set the osnoise tracer to run the sample threads in the cpu-list.
44

5+
**-H**, **--house-keeping** *cpu-list*
6+
7+
Run rtla control threads only on the given cpu-list.
8+
59
**-d**, **--duration** *time[s|m|h|d]*
610

711
Set the duration of the session.
@@ -42,6 +46,10 @@
4246
- *f:prio* - use SCHED_FIFO with *prio*;
4347
- *d:runtime[us|ms|s]:period[us|ms|s]* - use SCHED_DEADLINE with *runtime* and *period* in nanoseconds.
4448

49+
**-C**, **--cgroup**\[*=cgroup*]
50+
51+
Set a *cgroup* to the tracer's threads. If the **-C** option is passed without arguments, the tracer's thread will inherit **rtla**'s *cgroup*. Otherwise, the threads will be placed on the *cgroup* passed to the option.
52+
4553
**-h**, **--help**
4654

4755
Print help menu.

Documentation/tools/rtla/common_timerlat_aa.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@
55
**--no-aa**
66

77
disable auto-analysis, reducing rtla timerlat cpu usage
8-
9-
**--aa-only** *us*
10-
11-
Set stop tracing conditions and run without collecting and displaying statistics.
12-
Print the auto-analysis if the system hits the stop tracing condition. This option
13-
is useful to reduce rtla timerlat CPU, enabling the debug without the overhead of
14-
collecting the statistics.

Documentation/tools/rtla/common_timerlat_options.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@
2626
Set the /dev/cpu_dma_latency to *us*, aiming to bound exit from idle latencies.
2727
*cyclictest* sets this value to *0* by default, use **--dma-latency** *0* to have
2828
similar results.
29+
30+
**-u**, **--user-threads**
31+
32+
Set timerlat to run without a workload, and then dispatches user-space workloads
33+
to wait on the timerlat_fd. Once the workload is awakes, it goes to sleep again
34+
adding so the measurement for the kernel-to-user and user-to-kernel to the tracer
35+
output.

Documentation/tools/rtla/rtla-timerlat-hist.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ OPTIONS
2929

3030
.. include:: common_options.rst
3131

32+
.. include:: common_timerlat_aa.rst
33+
3234
EXAMPLE
3335
=======
3436
In the example below, **rtla timerlat hist** is set to run for *10* minutes,
3537
in the cpus *0-4*, *skipping zero* only lines. Moreover, **rtla timerlat
3638
hist** will change the priority of the *timerlat* threads to run under
3739
*SCHED_DEADLINE* priority, with a *10us* runtime every *1ms* period. The
38-
*1ms* period is also passed to the *timerlat* tracer::
40+
*1ms* period is also passed to the *timerlat* tracer. Auto-analysis is disabled
41+
to reduce overhead ::
3942

40-
[root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1ms
43+
[root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1ms --no-aa
4144
# RTLA timerlat histogram
4245
# Time unit is microseconds (us)
4346
# Duration: 0 00:10:00

Documentation/tools/rtla/rtla-timerlat-top.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ OPTIONS
3232

3333
.. include:: common_timerlat_aa.rst
3434

35+
**--aa-only** *us*
36+
37+
Set stop tracing conditions and run without collecting and displaying statistics.
38+
Print the auto-analysis if the system hits the stop tracing condition. This option
39+
is useful to reduce rtla timerlat CPU, enabling the debug without the overhead of
40+
collecting the statistics.
41+
3542
EXAMPLE
3643
=======
3744

tools/tracing/rtla/src/osnoise.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,67 @@ static void osnoise_put_irq_disable(struct osnoise_context *context)
841841
context->orig_opt_irq_disable = OSNOISE_OPTION_INIT_VAL;
842842
}
843843

844+
static int osnoise_get_workload(struct osnoise_context *context)
845+
{
846+
if (context->opt_workload != OSNOISE_OPTION_INIT_VAL)
847+
return context->opt_workload;
848+
849+
if (context->orig_opt_workload != OSNOISE_OPTION_INIT_VAL)
850+
return context->orig_opt_workload;
851+
852+
context->orig_opt_workload = osnoise_options_get_option("OSNOISE_WORKLOAD");
853+
854+
return context->orig_opt_workload;
855+
}
856+
857+
int osnoise_set_workload(struct osnoise_context *context, bool onoff)
858+
{
859+
int opt_workload = osnoise_get_workload(context);
860+
int retval;
861+
862+
if (opt_workload == OSNOISE_OPTION_INIT_VAL)
863+
return -1;
864+
865+
if (opt_workload == onoff)
866+
return 0;
867+
868+
retval = osnoise_options_set_option("OSNOISE_WORKLOAD", onoff);
869+
if (retval < 0)
870+
return -1;
871+
872+
context->opt_workload = onoff;
873+
874+
return 0;
875+
}
876+
877+
static void osnoise_restore_workload(struct osnoise_context *context)
878+
{
879+
int retval;
880+
881+
if (context->orig_opt_workload == OSNOISE_OPTION_INIT_VAL)
882+
return;
883+
884+
if (context->orig_opt_workload == context->opt_workload)
885+
goto out_done;
886+
887+
retval = osnoise_options_set_option("OSNOISE_WORKLOAD", context->orig_opt_workload);
888+
if (retval < 0)
889+
err_msg("Could not restore original OSNOISE_WORKLOAD option\n");
890+
891+
out_done:
892+
context->orig_opt_workload = OSNOISE_OPTION_INIT_VAL;
893+
}
894+
895+
static void osnoise_put_workload(struct osnoise_context *context)
896+
{
897+
osnoise_restore_workload(context);
898+
899+
if (context->orig_opt_workload == OSNOISE_OPTION_INIT_VAL)
900+
return;
901+
902+
context->orig_opt_workload = OSNOISE_OPTION_INIT_VAL;
903+
}
904+
844905
/*
845906
* enable_osnoise - enable osnoise tracer in the trace_instance
846907
*/
@@ -908,6 +969,9 @@ struct osnoise_context *osnoise_context_alloc(void)
908969
context->orig_opt_irq_disable = OSNOISE_OPTION_INIT_VAL;
909970
context->opt_irq_disable = OSNOISE_OPTION_INIT_VAL;
910971

972+
context->orig_opt_workload = OSNOISE_OPTION_INIT_VAL;
973+
context->opt_workload = OSNOISE_OPTION_INIT_VAL;
974+
911975
osnoise_get_context(context);
912976

913977
return context;
@@ -935,6 +999,7 @@ void osnoise_put_context(struct osnoise_context *context)
935999
osnoise_put_print_stack(context);
9361000
osnoise_put_tracing_thresh(context);
9371001
osnoise_put_irq_disable(context);
1002+
osnoise_put_workload(context);
9381003

9391004
free(context);
9401005
}

tools/tracing/rtla/src/osnoise.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ struct osnoise_context {
4242
/* -1 as init value because 0 is off */
4343
int orig_opt_irq_disable;
4444
int opt_irq_disable;
45+
46+
/* -1 as init value because 0 is off */
47+
int orig_opt_workload;
48+
int opt_workload;
4549
};
4650

4751
/*
@@ -84,6 +88,7 @@ int osnoise_set_print_stack(struct osnoise_context *context,
8488
long long print_stack);
8589

8690
int osnoise_set_irq_disable(struct osnoise_context *context, bool onoff);
91+
int osnoise_set_workload(struct osnoise_context *context, bool onoff);
8792

8893
/*
8994
* osnoise_tool - osnoise based tool definition.

0 commit comments

Comments
 (0)