1 |
commit: e5369437f34660b123a3f3ce79b0fea33bb48074 |
2 |
Author: Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de> |
3 |
AuthorDate: Mon Dec 27 19:51:24 2021 +0000 |
4 |
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 5 19:18:05 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5369437 |
7 |
|
8 |
dev-util/rt-tests: Bump to v2.3 |
9 |
|
10 |
Package-Manager: Portage-3.0.28, Repoman-3.0.3 |
11 |
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de> |
12 |
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> |
13 |
|
14 |
dev-util/rt-tests/Manifest | 1 + |
15 |
dev-util/rt-tests/files/rt-tests-2.3-musl.patch | 352 ++++++++++++++++++++++++ |
16 |
dev-util/rt-tests/rt-tests-2.3.ebuild | 38 +++ |
17 |
3 files changed, 391 insertions(+) |
18 |
|
19 |
diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest |
20 |
index 0617ddb9a281..b157404b489c 100644 |
21 |
--- a/dev-util/rt-tests/Manifest |
22 |
+++ b/dev-util/rt-tests/Manifest |
23 |
@@ -1 +1,2 @@ |
24 |
DIST rt-tests-2.2.tar.xz 115120 BLAKE2B 46db78d32b2d5830859757c21e42d4e21cb0da8b2ebcbf8ba738c8e3832a6ea597d686ee6c9cad23f269853ad188219f46a0e5326124f056b4822619076268ac SHA512 826dc8894dd8670e705566b5224f54bdee89e5b48f21ca00e6c4061f28c4fbe2dab14c1e1b1302fec7011dbf28f3eb88c1b8adc137fed7d17958ea972e3c08b1 |
25 |
+DIST rt-tests-2.3.tar.xz 115000 BLAKE2B d5f6a31a31340873348b5ffa6c706deb080e9686944a759fa4e4d53f2041d3f27aa1e9512d7413438bce7c61e05e2495c96eeef0b976ee09377f89d847225aef SHA512 3bf6fe95c5ac9911fb51fba1d4a8e6ad3b96a6cdce464372917673862801353cbbb377c76d3a19325f0b5402f65daf5c605e496d7460949615069366a00a978a |
26 |
|
27 |
diff --git a/dev-util/rt-tests/files/rt-tests-2.3-musl.patch b/dev-util/rt-tests/files/rt-tests-2.3-musl.patch |
28 |
new file mode 100644 |
29 |
index 000000000000..6732521a07a6 |
30 |
--- /dev/null |
31 |
+++ b/dev-util/rt-tests/files/rt-tests-2.3-musl.patch |
32 |
@@ -0,0 +1,352 @@ |
33 |
+From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001 |
34 |
+From: Kurt Kanzenbach <kurt@×××××××××××××.de> |
35 |
+Date: Wed, 1 Apr 2020 20:15:24 +0200 |
36 |
+Subject: [PATCH] all: Fix musl build |
37 |
+ |
38 |
+There are a few problems: |
39 |
+ |
40 |
+ * pi stress: pthread_attr_setaffinity_np() is not supported |
41 |
+ * cyclictest: SIGEV_THREAD_ID is not supported |
42 |
+ * hackbench: Fix include |
43 |
+ * all: Fix sched_* calls |
44 |
+ |
45 |
+With these changes applied, the rt-tests seem to run fine. |
46 |
+ |
47 |
+Signed-off-by: Kurt Kanzenbach <kurt@×××××××××××××.de> |
48 |
+--- |
49 |
+ Makefile | 5 -- |
50 |
+ src/backfire/sendme.c | 1 |
51 |
+ src/cyclictest/cyclictest.c | 70 ++++------------------------------ |
52 |
+ src/hackbench/hackbench.c | 4 + |
53 |
+ src/include/musl.h | 28 +++++++++++++ |
54 |
+ src/lib/rt-utils.c | 1 |
55 |
+ src/pi_tests/classic_pi.c | 2 |
56 |
+ src/pi_tests/tst-mutexpi10.c | 2 |
57 |
+ src/pmqtest/pmqtest.c | 1 |
58 |
+ src/ptsematest/ptsematest.c | 1 |
59 |
+ src/rt-migrate-test/rt-migrate-test.c | 1 |
60 |
+ src/sched_deadline/cyclicdeadline.c | 1 |
61 |
+ 12 files changed, 50 insertions(+), 67 deletions(-) |
62 |
+ create mode 100644 src/include/musl.h |
63 |
+ |
64 |
+--- a/Makefile |
65 |
++++ b/Makefile |
66 |
+@@ -7,7 +7,6 @@ OBJDIR = bld |
67 |
+ sources = cyclictest.c \ |
68 |
+ hackbench.c \ |
69 |
+ pip_stress.c \ |
70 |
+- pi_stress.c \ |
71 |
+ pmqtest.c \ |
72 |
+ ptsematest.c \ |
73 |
+ rt-migrate-test.c \ |
74 |
+@@ -42,7 +41,6 @@ ifeq (${PYLIB},) |
75 |
+ endif |
76 |
+ |
77 |
+ MANPAGES = src/cyclictest/cyclictest.8 \ |
78 |
+- src/pi_tests/pi_stress.8 \ |
79 |
+ src/ptsematest/ptsematest.8 \ |
80 |
+ src/rt-migrate-test/rt-migrate-test.8 \ |
81 |
+ src/sigwaittest/sigwaittest.8 \ |
82 |
+@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o |
83 |
+ signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a |
84 |
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA) |
85 |
+ |
86 |
+-pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a |
87 |
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) |
88 |
+- |
89 |
+ hwlatdetect: src/hwlatdetect/hwlatdetect.py |
90 |
+ chmod +x src/hwlatdetect/hwlatdetect.py |
91 |
+ ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect |
92 |
+--- a/src/backfire/sendme.c |
93 |
++++ b/src/backfire/sendme.c |
94 |
+@@ -29,6 +29,7 @@ |
95 |
+ #include <string.h> |
96 |
+ #include <time.h> |
97 |
+ #include <errno.h> |
98 |
++#include "musl.h" |
99 |
+ #include "rt-utils.h" |
100 |
+ #include "rt-get_cpu.h" |
101 |
+ |
102 |
+--- a/src/cyclictest/cyclictest.c |
103 |
++++ b/src/cyclictest/cyclictest.c |
104 |
+@@ -33,6 +33,7 @@ |
105 |
+ #include <sys/utsname.h> |
106 |
+ #include <sys/mman.h> |
107 |
+ #include <sys/syscall.h> |
108 |
++#include "musl.h" |
109 |
+ #include "rt_numa.h" |
110 |
+ |
111 |
+ #include "rt-utils.h" |
112 |
+@@ -504,12 +505,8 @@ static void *timerthread(void *param) |
113 |
+ { |
114 |
+ struct thread_param *par = param; |
115 |
+ struct sched_param schedp; |
116 |
+- struct sigevent sigev; |
117 |
+ sigset_t sigset; |
118 |
+- timer_t timer; |
119 |
+ struct timespec now, next, interval, stop = { 0 }; |
120 |
+- struct itimerval itimer; |
121 |
+- struct itimerspec tspec; |
122 |
+ struct thread_stat *stat = par->stats; |
123 |
+ int stopped = 0; |
124 |
+ cpu_set_t mask; |
125 |
+@@ -538,14 +535,6 @@ static void *timerthread(void *param) |
126 |
+ sigaddset(&sigset, par->signal); |
127 |
+ sigprocmask(SIG_BLOCK, &sigset, NULL); |
128 |
+ |
129 |
+- if (par->mode == MODE_CYCLIC) { |
130 |
+- sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL; |
131 |
+- sigev.sigev_signo = par->signal; |
132 |
+- sigev.sigev_notify_thread_id = stat->tid; |
133 |
+- timer_create(par->clock, &sigev, &timer); |
134 |
+- tspec.it_interval = interval; |
135 |
+- } |
136 |
+- |
137 |
+ memset(&schedp, 0, sizeof(schedp)); |
138 |
+ schedp.sched_priority = par->prio; |
139 |
+ if (setscheduler(0, par->policy, &schedp)) |
140 |
+@@ -599,20 +588,6 @@ static void *timerthread(void *param) |
141 |
+ stop = now; |
142 |
+ stop.tv_sec += duration; |
143 |
+ } |
144 |
+- if (par->mode == MODE_CYCLIC) { |
145 |
+- if (par->timermode == TIMER_ABSTIME) |
146 |
+- tspec.it_value = next; |
147 |
+- else |
148 |
+- tspec.it_value = interval; |
149 |
+- timer_settime(timer, par->timermode, &tspec, NULL); |
150 |
+- } |
151 |
+- |
152 |
+- if (par->mode == MODE_SYS_ITIMER) { |
153 |
+- itimer.it_interval.tv_sec = interval.tv_sec; |
154 |
+- itimer.it_interval.tv_usec = interval.tv_nsec / 1000; |
155 |
+- itimer.it_value = itimer.it_interval; |
156 |
+- setitimer(ITIMER_REAL, &itimer, NULL); |
157 |
+- } |
158 |
+ |
159 |
+ stat->threadstarted++; |
160 |
+ |
161 |
+@@ -620,16 +595,10 @@ static void *timerthread(void *param) |
162 |
+ |
163 |
+ uint64_t diff; |
164 |
+ unsigned long diff_smi = 0; |
165 |
+- int sigs, ret; |
166 |
++ int ret; |
167 |
+ |
168 |
+ /* Wait for next period */ |
169 |
+ switch (par->mode) { |
170 |
+- case MODE_CYCLIC: |
171 |
+- case MODE_SYS_ITIMER: |
172 |
+- if (sigwait(&sigset, &sigs) < 0) |
173 |
+- goto out; |
174 |
+- break; |
175 |
+- |
176 |
+ case MODE_CLOCK_NANOSLEEP: |
177 |
+ if (par->timermode == TIMER_ABSTIME) { |
178 |
+ ret = clock_nanosleep(par->clock, TIMER_ABSTIME, |
179 |
+@@ -750,11 +719,6 @@ static void *timerthread(void *param) |
180 |
+ |
181 |
+ next.tv_sec += interval.tv_sec; |
182 |
+ next.tv_nsec += interval.tv_nsec; |
183 |
+- if (par->mode == MODE_CYCLIC) { |
184 |
+- int overrun_count = timer_getoverrun(timer); |
185 |
+- next.tv_sec += overrun_count * interval.tv_sec; |
186 |
+- next.tv_nsec += overrun_count * interval.tv_nsec; |
187 |
+- } |
188 |
+ tsnorm(&next); |
189 |
+ |
190 |
+ while (tsgreater(&now, &next)) { |
191 |
+@@ -779,17 +743,6 @@ out: |
192 |
+ pthread_mutex_unlock(&refresh_on_max_lock); |
193 |
+ } |
194 |
+ |
195 |
+- if (par->mode == MODE_CYCLIC) |
196 |
+- timer_delete(timer); |
197 |
+- |
198 |
+- if (par->mode == MODE_SYS_ITIMER) { |
199 |
+- itimer.it_value.tv_sec = 0; |
200 |
+- itimer.it_value.tv_usec = 0; |
201 |
+- itimer.it_interval.tv_sec = 0; |
202 |
+- itimer.it_interval.tv_usec = 0; |
203 |
+- setitimer(ITIMER_REAL, &itimer, NULL); |
204 |
+- } |
205 |
+- |
206 |
+ /* close msr file */ |
207 |
+ if (smi) |
208 |
+ close(par->msr_fd); |
209 |
+@@ -1183,7 +1136,8 @@ static void process_options(int argc, ch |
210 |
+ case OPT_VERBOSE: verbose = 1; break; |
211 |
+ case 'x': |
212 |
+ case OPT_POSIX_TIMERS: |
213 |
+- use_nanosleep = MODE_CYCLIC; break; |
214 |
++ fatal("--posix_timers is not available on your libc\n"); |
215 |
++ break; |
216 |
+ case '?': |
217 |
+ case OPT_HELP: |
218 |
+ display_help(0); break; |
219 |
+@@ -1216,13 +1170,6 @@ static void process_options(int argc, ch |
220 |
+ } |
221 |
+ } |
222 |
+ |
223 |
+- if ((use_system == MODE_SYS_OFFSET) && (use_nanosleep == MODE_CYCLIC)) { |
224 |
+- warn("The system option requires clock_nanosleep\n"); |
225 |
+- warn("and is not compatible with posix_timers\n"); |
226 |
+- warn("Using clock_nanosleep\n"); |
227 |
+- use_nanosleep = MODE_CLOCK_NANOSLEEP; |
228 |
+- } |
229 |
+- |
230 |
+ /* if smp wasn't requested, test for numa automatically */ |
231 |
+ if (!smp) { |
232 |
+ numa = numa_initialize(); |
233 |
+@@ -1952,7 +1899,6 @@ int main(int argc, char **argv) |
234 |
+ |
235 |
+ } |
236 |
+ |
237 |
+- |
238 |
+ mode = use_nanosleep + use_system; |
239 |
+ |
240 |
+ sigemptyset(&sigset); |
241 |
+@@ -2002,16 +1948,18 @@ int main(int argc, char **argv) |
242 |
+ void *stack; |
243 |
+ void *currstk; |
244 |
+ size_t stksize; |
245 |
++ int err; |
246 |
+ |
247 |
+ /* find the memory node associated with the cpu i */ |
248 |
+ node = rt_numa_numa_node_of_cpu(cpu); |
249 |
+ |
250 |
+- /* get the stack size set for this thread */ |
251 |
+- if (pthread_attr_getstack(&attr, &currstk, &stksize)) |
252 |
++ /* get the stack size set for for this thread */ |
253 |
++ err = pthread_attr_getstack(&attr, &currstk, &stksize); |
254 |
++ if (err != EINVAL) |
255 |
+ fatal("failed to get stack size for thread %d\n", i); |
256 |
+ |
257 |
+ /* if the stack size is zero, set a default */ |
258 |
+- if (stksize == 0) |
259 |
++ if (err == EINVAL || stksize == 0) |
260 |
+ stksize = PTHREAD_STACK_MIN * 2; |
261 |
+ |
262 |
+ /* allocate memory for a stack on appropriate node */ |
263 |
+--- a/src/hackbench/hackbench.c |
264 |
++++ b/src/hackbench/hackbench.c |
265 |
+@@ -24,13 +24,15 @@ |
266 |
+ #include <sys/socket.h> |
267 |
+ #include <sys/wait.h> |
268 |
+ #include <sys/time.h> |
269 |
+-#include <sys/poll.h> |
270 |
++#include <poll.h> |
271 |
+ #include <limits.h> |
272 |
+ #include <getopt.h> |
273 |
+ #include <signal.h> |
274 |
+ #include <setjmp.h> |
275 |
+ #include <sched.h> |
276 |
+ |
277 |
++#include "musl.h" |
278 |
++ |
279 |
+ static unsigned int datasize = 100; |
280 |
+ static unsigned int loops = 100; |
281 |
+ static unsigned int num_groups = 10; |
282 |
+--- /dev/null |
283 |
++++ b/src/include/musl.h |
284 |
+@@ -0,0 +1,28 @@ |
285 |
++/* |
286 |
++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@×××××××××××××.de> |
287 |
++ * Time-stamp: <2020-04-04 10:54:01 kurt> |
288 |
++ */ |
289 |
++ |
290 |
++#ifndef _MUSL_H_ |
291 |
++#define _MUSL_H_ |
292 |
++ |
293 |
++#include <unistd.h> |
294 |
++#include <sys/syscall.h> |
295 |
++ |
296 |
++/* |
297 |
++ * Musl someshow defines sched_* to ENOSYS which is not correct ... |
298 |
++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)") |
299 |
++ * |
300 |
++ * Workaround: define them to syscall(...) |
301 |
++ */ |
302 |
++ |
303 |
++#define sched_getparam(pid, param) \ |
304 |
++ syscall(SYS_sched_getparam, pid, param) |
305 |
++#define sched_setparam(pid, param) \ |
306 |
++ syscall(SYS_sched_setparam, pid, param) |
307 |
++#define sched_getscheduler(pid) \ |
308 |
++ syscall(SYS_sched_getscheduler, pid) |
309 |
++#define sched_setscheduler(pid, policy, param) \ |
310 |
++ syscall(SYS_sched_setscheduler, pid, policy, param) |
311 |
++ |
312 |
++#endif /* _MUSL_H_ */ |
313 |
+--- a/src/lib/rt-utils.c |
314 |
++++ b/src/lib/rt-utils.c |
315 |
+@@ -24,6 +24,7 @@ |
316 |
+ #include <time.h> |
317 |
+ #include <sys/time.h> |
318 |
+ |
319 |
++#include "musl.h" |
320 |
+ #include "rt-utils.h" |
321 |
+ #include "rt-sched.h" |
322 |
+ #include "rt-error.h" |
323 |
+--- a/src/pi_tests/classic_pi.c |
324 |
++++ b/src/pi_tests/classic_pi.c |
325 |
+@@ -34,6 +34,8 @@ |
326 |
+ #include <signal.h> |
327 |
+ #include <getopt.h> |
328 |
+ |
329 |
++#include "musl.h" |
330 |
++ |
331 |
+ /* test timeout */ |
332 |
+ #define TIMEOUT 2 |
333 |
+ |
334 |
+--- a/src/pi_tests/tst-mutexpi10.c |
335 |
++++ b/src/pi_tests/tst-mutexpi10.c |
336 |
+@@ -35,6 +35,8 @@ |
337 |
+ #include <string.h> |
338 |
+ #include <signal.h> |
339 |
+ |
340 |
++#include "musl.h" |
341 |
++ |
342 |
+ /* test timeout */ |
343 |
+ #define TIMEOUT 2 |
344 |
+ |
345 |
+--- a/src/pmqtest/pmqtest.c |
346 |
++++ b/src/pmqtest/pmqtest.c |
347 |
+@@ -24,6 +24,7 @@ |
348 |
+ #include <pthread.h> |
349 |
+ #include <inttypes.h> |
350 |
+ |
351 |
++#include "musl.h" |
352 |
+ #include "rt-utils.h" |
353 |
+ #include "rt-get_cpu.h" |
354 |
+ #include "rt-error.h" |
355 |
+--- a/src/ptsematest/ptsematest.c |
356 |
++++ b/src/ptsematest/ptsematest.c |
357 |
+@@ -22,6 +22,7 @@ |
358 |
+ #include <pthread.h> |
359 |
+ #include <inttypes.h> |
360 |
+ |
361 |
++#include "musl.h" |
362 |
+ #include "rt-utils.h" |
363 |
+ #include "rt-get_cpu.h" |
364 |
+ #include "rt-error.h" |
365 |
+--- a/src/rt-migrate-test/rt-migrate-test.c |
366 |
++++ b/src/rt-migrate-test/rt-migrate-test.c |
367 |
+@@ -27,6 +27,7 @@ |
368 |
+ |
369 |
+ #include <linux/unistd.h> |
370 |
+ |
371 |
++#include "musl.h" |
372 |
+ #include "rt-utils.h" |
373 |
+ |
374 |
+ int nr_tasks; |
375 |
+--- a/src/sched_deadline/cyclicdeadline.c |
376 |
++++ b/src/sched_deadline/cyclicdeadline.c |
377 |
+@@ -30,6 +30,7 @@ |
378 |
+ #include <linux/unistd.h> |
379 |
+ #include <linux/magic.h> |
380 |
+ |
381 |
++#include "musl.h" |
382 |
+ #include "rt-utils.h" |
383 |
+ #include "rt-sched.h" |
384 |
+ #include "rt-error.h" |
385 |
|
386 |
diff --git a/dev-util/rt-tests/rt-tests-2.3.ebuild b/dev-util/rt-tests/rt-tests-2.3.ebuild |
387 |
new file mode 100644 |
388 |
index 000000000000..247753110450 |
389 |
--- /dev/null |
390 |
+++ b/dev-util/rt-tests/rt-tests-2.3.ebuild |
391 |
@@ -0,0 +1,38 @@ |
392 |
+# Copyright 1999-2021 Gentoo Authors |
393 |
+# Distributed under the terms of the GNU General Public License v2 |
394 |
+ |
395 |
+EAPI=8 |
396 |
+ |
397 |
+PYTHON_COMPAT=( python3_{7..10} ) |
398 |
+ |
399 |
+inherit python-single-r1 toolchain-funcs |
400 |
+ |
401 |
+DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel" |
402 |
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/" |
403 |
+SRC_URI=" |
404 |
+ https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz |
405 |
+ https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz" |
406 |
+ |
407 |
+LICENSE="GPL-2 GPL-2+ LGPL-2.1+" |
408 |
+SLOT="0" |
409 |
+KEYWORDS="~amd64 ~arm64 ~x86" |
410 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
411 |
+ |
412 |
+DEPEND="${PYTHON_DEPS} |
413 |
+ sys-process/numactl" |
414 |
+RDEPEND="${DEPEND}" |
415 |
+ |
416 |
+src_prepare() { |
417 |
+ default |
418 |
+ use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch" |
419 |
+} |
420 |
+ |
421 |
+src_compile() { |
422 |
+ emake CC="$(tc-getCC)" AR="$(tc-getAR)" |
423 |
+} |
424 |
+ |
425 |
+src_install() { |
426 |
+ emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install |
427 |
+ python_fix_shebang "${ED}" |
428 |
+ python_optimize |
429 |
+} |