Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/, dev-util/rt-tests/files/
Date: Wed, 14 Jul 2021 14:32:56
Message-Id: 1626273161.ab611d79e64413cfc6f6b527ad4f7cce1c4a83e1.juippis@gentoo
1 commit: ab611d79e64413cfc6f6b527ad4f7cce1c4a83e1
2 Author: Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
3 AuthorDate: Sun Jul 4 06:52:18 2021 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 14 14:32:41 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab611d79
7
8 dev-util/rt-tests: Drop old
9
10 Package-Manager: Portage-3.0.20, Repoman-3.0.2
11 Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
12 Closes: https://github.com/gentoo/gentoo/pull/21460
13 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
14
15 dev-util/rt-tests/Manifest | 2 -
16 dev-util/rt-tests/files/rt-tests-1.10-musl.patch | 381 -----------------------
17 dev-util/rt-tests/files/rt-tests-2.0-musl.patch | 352 ---------------------
18 dev-util/rt-tests/rt-tests-1.10.ebuild | 38 ---
19 dev-util/rt-tests/rt-tests-2.0.ebuild | 38 ---
20 5 files changed, 811 deletions(-)
21
22 diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
23 index aa57879e254..7b3e4970e1a 100644
24 --- a/dev-util/rt-tests/Manifest
25 +++ b/dev-util/rt-tests/Manifest
26 @@ -1,3 +1 @@
27 -DIST rt-tests-1.10.tar.xz 112300 BLAKE2B b38a7357b1402de94661014e71ed9fc48d9dde6cabbe72ed4031841b57f7fb76a01dda03c7888f11d8e5e9c11cda8281dae1b437f0d1ff971d2941547f659103 SHA512 9512419b364746ad490894c7184a391f0e8d571477ad636abff8ed473151c6f2c263475ca4aa7d498e81c18e17e42ae82260693b90bce4ef9889e0eaf0b77b58
28 -DIST rt-tests-2.0.tar.xz 114944 BLAKE2B 809224e6d480b098ed398c0646070f18aa25e8947485709ff309c4a2ee289797924e6df39ac2af68b91b2df064642d56bd8f7aa7332764d95d53e7d9a34d4ca7 SHA512 6c582734eb41f7addaac7d0f3dbb313e3af30eb2b662781f6c62dbaf13da2e84f36a6f918f11608406ca2a08636df93375272444a2cdf205e782ec9f4bc45dca
29 DIST rt-tests-2.1.tar.xz 114892 BLAKE2B 25a382c898ffdbbe7b6c3f69f440b87ca6b88cc634aae06a3e02154954b8b50da46e2f2b3291d7473bb0ae533f5a90a7769433650bab3f7c229a5d3022e32b50 SHA512 7abab6c1191247ac44f4e5193752474756d82fdf1d8a3b69c92c8d37bd4fe8458444d2165894fc8483590809ff5b4f1c755d66afb296e72041f9efbedd048d0d
30
31 diff --git a/dev-util/rt-tests/files/rt-tests-1.10-musl.patch b/dev-util/rt-tests/files/rt-tests-1.10-musl.patch
32 deleted file mode 100644
33 index 2dc17d50492..00000000000
34 --- a/dev-util/rt-tests/files/rt-tests-1.10-musl.patch
35 +++ /dev/null
36 @@ -1,381 +0,0 @@
37 -From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
38 -From: Kurt Kanzenbach <kurt@×××××××××××××.de>
39 -Date: Wed, 1 Apr 2020 20:15:24 +0200
40 -Subject: [PATCH] all: Fix musl build
41 -
42 -There are a few problems:
43 -
44 - * pi stress: pthread_attr_setaffinity_np() is not supported
45 - * cyclictest: SIGEV_THREAD_ID is not supported
46 - * hackbench: Fix include
47 - * all: Fix sched_* calls
48 -
49 -With these changes applied, the rt-tests seem to run fine.
50 -
51 -Signed-off-by: Kurt Kanzenbach <kurt@×××××××××××××.de>
52 ----
53 - Makefile | 5 --
54 - src/backfire/sendme.c | 1 +
55 - src/cyclictest/cyclictest.c | 70 ++++-----------------------
56 - src/hackbench/hackbench.c | 4 +-
57 - src/include/musl.h | 28 +++++++++++
58 - src/lib/rt-utils.c | 1 +
59 - src/pi_tests/classic_pi.c | 2 +
60 - src/pi_tests/tst-mutexpi10.c | 2 +
61 - src/pmqtest/pmqtest.c | 1 +
62 - src/ptsematest/ptsematest.c | 1 +
63 - src/rt-migrate-test/rt-migrate-test.c | 1 +
64 - src/sched_deadline/cyclicdeadline.c | 2 +
65 - 12 files changed, 51 insertions(+), 67 deletions(-)
66 - create mode 100644 src/include/musl.h
67 -
68 -diff --git a/Makefile b/Makefile
69 -index 636f1914a777..01732ee2647f 100644
70 ---- a/Makefile
71 -+++ b/Makefile
72 -@@ -7,7 +7,6 @@ OBJDIR = bld
73 - sources = cyclictest.c \
74 - hackbench.c \
75 - pip_stress.c \
76 -- pi_stress.c \
77 - pmqtest.c \
78 - ptsematest.c \
79 - rt-migrate-test.c \
80 -@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
81 - endif
82 -
83 - MANPAGES = src/cyclictest/cyclictest.8 \
84 -- src/pi_tests/pi_stress.8 \
85 - src/ptsematest/ptsematest.8 \
86 - src/rt-migrate-test/rt-migrate-test.8 \
87 - src/sigwaittest/sigwaittest.8 \
88 -@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o $(OBJDIR)/librttest.a
89 - signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
90 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
91 -
92 --pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
93 -- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
94 --
95 - hwlatdetect: src/hwlatdetect/hwlatdetect.py
96 - chmod +x src/hwlatdetect/hwlatdetect.py
97 - ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
98 -diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c
99 -index d963723b1c93..b355bbbcfece 100644
100 ---- a/src/backfire/sendme.c
101 -+++ b/src/backfire/sendme.c
102 -@@ -31,6 +31,7 @@
103 - #include <errno.h>
104 - #include "rt-utils.h"
105 - #include "rt-get_cpu.h"
106 -+#include "musl.h"
107 -
108 - #include <utmpx.h>
109 - #include <sys/types.h>
110 -diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
111 -index f38c453f1975..b6b91218f756 100644
112 ---- a/src/cyclictest/cyclictest.c
113 -+++ b/src/cyclictest/cyclictest.c
114 -@@ -37,6 +37,7 @@
115 -
116 - #include "rt-utils.h"
117 - #include "rt-numa.h"
118 -+#include "musl.h"
119 -
120 - #include <bionic.h>
121 -
122 -@@ -500,12 +501,8 @@ static void *timerthread(void *param)
123 - {
124 - struct thread_param *par = param;
125 - struct sched_param schedp;
126 -- struct sigevent sigev;
127 - sigset_t sigset;
128 -- timer_t timer;
129 - struct timespec now, next, interval, stop;
130 -- struct itimerval itimer;
131 -- struct itimerspec tspec;
132 - struct thread_stat *stat = par->stats;
133 - int stopped = 0;
134 - cpu_set_t mask;
135 -@@ -536,14 +533,6 @@ static void *timerthread(void *param)
136 - sigaddset(&sigset, par->signal);
137 - sigprocmask(SIG_BLOCK, &sigset, NULL);
138 -
139 -- if (par->mode == MODE_CYCLIC) {
140 -- sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
141 -- sigev.sigev_signo = par->signal;
142 -- sigev.sigev_notify_thread_id = stat->tid;
143 -- timer_create(par->clock, &sigev, &timer);
144 -- tspec.it_interval = interval;
145 -- }
146 --
147 - memset(&schedp, 0, sizeof(schedp));
148 - schedp.sched_priority = par->prio;
149 - if (setscheduler(0, par->policy, &schedp))
150 -@@ -598,20 +587,6 @@ static void *timerthread(void *param)
151 - stop = now;
152 - stop.tv_sec += duration;
153 - }
154 -- if (par->mode == MODE_CYCLIC) {
155 -- if (par->timermode == TIMER_ABSTIME)
156 -- tspec.it_value = next;
157 -- else
158 -- tspec.it_value = interval;
159 -- timer_settime(timer, par->timermode, &tspec, NULL);
160 -- }
161 --
162 -- if (par->mode == MODE_SYS_ITIMER) {
163 -- itimer.it_interval.tv_sec = interval.tv_sec;
164 -- itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
165 -- itimer.it_value = itimer.it_interval;
166 -- setitimer(ITIMER_REAL, &itimer, NULL);
167 -- }
168 -
169 - stat->threadstarted++;
170 -
171 -@@ -619,16 +594,10 @@ static void *timerthread(void *param)
172 -
173 - uint64_t diff;
174 - unsigned long diff_smi = 0;
175 -- int sigs, ret;
176 -+ int ret;
177 -
178 - /* Wait for next period */
179 - switch (par->mode) {
180 -- case MODE_CYCLIC:
181 -- case MODE_SYS_ITIMER:
182 -- if (sigwait(&sigset, &sigs) < 0)
183 -- goto out;
184 -- break;
185 --
186 - case MODE_CLOCK_NANOSLEEP:
187 - if (par->timermode == TIMER_ABSTIME) {
188 - ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
189 -@@ -749,11 +718,6 @@ static void *timerthread(void *param)
190 -
191 - next.tv_sec += interval.tv_sec;
192 - next.tv_nsec += interval.tv_nsec;
193 -- if (par->mode == MODE_CYCLIC) {
194 -- int overrun_count = timer_getoverrun(timer);
195 -- next.tv_sec += overrun_count * interval.tv_sec;
196 -- next.tv_nsec += overrun_count * interval.tv_nsec;
197 -- }
198 - tsnorm(&next);
199 -
200 - while (tsgreater(&now, &next)) {
201 -@@ -778,17 +742,6 @@ out:
202 - pthread_mutex_unlock(&refresh_on_max_lock);
203 - }
204 -
205 -- if (par->mode == MODE_CYCLIC)
206 -- timer_delete(timer);
207 --
208 -- if (par->mode == MODE_SYS_ITIMER) {
209 -- itimer.it_value.tv_sec = 0;
210 -- itimer.it_value.tv_usec = 0;
211 -- itimer.it_interval.tv_sec = 0;
212 -- itimer.it_interval.tv_usec = 0;
213 -- setitimer(ITIMER_REAL, &itimer, NULL);
214 -- }
215 --
216 - /* close msr file */
217 - if (smi)
218 - close(par->msr_fd);
219 -@@ -1159,7 +1112,8 @@ static void process_options(int argc, char *argv[], int max_cpus)
220 - case OPT_VERBOSE: verbose = 1; break;
221 - case 'x':
222 - case OPT_POSIX_TIMERS:
223 -- use_nanosleep = MODE_CYCLIC; break;
224 -+ fatal("--posix_timers is not available on your libc\n");
225 -+ break;
226 - case '?':
227 - case OPT_HELP:
228 - display_help(0); break;
229 -@@ -1192,13 +1146,6 @@ static void process_options(int argc, char *argv[], int max_cpus)
230 - }
231 - }
232 -
233 -- if ((use_system == MODE_SYS_OFFSET) && (use_nanosleep == MODE_CYCLIC)) {
234 -- warn("The system option requires clock_nanosleep\n");
235 -- warn("and is not compatible with posix_timers\n");
236 -- warn("Using clock_nanosleep\n");
237 -- use_nanosleep = MODE_CLOCK_NANOSLEEP;
238 -- }
239 --
240 - /* if smp wasn't requested, test for numa automatically */
241 - if (!smp) {
242 - if (numa_initialize())
243 -@@ -1881,7 +1828,6 @@ int main(int argc, char **argv)
244 -
245 - }
246 -
247 --
248 - mode = use_nanosleep + use_system;
249 -
250 - sigemptyset(&sigset);
251 -@@ -1931,16 +1877,18 @@ int main(int argc, char **argv)
252 - void *stack;
253 - void *currstk;
254 - size_t stksize;
255 -+ int err;
256 -
257 - /* find the memory node associated with the cpu i */
258 - node = rt_numa_numa_node_of_cpu(cpu);
259 -
260 -- /* get the stack size set for this thread */
261 -- if (pthread_attr_getstack(&attr, &currstk, &stksize))
262 -+ /* get the stack size set for for this thread */
263 -+ err = pthread_attr_getstack(&attr, &currstk, &stksize);
264 -+ if (err != EINVAL)
265 - fatal("failed to get stack size for thread %d\n", i);
266 -
267 - /* if the stack size is zero, set a default */
268 -- if (stksize == 0)
269 -+ if (err == EINVAL || stksize == 0)
270 - stksize = PTHREAD_STACK_MIN * 2;
271 -
272 - /* allocate memory for a stack on appropriate node */
273 -diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
274 -index 268c23233004..bbbb29a3a430 100644
275 ---- a/src/hackbench/hackbench.c
276 -+++ b/src/hackbench/hackbench.c
277 -@@ -24,13 +24,15 @@
278 - #include <sys/socket.h>
279 - #include <sys/wait.h>
280 - #include <sys/time.h>
281 --#include <sys/poll.h>
282 -+#include <poll.h>
283 - #include <limits.h>
284 - #include <getopt.h>
285 - #include <signal.h>
286 - #include <setjmp.h>
287 - #include <sched.h>
288 -
289 -+#include "musl.h"
290 -+
291 - static unsigned int datasize = 100;
292 - static unsigned int loops = 100;
293 - static unsigned int num_groups = 10;
294 -diff --git a/src/include/musl.h b/src/include/musl.h
295 -new file mode 100644
296 -index 000000000000..ea5075e768c8
297 ---- /dev/null
298 -+++ b/src/include/musl.h
299 -@@ -0,0 +1,28 @@
300 -+/*
301 -+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@×××××××××××××.de>
302 -+ * Time-stamp: <2020-04-04 10:54:01 kurt>
303 -+ */
304 -+
305 -+#ifndef _MUSL_H_
306 -+#define _MUSL_H_
307 -+
308 -+#include <unistd.h>
309 -+#include <sys/syscall.h>
310 -+
311 -+/*
312 -+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
313 -+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
314 -+ *
315 -+ * Workaround: define them to syscall(...)
316 -+ */
317 -+
318 -+#define sched_getparam(pid, param) \
319 -+ syscall(SYS_sched_getparam, pid, param)
320 -+#define sched_setparam(pid, param) \
321 -+ syscall(SYS_sched_setparam, pid, param)
322 -+#define sched_getscheduler(pid) \
323 -+ syscall(SYS_sched_getscheduler, pid)
324 -+#define sched_setscheduler(pid, policy, param) \
325 -+ syscall(SYS_sched_setscheduler, pid, policy, param)
326 -+
327 -+#endif /* _MUSL_H_ */
328 -diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
329 -index 2d68d62cd875..529d427c8084 100644
330 ---- a/src/lib/rt-utils.c
331 -+++ b/src/lib/rt-utils.c
332 -@@ -23,6 +23,7 @@
333 - #include "rt-utils.h"
334 - #include "rt-sched.h"
335 - #include "error.h"
336 -+#include "musl.h"
337 -
338 - #define TRACEBUFSIZ 1024
339 -
340 -diff --git a/src/pi_tests/classic_pi.c b/src/pi_tests/classic_pi.c
341 -index 64af8890276f..bb088d3973b2 100644
342 ---- a/src/pi_tests/classic_pi.c
343 -+++ b/src/pi_tests/classic_pi.c
344 -@@ -34,6 +34,8 @@
345 - #include <signal.h>
346 - #include <getopt.h>
347 -
348 -+#include "musl.h"
349 -+
350 - /* test timeout */
351 - #define TIMEOUT 2
352 -
353 -diff --git a/src/pi_tests/tst-mutexpi10.c b/src/pi_tests/tst-mutexpi10.c
354 -index 97a345edd26e..1028d344edff 100644
355 ---- a/src/pi_tests/tst-mutexpi10.c
356 -+++ b/src/pi_tests/tst-mutexpi10.c
357 -@@ -35,6 +35,8 @@
358 - #include <string.h>
359 - #include <signal.h>
360 -
361 -+#include "musl.h"
362 -+
363 - /* test timeout */
364 - #define TIMEOUT 2
365 -
366 -diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
367 -index 5f7a24d55db6..555679cf36ef 100644
368 ---- a/src/pmqtest/pmqtest.c
369 -+++ b/src/pmqtest/pmqtest.c
370 -@@ -24,6 +24,7 @@
371 - #include "rt-utils.h"
372 - #include "rt-get_cpu.h"
373 - #include "error.h"
374 -+#include "musl.h"
375 -
376 - #include <pthread.h>
377 -
378 -diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
379 -index 2e392299fdc4..b45d35755865 100644
380 ---- a/src/ptsematest/ptsematest.c
381 -+++ b/src/ptsematest/ptsematest.c
382 -@@ -22,6 +22,7 @@
383 - #include "rt-utils.h"
384 - #include "rt-get_cpu.h"
385 - #include "error.h"
386 -+#include "musl.h"
387 -
388 - #include <pthread.h>
389 -
390 -diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
391 -index 9bf716c9178c..f51d388d9150 100644
392 ---- a/src/rt-migrate-test/rt-migrate-test.c
393 -+++ b/src/rt-migrate-test/rt-migrate-test.c
394 -@@ -25,6 +25,7 @@
395 - #include <sched.h>
396 - #include <pthread.h>
397 - #include "rt-utils.h"
398 -+#include "musl.h"
399 -
400 - int nr_tasks;
401 - int lfd;
402 -diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
403 -index 98eb367248ac..45b27f72a5a7 100644
404 ---- a/src/sched_deadline/cyclicdeadline.c
405 -+++ b/src/sched_deadline/cyclicdeadline.c
406 -@@ -34,6 +34,8 @@
407 - #include <rt-sched.h>
408 - #include <error.h>
409 -
410 -+#include "musl.h"
411 -+
412 - #define _STR(x) #x
413 - #define STR(x) _STR(x)
414 - #ifndef MAXPATH
415 ---
416 -2.26.2
417 -
418
419 diff --git a/dev-util/rt-tests/files/rt-tests-2.0-musl.patch b/dev-util/rt-tests/files/rt-tests-2.0-musl.patch
420 deleted file mode 100644
421 index 4c97c640a5c..00000000000
422 --- a/dev-util/rt-tests/files/rt-tests-2.0-musl.patch
423 +++ /dev/null
424 @@ -1,352 +0,0 @@
425 -From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
426 -From: Kurt Kanzenbach <kurt@×××××××××××××.de>
427 -Date: Wed, 1 Apr 2020 20:15:24 +0200
428 -Subject: [PATCH] all: Fix musl build
429 -
430 -There are a few problems:
431 -
432 - * pi stress: pthread_attr_setaffinity_np() is not supported
433 - * cyclictest: SIGEV_THREAD_ID is not supported
434 - * hackbench: Fix include
435 - * all: Fix sched_* calls
436 -
437 -With these changes applied, the rt-tests seem to run fine.
438 -
439 -Signed-off-by: Kurt Kanzenbach <kurt@×××××××××××××.de>
440 ----
441 - Makefile | 5 --
442 - src/backfire/sendme.c | 1
443 - src/cyclictest/cyclictest.c | 70 ++++------------------------------
444 - src/hackbench/hackbench.c | 4 +
445 - src/include/musl.h | 28 +++++++++++++
446 - src/lib/rt-utils.c | 1
447 - src/pi_tests/classic_pi.c | 2
448 - src/pi_tests/tst-mutexpi10.c | 2
449 - src/pmqtest/pmqtest.c | 1
450 - src/ptsematest/ptsematest.c | 1
451 - src/rt-migrate-test/rt-migrate-test.c | 1
452 - src/sched_deadline/cyclicdeadline.c | 1
453 - 12 files changed, 50 insertions(+), 67 deletions(-)
454 - create mode 100644 src/include/musl.h
455 -
456 ---- a/Makefile
457 -+++ b/Makefile
458 -@@ -7,7 +7,6 @@ OBJDIR = bld
459 - sources = cyclictest.c \
460 - hackbench.c \
461 - pip_stress.c \
462 -- pi_stress.c \
463 - pmqtest.c \
464 - ptsematest.c \
465 - rt-migrate-test.c \
466 -@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
467 - endif
468 -
469 - MANPAGES = src/cyclictest/cyclictest.8 \
470 -- src/pi_tests/pi_stress.8 \
471 - src/ptsematest/ptsematest.8 \
472 - src/rt-migrate-test/rt-migrate-test.8 \
473 - src/sigwaittest/sigwaittest.8 \
474 -@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
475 - signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
476 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
477 -
478 --pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
479 -- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
480 --
481 - hwlatdetect: src/hwlatdetect/hwlatdetect.py
482 - chmod +x src/hwlatdetect/hwlatdetect.py
483 - ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
484 ---- a/src/backfire/sendme.c
485 -+++ b/src/backfire/sendme.c
486 -@@ -29,6 +29,7 @@
487 - #include <string.h>
488 - #include <time.h>
489 - #include <errno.h>
490 -+#include "musl.h"
491 - #include "rt-utils.h"
492 - #include "rt-get_cpu.h"
493 -
494 ---- a/src/cyclictest/cyclictest.c
495 -+++ b/src/cyclictest/cyclictest.c
496 -@@ -33,6 +33,7 @@
497 - #include <sys/utsname.h>
498 - #include <sys/mman.h>
499 - #include <sys/syscall.h>
500 -+#include "musl.h"
501 - #include "rt_numa.h"
502 -
503 - #include "rt-utils.h"
504 -@@ -502,12 +503,8 @@ static void *timerthread(void *param)
505 - {
506 - struct thread_param *par = param;
507 - struct sched_param schedp;
508 -- struct sigevent sigev;
509 - sigset_t sigset;
510 -- timer_t timer;
511 - struct timespec now, next, interval, stop;
512 -- struct itimerval itimer;
513 -- struct itimerspec tspec;
514 - struct thread_stat *stat = par->stats;
515 - int stopped = 0;
516 - cpu_set_t mask;
517 -@@ -538,14 +535,6 @@ static void *timerthread(void *param)
518 - sigaddset(&sigset, par->signal);
519 - sigprocmask(SIG_BLOCK, &sigset, NULL);
520 -
521 -- if (par->mode == MODE_CYCLIC) {
522 -- sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
523 -- sigev.sigev_signo = par->signal;
524 -- sigev.sigev_notify_thread_id = stat->tid;
525 -- timer_create(par->clock, &sigev, &timer);
526 -- tspec.it_interval = interval;
527 -- }
528 --
529 - memset(&schedp, 0, sizeof(schedp));
530 - schedp.sched_priority = par->prio;
531 - if (setscheduler(0, par->policy, &schedp))
532 -@@ -600,20 +589,6 @@ static void *timerthread(void *param)
533 - stop = now;
534 - stop.tv_sec += duration;
535 - }
536 -- if (par->mode == MODE_CYCLIC) {
537 -- if (par->timermode == TIMER_ABSTIME)
538 -- tspec.it_value = next;
539 -- else
540 -- tspec.it_value = interval;
541 -- timer_settime(timer, par->timermode, &tspec, NULL);
542 -- }
543 --
544 -- if (par->mode == MODE_SYS_ITIMER) {
545 -- itimer.it_interval.tv_sec = interval.tv_sec;
546 -- itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
547 -- itimer.it_value = itimer.it_interval;
548 -- setitimer(ITIMER_REAL, &itimer, NULL);
549 -- }
550 -
551 - rt_test_start();
552 - stat->threadstarted++;
553 -@@ -622,16 +597,10 @@ static void *timerthread(void *param)
554 -
555 - uint64_t diff;
556 - unsigned long diff_smi = 0;
557 -- int sigs, ret;
558 -+ int ret;
559 -
560 - /* Wait for next period */
561 - switch (par->mode) {
562 -- case MODE_CYCLIC:
563 -- case MODE_SYS_ITIMER:
564 -- if (sigwait(&sigset, &sigs) < 0)
565 -- goto out;
566 -- break;
567 --
568 - case MODE_CLOCK_NANOSLEEP:
569 - if (par->timermode == TIMER_ABSTIME) {
570 - ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
571 -@@ -752,11 +721,6 @@ static void *timerthread(void *param)
572 -
573 - next.tv_sec += interval.tv_sec;
574 - next.tv_nsec += interval.tv_nsec;
575 -- if (par->mode == MODE_CYCLIC) {
576 -- int overrun_count = timer_getoverrun(timer);
577 -- next.tv_sec += overrun_count * interval.tv_sec;
578 -- next.tv_nsec += overrun_count * interval.tv_nsec;
579 -- }
580 - tsnorm(&next);
581 -
582 - while (tsgreater(&now, &next)) {
583 -@@ -781,17 +745,6 @@ out:
584 - pthread_mutex_unlock(&refresh_on_max_lock);
585 - }
586 -
587 -- if (par->mode == MODE_CYCLIC)
588 -- timer_delete(timer);
589 --
590 -- if (par->mode == MODE_SYS_ITIMER) {
591 -- itimer.it_value.tv_sec = 0;
592 -- itimer.it_value.tv_usec = 0;
593 -- itimer.it_interval.tv_sec = 0;
594 -- itimer.it_interval.tv_usec = 0;
595 -- setitimer(ITIMER_REAL, &itimer, NULL);
596 -- }
597 --
598 - /* close msr file */
599 - if (smi)
600 - close(par->msr_fd);
601 -@@ -1175,7 +1128,8 @@ static void process_options(int argc, ch
602 - case OPT_VERBOSE: verbose = 1; break;
603 - case 'x':
604 - case OPT_POSIX_TIMERS:
605 -- use_nanosleep = MODE_CYCLIC; break;
606 -+ fatal("--posix_timers is not available on your libc\n");
607 -+ break;
608 - case '?':
609 - case OPT_HELP:
610 - display_help(0); break;
611 -@@ -1208,13 +1162,6 @@ static void process_options(int argc, ch
612 - }
613 - }
614 -
615 -- if ((use_system == MODE_SYS_OFFSET) && (use_nanosleep == MODE_CYCLIC)) {
616 -- warn("The system option requires clock_nanosleep\n");
617 -- warn("and is not compatible with posix_timers\n");
618 -- warn("Using clock_nanosleep\n");
619 -- use_nanosleep = MODE_CLOCK_NANOSLEEP;
620 -- }
621 --
622 - /* if smp wasn't requested, test for numa automatically */
623 - if (!smp) {
624 - numa = numa_initialize();
625 -@@ -1944,7 +1891,6 @@ int main(int argc, char **argv)
626 -
627 - }
628 -
629 --
630 - mode = use_nanosleep + use_system;
631 -
632 - sigemptyset(&sigset);
633 -@@ -1994,16 +1940,18 @@ int main(int argc, char **argv)
634 - void *stack;
635 - void *currstk;
636 - size_t stksize;
637 -+ int err;
638 -
639 - /* find the memory node associated with the cpu i */
640 - node = rt_numa_numa_node_of_cpu(cpu);
641 -
642 -- /* get the stack size set for this thread */
643 -- if (pthread_attr_getstack(&attr, &currstk, &stksize))
644 -+ /* get the stack size set for for this thread */
645 -+ err = pthread_attr_getstack(&attr, &currstk, &stksize);
646 -+ if (err != EINVAL)
647 - fatal("failed to get stack size for thread %d\n", i);
648 -
649 - /* if the stack size is zero, set a default */
650 -- if (stksize == 0)
651 -+ if (err == EINVAL || stksize == 0)
652 - stksize = PTHREAD_STACK_MIN * 2;
653 -
654 - /* allocate memory for a stack on appropriate node */
655 ---- a/src/hackbench/hackbench.c
656 -+++ b/src/hackbench/hackbench.c
657 -@@ -24,13 +24,15 @@
658 - #include <sys/socket.h>
659 - #include <sys/wait.h>
660 - #include <sys/time.h>
661 --#include <sys/poll.h>
662 -+#include <poll.h>
663 - #include <limits.h>
664 - #include <getopt.h>
665 - #include <signal.h>
666 - #include <setjmp.h>
667 - #include <sched.h>
668 -
669 -+#include "musl.h"
670 -+
671 - static unsigned int datasize = 100;
672 - static unsigned int loops = 100;
673 - static unsigned int num_groups = 10;
674 ---- /dev/null
675 -+++ b/src/include/musl.h
676 -@@ -0,0 +1,28 @@
677 -+/*
678 -+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@×××××××××××××.de>
679 -+ * Time-stamp: <2020-04-04 10:54:01 kurt>
680 -+ */
681 -+
682 -+#ifndef _MUSL_H_
683 -+#define _MUSL_H_
684 -+
685 -+#include <unistd.h>
686 -+#include <sys/syscall.h>
687 -+
688 -+/*
689 -+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
690 -+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
691 -+ *
692 -+ * Workaround: define them to syscall(...)
693 -+ */
694 -+
695 -+#define sched_getparam(pid, param) \
696 -+ syscall(SYS_sched_getparam, pid, param)
697 -+#define sched_setparam(pid, param) \
698 -+ syscall(SYS_sched_setparam, pid, param)
699 -+#define sched_getscheduler(pid) \
700 -+ syscall(SYS_sched_getscheduler, pid)
701 -+#define sched_setscheduler(pid, policy, param) \
702 -+ syscall(SYS_sched_setscheduler, pid, policy, param)
703 -+
704 -+#endif /* _MUSL_H_ */
705 ---- a/src/lib/rt-utils.c
706 -+++ b/src/lib/rt-utils.c
707 -@@ -24,6 +24,7 @@
708 - #include <time.h>
709 - #include <sys/time.h>
710 -
711 -+#include "musl.h"
712 - #include "rt-utils.h"
713 - #include "rt-sched.h"
714 - #include "rt-error.h"
715 ---- a/src/pi_tests/classic_pi.c
716 -+++ b/src/pi_tests/classic_pi.c
717 -@@ -34,6 +34,8 @@
718 - #include <signal.h>
719 - #include <getopt.h>
720 -
721 -+#include "musl.h"
722 -+
723 - /* test timeout */
724 - #define TIMEOUT 2
725 -
726 ---- a/src/pi_tests/tst-mutexpi10.c
727 -+++ b/src/pi_tests/tst-mutexpi10.c
728 -@@ -35,6 +35,8 @@
729 - #include <string.h>
730 - #include <signal.h>
731 -
732 -+#include "musl.h"
733 -+
734 - /* test timeout */
735 - #define TIMEOUT 2
736 -
737 ---- a/src/pmqtest/pmqtest.c
738 -+++ b/src/pmqtest/pmqtest.c
739 -@@ -24,6 +24,7 @@
740 - #include <pthread.h>
741 - #include <inttypes.h>
742 -
743 -+#include "musl.h"
744 - #include "rt-utils.h"
745 - #include "rt-get_cpu.h"
746 - #include "rt-error.h"
747 ---- a/src/ptsematest/ptsematest.c
748 -+++ b/src/ptsematest/ptsematest.c
749 -@@ -22,6 +22,7 @@
750 - #include <pthread.h>
751 - #include <inttypes.h>
752 -
753 -+#include "musl.h"
754 - #include "rt-utils.h"
755 - #include "rt-get_cpu.h"
756 - #include "rt-error.h"
757 ---- a/src/rt-migrate-test/rt-migrate-test.c
758 -+++ b/src/rt-migrate-test/rt-migrate-test.c
759 -@@ -27,6 +27,7 @@
760 -
761 - #include <linux/unistd.h>
762 -
763 -+#include "musl.h"
764 - #include "rt-utils.h"
765 -
766 - int nr_tasks;
767 ---- a/src/sched_deadline/cyclicdeadline.c
768 -+++ b/src/sched_deadline/cyclicdeadline.c
769 -@@ -30,6 +30,7 @@
770 - #include <linux/unistd.h>
771 - #include <linux/magic.h>
772 -
773 -+#include "musl.h"
774 - #include "rt-utils.h"
775 - #include "rt-sched.h"
776 - #include "rt-error.h"
777
778 diff --git a/dev-util/rt-tests/rt-tests-1.10.ebuild b/dev-util/rt-tests/rt-tests-1.10.ebuild
779 deleted file mode 100644
780 index 22e1c39323e..00000000000
781 --- a/dev-util/rt-tests/rt-tests-1.10.ebuild
782 +++ /dev/null
783 @@ -1,38 +0,0 @@
784 -# Copyright 1999-2020 Gentoo Authors
785 -# Distributed under the terms of the GNU General Public License v2
786 -
787 -EAPI=7
788 -
789 -PYTHON_COMPAT=( python3_{7..9} )
790 -
791 -inherit python-single-r1 toolchain-funcs
792 -
793 -DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
794 -HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
795 -SRC_URI="
796 - https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
797 - https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
798 -
799 -LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
800 -SLOT="0"
801 -KEYWORDS="~amd64 ~arm64 ~x86"
802 -REQUIRED_USE="${PYTHON_REQUIRED_USE}"
803 -
804 -DEPEND="${PYTHON_DEPS}
805 - sys-process/numactl"
806 -RDEPEND="${DEPEND}"
807 -
808 -src_prepare() {
809 - default
810 - use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
811 -}
812 -
813 -src_compile() {
814 - emake CC="$(tc-getCC)" AR="$(tc-getAR)"
815 -}
816 -
817 -src_install() {
818 - emake prefix=/usr DESTDIR="${ED}" install
819 - python_fix_shebang "${ED}"
820 - python_optimize
821 -}
822
823 diff --git a/dev-util/rt-tests/rt-tests-2.0.ebuild b/dev-util/rt-tests/rt-tests-2.0.ebuild
824 deleted file mode 100644
825 index 8f2df0599b2..00000000000
826 --- a/dev-util/rt-tests/rt-tests-2.0.ebuild
827 +++ /dev/null
828 @@ -1,38 +0,0 @@
829 -# Copyright 1999-2021 Gentoo Authors
830 -# Distributed under the terms of the GNU General Public License v2
831 -
832 -EAPI=7
833 -
834 -PYTHON_COMPAT=( python3_{7..10} )
835 -
836 -inherit python-single-r1 toolchain-funcs
837 -
838 -DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
839 -HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
840 -SRC_URI="
841 - https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
842 - https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
843 -
844 -LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
845 -SLOT="0"
846 -KEYWORDS="~amd64 ~arm64 ~x86"
847 -REQUIRED_USE="${PYTHON_REQUIRED_USE}"
848 -
849 -DEPEND="${PYTHON_DEPS}
850 - sys-process/numactl"
851 -RDEPEND="${DEPEND}"
852 -
853 -src_prepare() {
854 - default
855 - use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
856 -}
857 -
858 -src_compile() {
859 - emake CC="$(tc-getCC)" AR="$(tc-getAR)"
860 -}
861 -
862 -src_install() {
863 - emake prefix=/usr DESTDIR="${ED}" install
864 - python_fix_shebang "${ED}"
865 - python_optimize
866 -}