Gentoo Archives: gentoo-commits

From: Sam James <sam@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, 07 Oct 2020 03:44:28
Message-Id: 1602042181.b6c66c490cff6d41c05fc82631345f2086e8b8df.sam@gentoo
1 commit: b6c66c490cff6d41c05fc82631345f2086e8b8df
2 Author: Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
3 AuthorDate: Sat Sep 26 11:51:24 2020 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 7 03:43:01 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6c66c49
7
8 dev-util/rt-tests: Bump version to v1.9
9
10 Announce message:
11
12 https://lkml.kernel.org/linux-rt-users/alpine.LFD.2.23.451.2009211516250.7550@fionn/
13
14 Package-Manager: Portage-3.0.4, Repoman-3.0.1
15 Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 dev-util/rt-tests/Manifest | 1 +
19 dev-util/rt-tests/files/rt-tests-1.9-musl.patch | 380 ++++++++++++++++++++++++
20 dev-util/rt-tests/rt-tests-1.9.ebuild | 38 +++
21 3 files changed, 419 insertions(+)
22
23 diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
24 index 84387d38e3c..3a6f1eccd32 100644
25 --- a/dev-util/rt-tests/Manifest
26 +++ b/dev-util/rt-tests/Manifest
27 @@ -1 +1,2 @@
28 DIST rt-tests-1.8.tar.xz 105820 BLAKE2B 478ac14732393f718e6be818b82b24b1e53d2f293140012bc17fd1c9242bd885b4d70dca3c7f3187e9ba22334e5f83d9ad1993ab9f70079e1765b918deab4411 SHA512 41c0b18e84d1f76de22a4ab239d43ac678b8c8419b508c96204bef346734122b9a42df51fcea97b1e0675bd25ed1e262730236ec0cb189732d5810122e96aa39
29 +DIST rt-tests-1.9.tar.xz 112180 BLAKE2B fa9b7b70bd9ae5d5f5e1077ddbd916bc4556d079d4067f16289ab34fec16ed0c8074607a7a8e50ea7bad4df318a063074f1c0ec5c2e895851d3045d51a8ecd74 SHA512 66f086dbda31567e6dc5297424ec66b2c6bd7cb0e065c32e02c326f33967f3a301b1b34f9eb0dd0acd853279c64fb1c2bc271ac26648f4abc3f6090ba6484cfa
30
31 diff --git a/dev-util/rt-tests/files/rt-tests-1.9-musl.patch b/dev-util/rt-tests/files/rt-tests-1.9-musl.patch
32 new file mode 100644
33 index 00000000000..0114cd00447
34 --- /dev/null
35 +++ b/dev-util/rt-tests/files/rt-tests-1.9-musl.patch
36 @@ -0,0 +1,380 @@
37 +From fd78f200ac8e9d1eb7579cd9e4adaaa1a4dc2d46 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 | 68 ++++-----------------------
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, 50 insertions(+), 66 deletions(-)
66 + create mode 100644 src/include/musl.h
67 +
68 +diff --git a/Makefile b/Makefile
69 +index c3ebbd7b2a2e..8815c113c0df 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 +@@ -36,7 +35,6 @@ LDFLAGS ?=
81 + PYLIB ?= $(shell python3 -c 'import distutils.sysconfig; print (distutils.sysconfig.get_python_lib())')
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 +@@ -129,9 +127,6 @@ deadline_test: $(OBJDIR)/deadline_test.o $(OBJDIR)/librttest.a
89 + signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a
90 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
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 b41d42f13f24..56b27a4e0547 100644
112 +--- a/src/cyclictest/cyclictest.c
113 ++++ b/src/cyclictest/cyclictest.c
114 +@@ -36,6 +36,7 @@
115 + #include "rt_numa.h"
116 +
117 + #include "rt-utils.h"
118 ++#include "musl.h"
119 +
120 + #include <bionic.h>
121 +
122 +@@ -501,12 +502,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 +@@ -537,14 +534,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 +@@ -599,20 +588,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 +@@ -620,16 +595,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 +@@ -751,11 +720,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 +@@ -780,17 +744,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 +@@ -1305,7 +1258,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 +@@ -1338,13 +1292,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 + #ifdef NUMA
243 +@@ -2038,7 +1985,6 @@ int main(int argc, char **argv)
244 +
245 + }
246 +
247 +-
248 + mode = use_nanosleep + use_system;
249 +
250 + sigemptyset(&sigset);
251 +@@ -2088,16 +2034,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 for this thread */
261 +- if (pthread_attr_getstack(&attr, &currstk, &stksize))
262 ++ err = pthread_attr_getstack(&attr, &currstk, &stksize);
263 ++ if (err != EINVAL)
264 + fatal("failed to get stack size for thread %d\n", i);
265 +
266 + /* if the stack size is zero, set a default */
267 +- if (stksize == 0)
268 ++ if (err == EINVAL || stksize == 0)
269 + stksize = PTHREAD_STACK_MIN * 2;
270 +
271 + /* allocate memory for a stack on appropriate node */
272 +diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
273 +index 2cddff654df6..46f09fa9e7ba 100644
274 +--- a/src/hackbench/hackbench.c
275 ++++ b/src/hackbench/hackbench.c
276 +@@ -24,13 +24,15 @@
277 + #include <sys/socket.h>
278 + #include <sys/wait.h>
279 + #include <sys/time.h>
280 +-#include <sys/poll.h>
281 ++#include <poll.h>
282 + #include <limits.h>
283 + #include <getopt.h>
284 + #include <signal.h>
285 + #include <setjmp.h>
286 + #include <sched.h>
287 +
288 ++#include "musl.h"
289 ++
290 + static unsigned int datasize = 100;
291 + static unsigned int loops = 100;
292 + static unsigned int num_groups = 10;
293 +diff --git a/src/include/musl.h b/src/include/musl.h
294 +new file mode 100644
295 +index 000000000000..ea5075e768c8
296 +--- /dev/null
297 ++++ b/src/include/musl.h
298 +@@ -0,0 +1,28 @@
299 ++/*
300 ++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@×××××××××××××.de>
301 ++ * Time-stamp: <2020-04-04 10:54:01 kurt>
302 ++ */
303 ++
304 ++#ifndef _MUSL_H_
305 ++#define _MUSL_H_
306 ++
307 ++#include <unistd.h>
308 ++#include <sys/syscall.h>
309 ++
310 ++/*
311 ++ * Musl someshow defines sched_* to ENOSYS which is not correct ...
312 ++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
313 ++ *
314 ++ * Workaround: define them to syscall(...)
315 ++ */
316 ++
317 ++#define sched_getparam(pid, param) \
318 ++ syscall(SYS_sched_getparam, pid, param)
319 ++#define sched_setparam(pid, param) \
320 ++ syscall(SYS_sched_setparam, pid, param)
321 ++#define sched_getscheduler(pid) \
322 ++ syscall(SYS_sched_getscheduler, pid)
323 ++#define sched_setscheduler(pid, policy, param) \
324 ++ syscall(SYS_sched_setscheduler, pid, policy, param)
325 ++
326 ++#endif /* _MUSL_H_ */
327 +diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
328 +index f786588706cd..c1a55272dfdb 100644
329 +--- a/src/lib/rt-utils.c
330 ++++ b/src/lib/rt-utils.c
331 +@@ -23,6 +23,7 @@
332 + #include "rt-utils.h"
333 + #include "rt-sched.h"
334 + #include "error.h"
335 ++#include "musl.h"
336 +
337 + #define TRACEBUFSIZ 1024
338 +
339 +diff --git a/src/pi_tests/classic_pi.c b/src/pi_tests/classic_pi.c
340 +index 64af8890276f..bb088d3973b2 100644
341 +--- a/src/pi_tests/classic_pi.c
342 ++++ b/src/pi_tests/classic_pi.c
343 +@@ -34,6 +34,8 @@
344 + #include <signal.h>
345 + #include <getopt.h>
346 +
347 ++#include "musl.h"
348 ++
349 + /* test timeout */
350 + #define TIMEOUT 2
351 +
352 +diff --git a/src/pi_tests/tst-mutexpi10.c b/src/pi_tests/tst-mutexpi10.c
353 +index 97a345edd26e..1028d344edff 100644
354 +--- a/src/pi_tests/tst-mutexpi10.c
355 ++++ b/src/pi_tests/tst-mutexpi10.c
356 +@@ -35,6 +35,8 @@
357 + #include <string.h>
358 + #include <signal.h>
359 +
360 ++#include "musl.h"
361 ++
362 + /* test timeout */
363 + #define TIMEOUT 2
364 +
365 +diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
366 +index 5db8d348cdf8..2de6c1417e4a 100644
367 +--- a/src/pmqtest/pmqtest.c
368 ++++ b/src/pmqtest/pmqtest.c
369 +@@ -24,6 +24,7 @@
370 + #include "rt-utils.h"
371 + #include "rt-get_cpu.h"
372 + #include "error.h"
373 ++#include "musl.h"
374 +
375 + #include <pthread.h>
376 +
377 +diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
378 +index de8ea2fe1b0c..1568f3b78711 100644
379 +--- a/src/ptsematest/ptsematest.c
380 ++++ b/src/ptsematest/ptsematest.c
381 +@@ -22,6 +22,7 @@
382 + #include "rt-utils.h"
383 + #include "rt-get_cpu.h"
384 + #include "error.h"
385 ++#include "musl.h"
386 +
387 + #include <pthread.h>
388 +
389 +diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
390 +index 4863238edeb4..9f1aba159dc7 100644
391 +--- a/src/rt-migrate-test/rt-migrate-test.c
392 ++++ b/src/rt-migrate-test/rt-migrate-test.c
393 +@@ -25,6 +25,7 @@
394 + #include <sched.h>
395 + #include <pthread.h>
396 + #include "rt-utils.h"
397 ++#include "musl.h"
398 +
399 + int nr_tasks;
400 + int lfd;
401 +diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
402 +index a08e28e73c42..675a0ea1a162 100644
403 +--- a/src/sched_deadline/cyclicdeadline.c
404 ++++ b/src/sched_deadline/cyclicdeadline.c
405 +@@ -32,6 +32,8 @@
406 + #include <rt-utils.h>
407 + #include <rt-sched.h>
408 +
409 ++#include "musl.h"
410 ++
411 + #define _STR(x) #x
412 + #define STR(x) _STR(x)
413 + #ifndef MAXPATH
414 +--
415 +2.26.2
416 +
417
418 diff --git a/dev-util/rt-tests/rt-tests-1.9.ebuild b/dev-util/rt-tests/rt-tests-1.9.ebuild
419 new file mode 100644
420 index 00000000000..cb4f2d29351
421 --- /dev/null
422 +++ b/dev-util/rt-tests/rt-tests-1.9.ebuild
423 @@ -0,0 +1,38 @@
424 +# Copyright 1999-2020 Gentoo Authors
425 +# Distributed under the terms of the GNU General Public License v2
426 +
427 +EAPI=7
428 +
429 +PYTHON_COMPAT=( python3_{6..9} )
430 +
431 +inherit python-single-r1 toolchain-funcs
432 +
433 +DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
434 +HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
435 +SRC_URI="
436 + https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
437 + https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
438 +
439 +LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
440 +SLOT="0"
441 +KEYWORDS="~amd64 ~arm64 ~x86"
442 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
443 +
444 +DEPEND="${PYTHON_DEPS}
445 + sys-process/numactl"
446 +RDEPEND="${DEPEND}"
447 +
448 +src_prepare() {
449 + default
450 + use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
451 +}
452 +
453 +src_compile() {
454 + emake CC="$(tc-getCC)" AR="$(tc-getAR)"
455 +}
456 +
457 +src_install() {
458 + emake prefix=/usr DESTDIR="${D}" MAN_COMPRESSION=none install
459 + python_fix_shebang "${ED}"
460 + python_optimize
461 +}