Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-tools-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing tools updates from Steven Rostedt:

- Set distinctive value for failed tests

When running "make check" that performs tests on rtla the failure is
checked by examining the output. Instead have the tool return an
error status if it exceeds the threadhold.

- Define __NR_sched_setattr for LoongArch

Define __NR_sched_setattr to allow this to build for LoongArch.

- Define _GNU_SOURCE for timerlat_bpf.c

Due to modifications of struct sched_attr in utils.h when _GNU_SOURCE
is not defined, this can cause errors for timerlat_bpf_init() and
breakage in BPF sample collection mode.

* tag 'trace-tools-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
rtla: Define _GNU_SOURCE in timerlat_bpf.c
rtla: Define __NR_sched_setattr for LoongArch
rtla: Set distinctive exit value for failed tests

+37 -21
+3 -2
tools/tracing/rtla/src/osnoise_hist.c
··· 766 766 struct osnoise_params *params; 767 767 struct osnoise_tool *record = NULL; 768 768 struct osnoise_tool *tool = NULL; 769 + enum result return_value = ERROR; 769 770 struct trace_instance *trace; 770 - int return_value = 1; 771 771 int retval; 772 772 773 773 params = osnoise_hist_parse_args(argc, argv); ··· 889 889 890 890 osnoise_print_stats(params, tool); 891 891 892 - return_value = 0; 892 + return_value = PASSED; 893 893 894 894 if (osnoise_trace_is_off(tool, record)) { 895 895 printf("rtla osnoise hit stop tracing\n"); 896 896 save_trace_to_file(record ? record->trace.inst : NULL, 897 897 params->trace_output); 898 + return_value = FAILED; 898 899 } 899 900 900 901 out_hist:
+3 -2
tools/tracing/rtla/src/osnoise_top.c
··· 594 594 struct osnoise_params *params; 595 595 struct osnoise_tool *record = NULL; 596 596 struct osnoise_tool *tool = NULL; 597 + enum result return_value = ERROR; 597 598 struct trace_instance *trace; 598 - int return_value = 1; 599 599 int retval; 600 600 601 601 params = osnoise_top_parse_args(argc, argv); ··· 715 715 716 716 osnoise_print_stats(params, tool); 717 717 718 - return_value = 0; 718 + return_value = PASSED; 719 719 720 720 if (osnoise_trace_is_off(tool, record)) { 721 721 printf("osnoise hit stop tracing\n"); 722 722 save_trace_to_file(record ? record->trace.inst : NULL, 723 723 params->trace_output); 724 + return_value = FAILED; 724 725 } 725 726 726 727 out_top:
+1
tools/tracing/rtla/src/timerlat_bpf.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #ifdef HAVE_BPF_SKEL 3 + #define _GNU_SOURCE 3 4 #include "timerlat.h" 4 5 #include "timerlat_bpf.h" 5 6 #include "timerlat.skel.h"
+3 -2
tools/tracing/rtla/src/timerlat_hist.c
··· 1141 1141 struct timerlat_params *params; 1142 1142 struct osnoise_tool *record = NULL; 1143 1143 struct timerlat_u_params params_u; 1144 + enum result return_value = ERROR; 1144 1145 struct osnoise_tool *tool = NULL; 1145 1146 struct osnoise_tool *aa = NULL; 1146 1147 struct trace_instance *trace; 1147 1148 int dma_latency_fd = -1; 1148 - int return_value = 1; 1149 1149 pthread_t timerlat_u; 1150 1150 int retval; 1151 1151 int nr_cpus, i; ··· 1378 1378 1379 1379 timerlat_print_stats(params, tool); 1380 1380 1381 - return_value = 0; 1381 + return_value = PASSED; 1382 1382 1383 1383 if (osnoise_trace_is_off(tool, record) && !stop_tracing) { 1384 1384 printf("rtla timerlat hit stop tracing\n"); ··· 1388 1388 1389 1389 save_trace_to_file(record ? record->trace.inst : NULL, 1390 1390 params->trace_output); 1391 + return_value = FAILED; 1391 1392 } 1392 1393 1393 1394 out_hist:
+3 -2
tools/tracing/rtla/src/timerlat_top.c
··· 985 985 struct timerlat_params *params; 986 986 struct osnoise_tool *record = NULL; 987 987 struct timerlat_u_params params_u; 988 + enum result return_value = ERROR; 988 989 struct osnoise_tool *top = NULL; 989 990 struct osnoise_tool *aa = NULL; 990 991 struct trace_instance *trace; 991 992 int dma_latency_fd = -1; 992 993 pthread_t timerlat_u; 993 - int return_value = 1; 994 994 char *max_lat; 995 995 int retval; 996 996 int nr_cpus, i; ··· 1197 1197 1198 1198 timerlat_print_stats(params, top); 1199 1199 1200 - return_value = 0; 1200 + return_value = PASSED; 1201 1201 1202 1202 if (osnoise_trace_is_off(top, record) && !stop_tracing) { 1203 1203 printf("rtla timerlat hit stop tracing\n"); ··· 1207 1207 1208 1208 save_trace_to_file(record ? record->trace.inst : NULL, 1209 1209 params->trace_output); 1210 + return_value = FAILED; 1210 1211 } else if (params->aa_only) { 1211 1212 /* 1212 1213 * If the trace did not stop with --aa-only, at least print the
+2
tools/tracing/rtla/src/utils.c
··· 227 227 # define __NR_sched_setattr 355 228 228 # elif __s390x__ 229 229 # define __NR_sched_setattr 345 230 + # elif __loongarch__ 231 + # define __NR_sched_setattr 274 230 232 # endif 231 233 #endif 232 234
+6
tools/tracing/rtla/src/utils.h
··· 83 83 84 84 #define ns_to_usf(x) (((double)x/1000)) 85 85 #define ns_to_per(total, part) ((part * 100) / (double)total) 86 + 87 + enum result { 88 + PASSED = 0, /* same as EXIT_SUCCESS */ 89 + ERROR = 1, /* same as EXIT_FAILURE, an error in arguments */ 90 + FAILED = 2, /* test hit the stop tracing condition */ 91 + };
+5 -2
tools/tracing/rtla/tests/engine.sh
··· 39 39 } 40 40 41 41 check() { 42 + expected_exitcode=${3:-0} 42 43 # Simple check: run rtla with given arguments and test exit code. 43 44 # If TEST_COUNT is set, run the test. Otherwise, just count. 44 45 ctr=$(($ctr + 1)) ··· 50 49 # Run rtla; in case of failure, include its output as comment 51 50 # in the test results. 52 51 result=$(stdbuf -oL $TIMEOUT "$RTLA" $2 2>&1); exitcode=$? 53 - if [ $exitcode -eq 0 ] 52 + if [ $exitcode -eq $expected_exitcode ] 54 53 then 55 54 echo "ok $ctr - $1" 56 55 else ··· 69 68 # Save original arguments 70 69 arg1=$1 71 70 arg2=$2 71 + arg3=$3 72 72 73 73 # Apply osnoise options (if not dry run) 74 74 if [ -n "$TEST_COUNT" ] 75 75 then 76 76 [ "$NO_RESET_OSNOISE" == 1 ] || reset_osnoise 77 + shift 77 78 shift 78 79 while shift 79 80 do ··· 87 84 done 88 85 fi 89 86 90 - NO_RESET_OSNOISE=1 check "$arg1" "$arg2" 87 + NO_RESET_OSNOISE=1 check "$arg1" "$arg2" "$arg3" 91 88 } 92 89 93 90 set_timeout() {
+2 -2
tools/tracing/rtla/tests/hwnoise.t
··· 10 10 check "detect noise higher than one microsecond" \ 11 11 "hwnoise -c 0 -T 1 -d 5s -q" 12 12 check "set the automatic trace mode" \ 13 - "hwnoise -a 5 -d 30s" 13 + "hwnoise -a 5 -d 30s" 2 14 14 check "set scheduling param to the osnoise tracer threads" \ 15 15 "hwnoise -P F:1 -c 0 -r 900000 -d 1M -q" 16 16 check "stop the trace if a single sample is higher than 1 us" \ 17 - "hwnoise -s 1 -T 1 -t -d 30s" 17 + "hwnoise -s 1 -T 1 -t -d 30s" 2 18 18 check "enable a trace event trigger" \ 19 19 "hwnoise -t -e osnoise:irq_noise trigger=\"hist:key=desc,duration:sort=desc,duration:vals=hitcount\" -d 1m" 20 20
+3 -3
tools/tracing/rtla/tests/osnoise.t
··· 10 10 check "verify the --priority/-P param" \ 11 11 "osnoise top -P F:1 -c 0 -r 900000 -d 1M -q" 12 12 check "verify the --stop/-s param" \ 13 - "osnoise top -s 30 -T 1 -t" 13 + "osnoise top -s 30 -T 1 -t" 2 14 14 check "verify the --trace param" \ 15 - "osnoise hist -s 30 -T 1 -t" 15 + "osnoise hist -s 30 -T 1 -t" 2 16 16 check "verify the --entries/-E param" \ 17 17 "osnoise hist -P F:1 -c 0 -r 900000 -d 1M -b 10 -E 25" 18 18 ··· 20 20 # and stopping on threshold. 21 21 # If default period is not set, this will time out. 22 22 check_with_osnoise_options "apply default period" \ 23 - "osnoise hist -s 1" period_us=600000000 23 + "osnoise hist -s 1" 2 period_us=600000000 24 24 25 25 test_end
+6 -6
tools/tracing/rtla/tests/timerlat.t
··· 21 21 check "verify help page" \ 22 22 "timerlat --help" 23 23 check "verify -s/--stack" \ 24 - "timerlat top -s 3 -T 10 -t" 24 + "timerlat top -s 3 -T 10 -t" 2 25 25 check "verify -P/--priority" \ 26 26 "timerlat top -P F:1 -c 0 -d 1M -q" 27 27 check "test in nanoseconds" \ 28 - "timerlat top -i 2 -c 0 -n -d 30s" 28 + "timerlat top -i 2 -c 0 -n -d 30s" 2 29 29 check "set the automatic trace mode" \ 30 - "timerlat top -a 5 --dump-tasks" 30 + "timerlat top -a 5 --dump-tasks" 2 31 31 check "print the auto-analysis if hits the stop tracing condition" \ 32 - "timerlat top --aa-only 5" 32 + "timerlat top --aa-only 5" 2 33 33 check "disable auto-analysis" \ 34 - "timerlat top -s 3 -T 10 -t --no-aa" 34 + "timerlat top -s 3 -T 10 -t --no-aa" 2 35 35 check "verify -c/--cpus" \ 36 36 "timerlat hist -c 0 -d 30s" 37 37 check "hist test in nanoseconds" \ 38 - "timerlat hist -i 2 -c 0 -n -d 30s" 38 + "timerlat hist -i 2 -c 0 -n -d 30s" 2 39 39 done 40 40 41 41 test_end