diff --git a/README.en.md b/README.en.md old mode 100644 new mode 100755 index 1aca1b0ef060bf0a6ddcf9284072274fd0173e9d..506b1b84cc715ff3bd59f4d75f09fde624981212 --- a/README.en.md +++ b/README.en.md @@ -1,36 +1,3 @@ # rt-tests -#### Description This repository contains some programs that test various rt-linux features. - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md old mode 100644 new mode 100755 index dd02dca08e4ddbe77aeea62ddc15f7555ed237c7..e759e695ce670fe5d2a6fb7a6a49e794178c9875 --- a/README.md +++ b/README.md @@ -1,37 +1,3 @@ # rt-tests -#### 介绍 -This repository contains some programs that test various rt-linux features. - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +这个仓库包含一些测试各种rt linux功能的程序。 diff --git a/deadline_test-Increase-buffer-to-avoid-overflow.patch b/deadline_test-Increase-buffer-to-avoid-overflow.patch new file mode 100644 index 0000000000000000000000000000000000000000..c7ae585ce4118375a7f185b284e5b2fd1f308d73 --- /dev/null +++ b/deadline_test-Increase-buffer-to-avoid-overflow.patch @@ -0,0 +1,42 @@ +From 33dff61afb032e5374c6ec60d4f88cdf57e83c53 Mon Sep 17 00:00:00 2001 +From: Daniel Wagner +Date: Mon, 19 Aug 2019 08:43:04 +0200 +Subject: [PATCH 04/10] deadline_test: Increase buffer to avoid overflow +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Increase the size of the char buffer. gcc 9.1.1 reports: + +src/sched_deadline/deadline_test.c:1803:24: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=] + 1803 | sprintf(setcpu_buf, "%d", cpu_count - 1); + | ^~ +src/sched_deadline/deadline_test.c:1803:23: note: directive argument in the range [-2147483648, 2147483646] + 1803 | sprintf(setcpu_buf, "%d", cpu_count - 1); + | ^~~~ +src/sched_deadline/deadline_test.c:1803:3: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10 + 1803 | sprintf(setcpu_buf, "%d", cpu_count - 1); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Daniel Wagner +Signed-off-by: John Kacur +--- + src/sched_deadline/deadline_test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c +index e2898de328bb..5b5f40dbb74d 100644 +--- a/src/sched_deadline/deadline_test.c ++++ b/src/sched_deadline/deadline_test.c +@@ -1795,7 +1795,7 @@ int main (int argc, char **argv) + + /* -b has us bind to the last CPU. */ + if (!all_cpus && !setcpu) { +- setcpu_buf = malloc(10); ++ setcpu_buf = malloc(12); + if (!setcpu_buf) { + perror("malloc"); + exit(-1); +-- +2.20.1 + diff --git a/pmqtest-Increase-buffer-to-avoid-overflow.patch b/pmqtest-Increase-buffer-to-avoid-overflow.patch new file mode 100644 index 0000000000000000000000000000000000000000..42a0cab4375bb9cc9acdcd586c8c54ec6233a103 --- /dev/null +++ b/pmqtest-Increase-buffer-to-avoid-overflow.patch @@ -0,0 +1,50 @@ +From f7c39616fe887f35abaa4b81466ab7f167e0a410 Mon Sep 17 00:00:00 2001 +From: Daniel Wagner +Date: Mon, 19 Aug 2019 08:43:01 +0200 +Subject: [PATCH 01/10] pmqtest: Increase buffer to avoid overflow +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Increase the size of the char buffer. gcc 9.1.1 reports: + +src/pmqtest/pmqtest.c: In function ‘main’: +src/pmqtest/pmqtest.c:46:21: warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size 8 [-Wformat-overflow=] + 46 | #define SYNCMQ_NAME "/syncmsg%d" + | ^~~~~~~~~~~~ + +src/pmqtest/pmqtest.c:445:3: note: ‘sprintf’ output between 10 and 19 bytes into a destination of size 16 + 445 | sprintf(mqname, SYNCMQ_NAME, i); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Daniel Wagner +Signed-off-by: John Kacur +--- + src/pmqtest/pmqtest.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c +index a04fc49872bf..3ce799bd6319 100644 +--- a/src/pmqtest/pmqtest.c ++++ b/src/pmqtest/pmqtest.c +@@ -440,7 +440,7 @@ int main(int argc, char *argv[]) + goto nomem; + + for (i = 0; i < num_threads; i++) { +- char mqname[16]; ++ char mqname[19]; + + sprintf(mqname, SYNCMQ_NAME, i); + receiver[i].syncmq = mq_open(mqname, oflag, 0777, &mqstat); +@@ -567,7 +567,7 @@ int main(int argc, char *argv[]) + } + nanosleep(&maindelay, NULL); + for (i = 0; i < num_threads; i++) { +- char mqname[16]; ++ char mqname[19]; + + mq_close(receiver[i].syncmq); + sprintf(mqname, SYNCMQ_NAME, i); +-- +2.20.1 + diff --git a/rt-tests-1.5.tar.xz b/rt-tests-1.5.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..cb99cca8d1f0722ed1b6ff9cfff6c48cbbbdeee1 Binary files /dev/null and b/rt-tests-1.5.tar.xz differ diff --git a/rt-tests-Makefile-do-not-use-python3-for-rhel7.8.patch b/rt-tests-Makefile-do-not-use-python3-for-rhel7.8.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac316056de6f2d2d6a0c80b83b7c2049a98478eb --- /dev/null +++ b/rt-tests-Makefile-do-not-use-python3-for-rhel7.8.patch @@ -0,0 +1,28 @@ +From 73536483085d27d872b35a3aa459f681b8779020 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 19 Aug 2019 23:12:42 +0200 +Subject: [PATCH] rt-tests: Makefile, do not use python3 for rhel7.8 + +Don't use python3 for installing python files in rhel7.8 + +Signed-off-by: John Kacur +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 51b8dea001e3..536772033776 100644 +--- a/Makefile ++++ b/Makefile +@@ -33,7 +33,7 @@ CFLAGS ?= -Wall -Wno-nonnull + CPPFLAGS += -D_GNU_SOURCE -Isrc/include + LDFLAGS ?= + +-PYLIB ?= $(shell python3 -c 'import distutils.sysconfig; print (distutils.sysconfig.get_python_lib())') ++PYLIB ?= $(shell python -c 'import distutils.sysconfig; print (distutils.sysconfig.get_python_lib())') + + ifndef DEBUG + CFLAGS += -O2 -g +-- +2.20.1 + diff --git a/rt-tests-Set-affinity-before-applying-numa.patch b/rt-tests-Set-affinity-before-applying-numa.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac5e841a1f25cb7f115a26826e222fa6bf6a05b0 --- /dev/null +++ b/rt-tests-Set-affinity-before-applying-numa.patch @@ -0,0 +1,110 @@ +From e5f59a301e6585145c5b738a4e9327e943e16404 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Fri, 6 Sep 2019 20:59:42 +0200 +Subject: [PATCH] rt-tests: Set affinity before applying numa + +There are three changes here. + +1. If affinity is not specified, but numa is available, then numa +implies AFFINITY_USEALL. + +2. Move setting affinity before applying numa +We need to set the affinity before applying numa, so that we don't +apply numa settings to cpus we don't intend to run on. + +3. Allow a greater number of threads than cpus to run in a round robin +fashion in the case of numa. + +Signed-off-by: John Kacur +--- + src/cyclictest/cyclictest.c | 34 +++++++++++++++++++++------------- + 1 file changed, 21 insertions(+), 13 deletions(-) + +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index d101e3d14854..52f93da7d074 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -1349,8 +1349,12 @@ static void process_options (int argc, char *argv[], int max_cpus) + /* if smp wasn't requested, test for numa automatically */ + if (!smp) { + #ifdef NUMA +- if (numa_available() != -1) ++ if (numa_available() != -1) { + numa = 1; ++ if (setaffinity == AFFINITY_UNSPECIFIED) { ++ setaffinity = AFFINITY_USEALL; ++ } ++ } + #else + warn("cyclictest was not built with the numa option\n"); + numa = 0; +@@ -1716,6 +1720,7 @@ int main(int argc, char **argv) + sigset_t sigset; + int signum = SIGALRM; + int mode; ++ int cpu; + int max_cpus = sysconf(_SC_NPROCESSORS_ONLN); + int i, ret = -1; + int status; +@@ -1877,6 +1882,16 @@ int main(int argc, char **argv) + if (status != 0) + fatal("error from pthread_attr_init for thread %d: %s\n", i, strerror(status)); + ++ switch (setaffinity) { ++ case AFFINITY_UNSPECIFIED: cpu = -1; break; ++ case AFFINITY_SPECIFIED: ++ cpu = cpu_for_thread(i, max_cpus); ++ if (verbose) ++ printf("Thread %d using cpu %d.\n", i, cpu); ++ break; ++ case AFFINITY_USEALL: cpu = i % max_cpus; break; ++ } ++ + node = -1; + if (numa) { + void *stack; +@@ -1884,7 +1899,7 @@ int main(int argc, char **argv) + size_t stksize; + + /* find the memory node associated with the cpu i */ +- node = rt_numa_numa_node_of_cpu(i); ++ node = rt_numa_numa_node_of_cpu(cpu); + + /* get the stack size set for for this thread */ + if (pthread_attr_getstack(&attr, &currstk, &stksize)) +@@ -1895,7 +1910,7 @@ int main(int argc, char **argv) + stksize = PTHREAD_STACK_MIN * 2; + + /* allocate memory for a stack on appropriate node */ +- stack = rt_numa_numa_alloc_onnode(stksize, node, i); ++ stack = rt_numa_numa_alloc_onnode(stksize, node, cpu); + + /* touch the stack pages to pre-fault them in */ + memset(stack, 0, stksize); +@@ -1965,20 +1980,13 @@ int main(int argc, char **argv) + interval += distance; + if (verbose) + printf("Thread %d Interval: %d\n", i, interval); ++ + par->max_cycles = max_cycles; + par->stats = stat; + par->node = node; + par->tnum = i; +- switch (setaffinity) { +- case AFFINITY_UNSPECIFIED: par->cpu = -1; break; +- case AFFINITY_SPECIFIED: +- par->cpu = cpu_for_thread(i, max_cpus); +- if (verbose) +- printf("Thread %d using cpu %d.\n", i, +- par->cpu); +- break; +- case AFFINITY_USEALL: par->cpu = i % max_cpus; break; +- } ++ par->cpu = cpu; ++ + stat->min = 1000000; + stat->max = 0; + stat->avg = 0.0; +-- +2.20.1 + diff --git a/rt-tests-cyclictest-Assume-libnuma-version-2-by-default.patch b/rt-tests-cyclictest-Assume-libnuma-version-2-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..d953efdc70602129d36ca88c4cde9798c100e2b3 --- /dev/null +++ b/rt-tests-cyclictest-Assume-libnuma-version-2-by-default.patch @@ -0,0 +1,32 @@ +From b0bd20facc01bd2a3d2bb7a1cbf26d9452c68c41 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Thu, 19 Sep 2019 20:19:17 +0200 +Subject: [PATCH] rt-tests: cyclictest: Assume libnuma version 2 by default + +Most distributions have used libnuma version 2 for awhile now, so make +it the default. + +This doesn't prevent people from defining it as version 1, or compiling +without numa. + +Signed-off-by: John Kacur +--- + src/cyclictest/rt_numa.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h +index e0f4b2e9d8b2..7adeb3c01324 100644 +--- a/src/cyclictest/rt_numa.h ++++ b/src/cyclictest/rt_numa.h +@@ -29,7 +29,7 @@ static int numa = 0; + #include + + #ifndef LIBNUMA_API_VERSION +-#define LIBNUMA_API_VERSION 1 ++#define LIBNUMA_API_VERSION 2 + #endif + + static void * +-- +2.20.1 + diff --git a/rt-tests-cyclictest-Don-t-allow-OPT_SYSTEM-with-OPT_.patch b/rt-tests-cyclictest-Don-t-allow-OPT_SYSTEM-with-OPT_.patch new file mode 100644 index 0000000000000000000000000000000000000000..801ed1b9f62cd1cb770ecabdd28eba78fed1edd7 --- /dev/null +++ b/rt-tests-cyclictest-Don-t-allow-OPT_SYSTEM-with-OPT_.patch @@ -0,0 +1,42 @@ +From 0bf35a2fb58177318353c3a2e02df5b20728d5b9 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 16 Sep 2019 23:43:32 +0200 +Subject: [PATCH 4/5] rt-tests: cyclictest: Don't allow OPT_SYSTEM with + OPT_POSIX_TIMERS + +OPT_SYSTEM means use sys_nanosleep and sys_setitimer +if you try to combine it with OPT_POSIX_TIMERS, it breaks. + +cyclictest becomes unkillable with ctrl-C and only the first thread is +updated. + +Fix this by issuing a warning if the user tries to combine the two +options and then use clock_nanosleep. + +Reported-by: Tom Rix +Signed-off-by: John Kacur +--- + src/cyclictest/cyclictest.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 3a78912b34f8..6be0525822ca 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -1353,6 +1353,13 @@ static void process_options (int argc, char *argv[], int max_cpus) + } + } + ++ if ((use_system == MODE_SYS_OFFSET) && (use_nanosleep == MODE_CYCLIC)) { ++ warn("The system option requires clock_nanosleep\n"); ++ warn("and is not compatible with posix_timers\n"); ++ warn("Using clock_nanosleep\n"); ++ use_nanosleep = MODE_CLOCK_NANOSLEEP; ++ } ++ + /* if smp wasn't requested, test for numa automatically */ + if (!smp) { + #ifdef NUMA +-- +2.20.1 + diff --git a/rt-tests-cyclictest-Fix-warning-cpu-may-be-used-unin.patch b/rt-tests-cyclictest-Fix-warning-cpu-may-be-used-unin.patch new file mode 100644 index 0000000000000000000000000000000000000000..3822acd9f614ac20b64dd864a2c01454fb18dde0 --- /dev/null +++ b/rt-tests-cyclictest-Fix-warning-cpu-may-be-used-unin.patch @@ -0,0 +1,33 @@ +From f70d5f0de62114cfcd8d8b5032138111730665e6 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 16 Sep 2019 21:06:28 +0200 +Subject: [PATCH 08/10] =?UTF-8?q?rt-tests:=20cyclictest:=20Fix=20=20warnin?= + =?UTF-8?q?g:=20=E2=80=98cpu=E2=80=99=20may=20be=20used=20uninitialized?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix warning 'cpu' maybe uninitialized by giving it a default value in +the switch statement. Note, this is a false positive, but documenting +the default value in the switch statement isn't a bad thing. + +Signed-off-by: John Kacur +--- + src/cyclictest/cyclictest.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 72fb35da3238..3a78912b34f8 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -1897,6 +1897,7 @@ int main(int argc, char **argv) + printf("Thread %d using cpu %d.\n", i, cpu); + break; + case AFFINITY_USEALL: cpu = i % max_cpus; break; ++ default: cpu = -1; + } + + node = -1; +-- +2.20.1 + diff --git a/rt-tests-cyclictest-Make-tracemark-work-correctly-ag.patch b/rt-tests-cyclictest-Make-tracemark-work-correctly-ag.patch new file mode 100644 index 0000000000000000000000000000000000000000..5903027c6af2dc0c39c3b7ce3f436a5138465db4 --- /dev/null +++ b/rt-tests-cyclictest-Make-tracemark-work-correctly-ag.patch @@ -0,0 +1,68 @@ +From 33f07f6ee2053dc16dd667c763326515e87f19e3 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 16 Sep 2019 20:37:22 +0200 +Subject: [PATCH 2/5] rt-tests: cyclictest: Make tracemark work correctly again + +commit f5ccfbe4d6641e48f56152be135d901dd31cba7e +was a little too aggressive removing ftrace code. + +We were able to remove ftrace code because this functionality is +available using trace-cmd, in conjunction with the tracemark option in +cyclictest. Put back the parts of tracemark needed to make this work +correctly. + +After this patch you can get tracing info like this as an example. + +trace-cmd record -p function ./cyclictest -t -b100 --tracemark + +Signed-off-by: John Kacur + +Corrected a typo +Reported-by: Kurt Kanzenbach +Signed-off-by: John Kacur +--- + src/cyclictest/cyclictest.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 52f93da7d074..72fb35da3238 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -184,6 +184,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts); + + static int shutdown; + static int tracelimit = 0; ++static int trace_marker = 0; + static int verbose = 0; + static int oscope_reduction = 1; + static int lockall = 0; +@@ -400,6 +401,9 @@ static void debugfs_prepare(void) + + static void enable_trace_mark(void) + { ++ if (!trace_marker) ++ return; ++ + debugfs_prepare(); + open_tracemark_fd(); + } +@@ -1167,6 +1171,7 @@ static void process_options (int argc, char *argv[], int max_cpus) + {"spike", required_argument, NULL, OPT_TRIGGER }, + {"spike-nodes", required_argument, NULL, OPT_TRIGGER_NODES }, + {"threads", optional_argument, NULL, OPT_THREADS }, ++ {"tracemark", no_argument, NULL, OPT_TRACEMARK }, + {"unbuffered", no_argument, NULL, OPT_UNBUFFERED }, + {"verbose", no_argument, NULL, OPT_VERBOSE }, + {"dbg_cyclictest", no_argument, NULL, OPT_DBGCYCLIC }, +@@ -1343,6 +1348,8 @@ static void process_options (int argc, char *argv[], int max_cpus) + fatal("--smi is not available on your arch\n"); + #endif + break; ++ case OPT_TRACEMARK: ++ trace_marker = 1; break; + } + } + +-- +2.20.1 + diff --git a/rt-tests-cyclictest.8-Remove-invalid-tracing-options.patch b/rt-tests-cyclictest.8-Remove-invalid-tracing-options.patch new file mode 100644 index 0000000000000000000000000000000000000000..c2b0039bf5fceaf6e9e465cc0d3a476cb9e8987f --- /dev/null +++ b/rt-tests-cyclictest.8-Remove-invalid-tracing-options.patch @@ -0,0 +1,116 @@ +From 4ecad84cb85bd0335b5d32f84de42cbb5783196e Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Sat, 14 Sep 2019 04:57:35 +0200 +Subject: [PATCH] rt-tests: cyclictest.8: Remove invalid tracing options from + the manpage + +Most tracing options have been removed from cyclictest since the +user can now use trace-cmd together with cyclictest to get the same +functionality. Update the manpage to reflect this. + +Signed-off-by: John Kacur +--- + src/cyclictest/cyclictest.8 | 35 ----------------------------------- + 1 file changed, 35 deletions(-) + +diff --git a/src/cyclictest/cyclictest.8 b/src/cyclictest/cyclictest.8 +index a05d1f4c9d4a..b64a16ae8bbb 100644 +--- a/src/cyclictest/cyclictest.8 ++++ b/src/cyclictest/cyclictest.8 +@@ -52,9 +52,6 @@ Align thread wakeups to a specific offset in microseconds + .B \-b, \-\-breaktrace=USEC + Send break trace command when latency > USEC + .TP +-.B \-B, \-\-preemptirqs +-Both preempt and irqsoff tracing (used with -b) +-.TP + .B \-c, \-\-clock=CLOCK + select clock + .br +@@ -62,9 +59,6 @@ select clock + .br + 1 = CLOCK_REALTIME + .TP +-.B \-C, \-\-context +-context switch tracing (used with \-b) +-.TP + .B \-d, \-\-distance=DIST + Distance of thread intervals in us, default = 500 + .TP +@@ -73,12 +67,6 @@ Specify a length for the test run. + .br + Append 'm', 'h', or 'd' to specify minutes, hours or days. + .TP +-.B \-E, \-\-event +-event tracing (used with \-b) +-.TP +-.B \-f, \-\-ftrace +-Enable function tracing using ftrace as tracer. This option is available only with \-b. +-.TP + .B \-F, \-\-fifo= + Create a named pipe at path and write stats to it + .TP +@@ -94,9 +82,6 @@ Dump the latency histogram to instead of stdout. + .B \-i, \-\-interval=INTV + Set the base interval of the thread(s) in microseconds (default is 1000us). This sets the interval of the first thread. See also \-d. + .TP +-.B \-I, \-\-irqsoff +-Irgsoff tracing (used with \-b) +-.TP + .B \-l, \-\-loops=LOOPS + Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. Cyclictest is stopped once the number of timer intervals has been reached. + .TP +@@ -113,26 +98,16 @@ running cyclictest on low-bandwidth connections) + .B \-n, \-\-nanosleep + Use clock_nanosleep instead of posix interval timers. Setting this option runs the tests with clock_nanosleep instead of posix interval timers. + .TP +-.B \-\-notrace +-suppress tracing +-.TP + .B \-N, \-\-nsecs + Show results in nanoseconds instead of microseconds, which is the default unit. + .TP + .B \-o, \-\-oscope=RED + Oscilloscope mode, reduce verbose output by RED. + .TP +-.B \-O, \-\-traceopt=TRACING_OPTION +-Used to pass tracing options to ftrace tracers. May be invoked multiple +-times for multiple trace options. For example trace options look at /sys/kernel/debug/tracing/trace_options +-.TP + .B \-p, \-\-prio=PRIO + Set the priority of the first thread. The given priority is set to the first test thread. Each further thread gets a lower priority: + Priority(Thread N) = max(Priority(Thread N\-1) \- 1, 0) + .TP +-.B \-P, \-\-preemptoff +-Preempt off tracing (used with -b) +-.TP + .B \-\-policy=NAME + set the scheduler policy of the measurement threads + where NAME is one of: other, normal, batch, idle, fifo, rr +@@ -178,10 +153,6 @@ the number of available CPUs. See \-d, \-i and \-p for further information. + .B \-\-tracemark + write a trace mark when \-b latency is exceeded. + .TP +-.B \-T, \-\-tracer=TRACEFUNC +-set the ftrace tracer function. Used with the \-b option. Must be one +-of the trace functions available from /kernel/debug/tracing/available_tracers +-.TP + .B \-u, \-\-unbuffered + force unbuffered output for live processing + .TP +@@ -192,12 +163,6 @@ n:c:v + + where n=task number c=count v=latency value in us. + .TP +-.B \\-w, \-\-wakeup +-task wakeup tracing (used with \-b) +-.TP +-.B \\-W, \-\-wakeuprt +-rt-task wakeup tracing (used with \-b) +-.TP + .B \-\-dbg_cyclictest + Print info userful for debugging cyclictest + +-- +2.20.1 + diff --git a/rt-tests-hwlatdetect-use-python-instead-of-python3-f.patch b/rt-tests-hwlatdetect-use-python-instead-of-python3-f.patch new file mode 100644 index 0000000000000000000000000000000000000000..6ebaa6d84e1a42edc3f5e3f8cd87b2fce510d0b0 --- /dev/null +++ b/rt-tests-hwlatdetect-use-python-instead-of-python3-f.patch @@ -0,0 +1,26 @@ +From 62782334ffcbf878c3bb6bb55446200f273bab08 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 19 Aug 2019 23:20:07 +0200 +Subject: [PATCH] rt-tests: hwlatdetect: use python instead of python3 for + rhel7.x + +Use python3 for rhel7.x + +Signed-off-by: John Kacur +--- + src/hwlatdetect/hwlatdetect.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py +index c11a6f8ea5b1..70c2e3827fee 100755 +--- a/src/hwlatdetect/hwlatdetect.py ++++ b/src/hwlatdetect/hwlatdetect.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python3 ++#!/usr/bin/python + + # (C) 2018,2019 Clark Williams + # (C) 2015,2016 Clark Williams +-- +2.20.1 + diff --git a/rt-tests.spec b/rt-tests.spec new file mode 100644 index 0000000000000000000000000000000000000000..f3f14d3ce20d37e82fd412884f883f03e7140b46 --- /dev/null +++ b/rt-tests.spec @@ -0,0 +1,107 @@ +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + +Summary: Programs that test various rt-features +Name: rt-tests +# These will be setup by the "make rpm" logic +# Version: 1.0 +# BuildRequires: numactl-devel +# Numa argument to make: NUMA=1 +# +Version: 1.5 +Release: 9%{?dist} +License: GPLv2 +Group: Development/Tools +URL: git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git +Source0: https://www.kernel.org/pub/linux/utils/rt-tests/%{name}-%{version}.tar.xz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Obsoletes: cyclictest signaltest pi_tests +ExclusiveArch: x86_64 +BuildRequires: numactl-devel python +Requires: bash python bc + +# Patches +Patch1: rt-tests-Makefile-do-not-use-python3-for-rhel7.8.patch +Patch2: rt-tests-hwlatdetect-use-python-instead-of-python3-f.patch +Patch3: rt-tests-Set-affinity-before-applying-numa.patch +Patch4: rt-tests-cyclictest.8-Remove-invalid-tracing-options.patch +Patch5: rt-tests-cyclictest-Make-tracemark-work-correctly-ag.patch +Patch6: rt-tests-cyclictest-Don-t-allow-OPT_SYSTEM-with-OPT_.patch +Patch7: pmqtest-Increase-buffer-to-avoid-overflow.patch +Patch8: sigwaittest-Increase-buffer-to-avoid-overflow.patch +Patch9: svsematest-Increase-buffer-to-avoid-overflow.patch +Patch10: deadline_test-Increase-buffer-to-avoid-overflow.patch +Patch11: rt-tests-cyclictest-Fix-warning-cpu-may-be-used-unin.patch +Patch12: rt-tests-cyclictest-Assume-libnuma-version-2-by-default.patch + +%description +rt-tests is a set of programs that test and measure various components of +real-time kernel behavior. This package measures timer, signal, and hardware +latency. It also tests the functioning of priority-inheritance mutexes. + +%prep +%setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 + +%build +make NUMA=1 HAVE_PARSE_CPUSTRING_ALL=1 + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT/%{python_sitelib} +make DESTDIR=$RPM_BUILD_ROOT prefix=/usr install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{python_sitelib}/hwlatdetect.py* +%caps(cap_sys_rawio+ep) /usr/bin/cyclictest +/usr/bin/pi_stress +/usr/bin/signaltest +/usr/bin/hwlatdetect +/usr/bin/rt-migrate-test +/usr/bin/pip_stress +/usr/bin/ptsematest +/usr/bin/sigwaittest +/usr/bin/svsematest +/usr/bin/pmqtest +/usr/bin/hackbench +/usr/bin/cyclicdeadline +/usr/bin/deadline_test +/usr/bin/determine_maximum_mpps.sh +/usr/bin/get_cpuinfo_mhz.sh +/usr/bin/queuelat +/usr/bin/ssdd + +%doc +/usr/share/man/man8/cyclictest.8.gz +/usr/share/man/man8/hackbench.8.gz +/usr/share/man/man8/hwlatdetect.8.gz +/usr/share/man/man8/pi_stress.8.gz +/usr/share/man/man8/pmqtest.8.gz +/usr/share/man/man8/ptsematest.8.gz +/usr/share/man/man8/rt-migrate-test.8.gz +/usr/share/man/man8/signaltest.8.gz +/usr/share/man/man8/sigwaittest.8.gz +/usr/share/man/man8/svsematest.8.gz +/usr/share/man/man8/deadline_test.8.gz +/usr/share/man/man8/pip_stress.8.gz +/usr/share/man/man8/queuelat.8.gz +/usr/share/man/man8/ssdd.8.gz + +%changelog +* Thur Feb 23 2023 liyulei - 1.5-9 +- Package init diff --git a/rt-tests.yaml b/rt-tests.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ccf9cbdd1146d2cb003064c9e20836b40210aff7 --- /dev/null +++ b/rt-tests.yaml @@ -0,0 +1,7 @@ +name: rt-tests +description: This repository contains some programs that test various rt-linux features. +upstream: https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git +branches: +- name: master + type: protected +type: public diff --git a/sigwaittest-Increase-buffer-to-avoid-overflow.patch b/sigwaittest-Increase-buffer-to-avoid-overflow.patch new file mode 100644 index 0000000000000000000000000000000000000000..a91e436197842f5e7eea6be65b454580174ec802 --- /dev/null +++ b/sigwaittest-Increase-buffer-to-avoid-overflow.patch @@ -0,0 +1,39 @@ +From 2d101866365ac75e29cfc9800ca569802fee64c7 Mon Sep 17 00:00:00 2001 +From: Daniel Wagner +Date: Mon, 19 Aug 2019 08:43:02 +0200 +Subject: [PATCH 02/10] sigwaittest: Increase buffer to avoid overflow +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Increase the size of the char buffer. gcc 9.1.1 reports: + +src/sigwaittest/sigwaittest.c:494:5: note: ‘sprintf’ output between 5 and 14 bytes into a destination of size 8 + 494 | sprintf(f_opt, "-fr%d", i); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ +src/sigwaittest/sigwaittest.c:522:24: warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size 5 [-Wformat-overflow=] + 522 | sprintf(f_opt, "-fs%d", i); + | ^~ + +Signed-off-by: Daniel Wagner +Signed-off-by: John Kacur +--- + src/sigwaittest/sigwaittest.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c +index 59f28a5babcb..2d0c04132fa7 100644 +--- a/src/sigwaittest/sigwaittest.c ++++ b/src/sigwaittest/sigwaittest.c +@@ -352,7 +352,7 @@ int main(int argc, char *argv[]) + struct params *sender = NULL; + sigset_t sigset; + void *param = NULL; +- char f_opt[8]; ++ char f_opt[14]; + struct timespec launchdelay, maindelay; + + process_options(argc, argv); +-- +2.20.1 + diff --git a/svsematest-Increase-buffer-to-avoid-overflow.patch b/svsematest-Increase-buffer-to-avoid-overflow.patch new file mode 100644 index 0000000000000000000000000000000000000000..93dee7dfb56622241d7bf126e6ea54f9e1903cd7 --- /dev/null +++ b/svsematest-Increase-buffer-to-avoid-overflow.patch @@ -0,0 +1,39 @@ +From 06519443224b7da5b336040f07bff8f929148426 Mon Sep 17 00:00:00 2001 +From: Daniel Wagner +Date: Mon, 19 Aug 2019 08:43:03 +0200 +Subject: [PATCH 03/10] svsematest: Increase buffer to avoid overflow +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Increase the size of the char buffer. gcc 9.1.1 reports: + +rc/svsematest/svsematest.c:578:24: warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size 5 [-Wformat-overflow=] + 578 | sprintf(f_opt, "-fr%d", i); + | ^~ +src/svsematest/svsematest.c:606:5: note: ‘sprintf’ output between 5 and 14 bytes into a destination of size 8 + 606 | sprintf(f_opt, "-fs%d", i); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Daniel Wagner +Signed-off-by: John Kacur +--- + src/svsematest/svsematest.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c +index 8f880786ec0f..15e36af76288 100644 +--- a/src/svsematest/svsematest.c ++++ b/src/svsematest/svsematest.c +@@ -401,7 +401,7 @@ int main(int argc, char *argv[]) + struct params *sender = NULL; + sigset_t sigset; + void *param = NULL; +- char f_opt[8]; ++ char f_opt[14]; + struct timespec launchdelay, maindelay; + + myfile = getenv("_"); +-- +2.20.1 +