public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2020-01-23  9:53 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2020-01-23  9:53 UTC (permalink / raw
  To: gentoo-commits

commit:     0bbc3dee5539cf046692f34d49668de67f65f67a
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Fri Apr 26 21:23:08 2019 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Jan 23 09:53:19 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bbc3dee

dev-util/rt-tests: A collection of latency testing tools (new package)

rt-tests contains a set of programs that test and measure various components of
real-time kernel behavior, such as timer latency, signal latency and the
functioning of priority-inheritance mutexes. Additionally it contains hackbench,
a program to generate work for the scheduler.

Closes: https://bugs.gentoo.org/705150
Package-Manager: Portage-2.3.79, Repoman-2.3.16
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/14303
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                         |  1 +
 .../files/rt-tests-1.6-man-compression.patch       | 61 ++++++++++++++++++++++
 dev-util/rt-tests/metadata.xml                     | 21 ++++++++
 dev-util/rt-tests/rt-tests-1.6.ebuild              | 34 ++++++++++++
 4 files changed, 117 insertions(+)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
new file mode 100644
index 00000000000..e0040c68a71
--- /dev/null
+++ b/dev-util/rt-tests/Manifest
@@ -0,0 +1 @@
+DIST rt-tests-1.6.tar.xz 104864 BLAKE2B 36ada7cbe6deefae2eef80fa167892d41a9c56a6f54a23c8ace5ab97a32e23a88a488bc95f92456a7eea48c49567c4755adc43b3aa68e20c885ca1c354825a7d SHA512 1cbb9b1bc7f6ac335be269e5937209598bfb8c0a29750484e7bba8b87b416c04cd38c8d6d48dc5ed1978c1797dee4cecff0218124bd6d7f23b43a13dc7a75a29

diff --git a/dev-util/rt-tests/files/rt-tests-1.6-man-compression.patch b/dev-util/rt-tests/files/rt-tests-1.6-man-compression.patch
new file mode 100644
index 00000000000..e44a9525060
--- /dev/null
+++ b/dev-util/rt-tests/files/rt-tests-1.6-man-compression.patch
@@ -0,0 +1,61 @@
+From 30e9529a140fb2a5ef96e510743e201c62ded022 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <kurt@kmk-computers.de>
+Date: Wed, 22 Jan 2020 18:42:25 +0100
+Subject: [PATCH] make: Don't compress man pages by default
+
+Most package systems do the compression on their own.
+
+Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
+---
+ Makefile | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 552b3fe885cc..244d26eed7cc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -180,19 +180,19 @@ install: all install_hwlatdetect
+ 	cp $(TARGETS) "$(DESTDIR)$(bindir)"
+ 	install src/queuelat/get_cpuinfo_mhz.sh "$(DESTDIR)$(bindir)"
+ 	install src/queuelat/determine_maximum_mpps.sh "${DESTDIR}${bindir}"
+-	gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
+-	gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
+-	gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
+-	gzip -c src/rt-migrate-test/rt-migrate-test.8 >"$(DESTDIR)$(mandir)/man8/rt-migrate-test.8.gz"
+-	gzip -c src/sigwaittest/sigwaittest.8 >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
+-	gzip -c src/svsematest/svsematest.8 >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
+-	gzip -c src/pmqtest/pmqtest.8 >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz"
+-	gzip -c src/hackbench/hackbench.8 >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
+-	gzip -c src/signaltest/signaltest.8 >"$(DESTDIR)$(mandir)/man8/signaltest.8.gz"
+-	gzip -c src/pi_tests/pip_stress.8 >"$(DESTDIR)$(mandir)/man8/pip_stress.8.gz"
+-	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz"
+-	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz"
+-	gzip -c src/ssdd/ssdd.8 >"$(DESTDIR)$(mandir)/man8/ssdd.8.gz"
++	install -D -m 644 src/cyclictest/cyclictest.8 "$(DESTDIR)$(mandir)/man8/cyclictest.8"
++	install -D -m 644 src/pi_tests/pi_stress.8 "$(DESTDIR)$(mandir)/man8/pi_stress.8"
++	install -D -m 644 src/ptsematest/ptsematest.8 "$(DESTDIR)$(mandir)/man8/ptsematest.8"
++	install -D -m 644 src/rt-migrate-test/rt-migrate-test.8 "$(DESTDIR)$(mandir)/man8/rt-migrate-test.8"
++	install -D -m 644 src/sigwaittest/sigwaittest.8 "$(DESTDIR)$(mandir)/man8/sigwaittest.8"
++	install -D -m 644 src/svsematest/svsematest.8 "$(DESTDIR)$(mandir)/man8/svsematest.8"
++	install -D -m 644 src/pmqtest/pmqtest.8 "$(DESTDIR)$(mandir)/man8/pmqtest.8"
++	install -D -m 644 src/hackbench/hackbench.8 "$(DESTDIR)$(mandir)/man8/hackbench.8"
++	install -D -m 644 src/signaltest/signaltest.8 "$(DESTDIR)$(mandir)/man8/signaltest.8"
++	install -D -m 644 src/pi_tests/pip_stress.8 "$(DESTDIR)$(mandir)/man8/pip_stress.8"
++	install -D -m 644 src/queuelat/queuelat.8 "$(DESTDIR)$(mandir)/man8/queuelat.8"
++	install -D -m 644 src/sched_deadline/deadline_test.8 "$(DESTDIR)$(mandir)/man8/deadline_test.8"
++	install -D -m 644 src/ssdd/ssdd.8 "$(DESTDIR)$(mandir)/man8/ssdd.8"
+ 
+ .PHONY: install_hwlatdetect
+ install_hwlatdetect: hwlatdetect
+@@ -201,7 +201,7 @@ install_hwlatdetect: hwlatdetect
+ 		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
+ 		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
+ 		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
+-		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
++		install -D -m 644 src/hwlatdetect/hwlatdetect.8 "$(DESTDIR)$(mandir)/man8/hwlatdetect.8" ; \
+ 	fi
+ 
+ .PHONY: tarball
+-- 
+2.24.1
+

diff --git a/dev-util/rt-tests/metadata.xml b/dev-util/rt-tests/metadata.xml
new file mode 100644
index 00000000000..23b5a048fe9
--- /dev/null
+++ b/dev-util/rt-tests/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="person">
+    <email>kurt@kmk-computers.de</email>
+    <name>Kurt Kanzenbach</name>
+  </maintainer>
+  <maintainer type="project">
+    <email>proxy-maint@gentoo.org</email>
+    <name>Proxy Maintainers</name>
+  </maintainer>
+  <longdescription>
+    rt-tests contains a set of programs that test and measure various components
+    of real-time kernel behavior, such as timer latency, signal latency and the
+    functioning of priority-inheritance mutexes. Additionally it contains
+    hackbench, a program to generate work for the scheduler.
+  </longdescription>
+  <use>
+    <flag name="numa">Make test programs NUMA aware</flag>
+  </use>
+</pkgmetadata>

diff --git a/dev-util/rt-tests/rt-tests-1.6.ebuild b/dev-util/rt-tests/rt-tests-1.6.ebuild
new file mode 100644
index 00000000000..debc1623e79
--- /dev/null
+++ b/dev-util/rt-tests/rt-tests-1.6.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=(python3_{6,7,8})
+
+inherit python-single-r1
+
+DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
+SRC_URI="https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz"
+
+LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="numa"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	numa? ( sys-process/numactl )"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-man-compression.patch" )
+
+src_compile() {
+	emake $(usex numa 'NUMA=1' 'NUMA=0') all
+}
+
+src_install() {
+	emake prefix=/usr DESTDIR="${D}" install
+	python_fix_shebang "${ED}"
+	python_optimize
+}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2020-03-03 14:54 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2020-03-03 14:54 UTC (permalink / raw
  To: gentoo-commits

commit:     066726b741431cd5e0481dc4c04a487d7ba5ed39
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Fri Feb 28 15:37:19 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Tue Mar  3 14:53:43 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=066726b7

dev-util/rt-tests: Drop old v1.6

Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/14805
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                         |  1 -
 .../files/rt-tests-1.6-man-compression.patch       | 61 ----------------------
 dev-util/rt-tests/rt-tests-1.6.ebuild              | 34 ------------
 3 files changed, 96 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 35fa058295d..493ed0b2d64 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-1.6.tar.xz 104864 BLAKE2B 36ada7cbe6deefae2eef80fa167892d41a9c56a6f54a23c8ace5ab97a32e23a88a488bc95f92456a7eea48c49567c4755adc43b3aa68e20c885ca1c354825a7d SHA512 1cbb9b1bc7f6ac335be269e5937209598bfb8c0a29750484e7bba8b87b416c04cd38c8d6d48dc5ed1978c1797dee4cecff0218124bd6d7f23b43a13dc7a75a29
 DIST rt-tests-1.7.tar.xz 106044 BLAKE2B 290f8ad871c809c840f834cbee3030ade04decf3649be9cb55b120b9e915664514f209c7979f070ce42486ed5fc2ba8dca66c7b08ebe87c312407147d65e7d16 SHA512 c1a257d71c4ee2c15b27eea720a6f0e8bdb118d706aa517e368ed28a9ccf94a16b863ceb37adde922a40fd7a023d2506c5cd19c31f1f78858fb20c2f2af22692

diff --git a/dev-util/rt-tests/files/rt-tests-1.6-man-compression.patch b/dev-util/rt-tests/files/rt-tests-1.6-man-compression.patch
deleted file mode 100644
index e44a9525060..00000000000
--- a/dev-util/rt-tests/files/rt-tests-1.6-man-compression.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 30e9529a140fb2a5ef96e510743e201c62ded022 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 22 Jan 2020 18:42:25 +0100
-Subject: [PATCH] make: Don't compress man pages by default
-
-Most package systems do the compression on their own.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile | 28 ++++++++++++++--------------
- 1 file changed, 14 insertions(+), 14 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 552b3fe885cc..244d26eed7cc 100644
---- a/Makefile
-+++ b/Makefile
-@@ -180,19 +180,19 @@ install: all install_hwlatdetect
- 	cp $(TARGETS) "$(DESTDIR)$(bindir)"
- 	install src/queuelat/get_cpuinfo_mhz.sh "$(DESTDIR)$(bindir)"
- 	install src/queuelat/determine_maximum_mpps.sh "${DESTDIR}${bindir}"
--	gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
--	gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
--	gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
--	gzip -c src/rt-migrate-test/rt-migrate-test.8 >"$(DESTDIR)$(mandir)/man8/rt-migrate-test.8.gz"
--	gzip -c src/sigwaittest/sigwaittest.8 >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
--	gzip -c src/svsematest/svsematest.8 >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
--	gzip -c src/pmqtest/pmqtest.8 >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz"
--	gzip -c src/hackbench/hackbench.8 >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
--	gzip -c src/signaltest/signaltest.8 >"$(DESTDIR)$(mandir)/man8/signaltest.8.gz"
--	gzip -c src/pi_tests/pip_stress.8 >"$(DESTDIR)$(mandir)/man8/pip_stress.8.gz"
--	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz"
--	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz"
--	gzip -c src/ssdd/ssdd.8 >"$(DESTDIR)$(mandir)/man8/ssdd.8.gz"
-+	install -D -m 644 src/cyclictest/cyclictest.8 "$(DESTDIR)$(mandir)/man8/cyclictest.8"
-+	install -D -m 644 src/pi_tests/pi_stress.8 "$(DESTDIR)$(mandir)/man8/pi_stress.8"
-+	install -D -m 644 src/ptsematest/ptsematest.8 "$(DESTDIR)$(mandir)/man8/ptsematest.8"
-+	install -D -m 644 src/rt-migrate-test/rt-migrate-test.8 "$(DESTDIR)$(mandir)/man8/rt-migrate-test.8"
-+	install -D -m 644 src/sigwaittest/sigwaittest.8 "$(DESTDIR)$(mandir)/man8/sigwaittest.8"
-+	install -D -m 644 src/svsematest/svsematest.8 "$(DESTDIR)$(mandir)/man8/svsematest.8"
-+	install -D -m 644 src/pmqtest/pmqtest.8 "$(DESTDIR)$(mandir)/man8/pmqtest.8"
-+	install -D -m 644 src/hackbench/hackbench.8 "$(DESTDIR)$(mandir)/man8/hackbench.8"
-+	install -D -m 644 src/signaltest/signaltest.8 "$(DESTDIR)$(mandir)/man8/signaltest.8"
-+	install -D -m 644 src/pi_tests/pip_stress.8 "$(DESTDIR)$(mandir)/man8/pip_stress.8"
-+	install -D -m 644 src/queuelat/queuelat.8 "$(DESTDIR)$(mandir)/man8/queuelat.8"
-+	install -D -m 644 src/sched_deadline/deadline_test.8 "$(DESTDIR)$(mandir)/man8/deadline_test.8"
-+	install -D -m 644 src/ssdd/ssdd.8 "$(DESTDIR)$(mandir)/man8/ssdd.8"
- 
- .PHONY: install_hwlatdetect
- install_hwlatdetect: hwlatdetect
-@@ -201,7 +201,7 @@ install_hwlatdetect: hwlatdetect
- 		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
- 		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
- 		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
--		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
-+		install -D -m 644 src/hwlatdetect/hwlatdetect.8 "$(DESTDIR)$(mandir)/man8/hwlatdetect.8" ; \
- 	fi
- 
- .PHONY: tarball
--- 
-2.24.1
-

diff --git a/dev-util/rt-tests/rt-tests-1.6.ebuild b/dev-util/rt-tests/rt-tests-1.6.ebuild
deleted file mode 100644
index debc1623e79..00000000000
--- a/dev-util/rt-tests/rt-tests-1.6.ebuild
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=(python3_{6,7,8})
-
-inherit python-single-r1
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
-SRC_URI="https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~x86"
-IUSE="numa"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	numa? ( sys-process/numactl )"
-RDEPEND="${DEPEND}"
-
-PATCHES=( "${FILESDIR}/${P}-man-compression.patch" )
-
-src_compile() {
-	emake $(usex numa 'NUMA=1' 'NUMA=0') all
-}
-
-src_install() {
-	emake prefix=/usr DESTDIR="${D}" install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2020-04-05  7:18 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2020-04-05  7:18 UTC (permalink / raw
  To: gentoo-commits

commit:     296279d90b51625180552080d449a99a4e7518ef
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sat Apr  4 09:07:57 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Apr  5 07:17:55 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=296279d9

dev-util/rt-tests: Fix musl build

A few changes have to be made for rt-tests to run on a musl enabled system.

Closes: https://bugs.gentoo.org/712660
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/15223
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/files/rt-tests-1.8-musl.patch | 380 ++++++++++++++++++++++++
 dev-util/rt-tests/rt-tests-1.8.ebuild           |   7 +-
 2 files changed, 386 insertions(+), 1 deletion(-)

diff --git a/dev-util/rt-tests/files/rt-tests-1.8-musl.patch b/dev-util/rt-tests/files/rt-tests-1.8-musl.patch
new file mode 100644
index 00000000000..48a7a297afc
--- /dev/null
+++ b/dev-util/rt-tests/files/rt-tests-1.8-musl.patch
@@ -0,0 +1,380 @@
+From 4daa685588ee3848fc98fd9c6328b76f136ee876 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <kurt@kmk-computers.de>
+Date: Wed, 1 Apr 2020 20:15:24 +0200
+Subject: [PATCH] all: Fix musl build
+
+There are a few problems:
+
+ * pi stress:  pthread_attr_setaffinity_np() is not supported
+ * cyclictest: SIGEV_THREAD_ID is not supported
+ * hackbench:  Fix include
+ * all:        Fix sched_* calls
+
+With these changes applied, the rt-tests seem to run fine.
+
+Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
+---
+ Makefile                              |  5 --
+ src/backfire/sendme.c                 |  1 +
+ src/cyclictest/cyclictest.c           | 68 ++++-----------------------
+ src/hackbench/hackbench.c             |  4 +-
+ src/include/musl.h                    | 28 +++++++++++
+ src/lib/rt-utils.c                    |  1 +
+ src/pi_tests/classic_pi.c             |  2 +
+ src/pi_tests/tst-mutexpi10.c          |  2 +
+ src/pmqtest/pmqtest.c                 |  1 +
+ src/ptsematest/ptsematest.c           |  1 +
+ src/rt-migrate-test/rt-migrate-test.c |  1 +
+ src/sched_deadline/cyclicdeadline.c   |  2 +
+ 12 files changed, 50 insertions(+), 66 deletions(-)
+ create mode 100644 src/include/musl.h
+
+diff --git a/Makefile b/Makefile
+index 05fc5eda71fa..9340f28f2c32 100644
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,6 @@ OBJDIR = bld
+ sources = cyclictest.c \
+ 	  hackbench.c \
+ 	  pip_stress.c \
+-	  pi_stress.c \
+ 	  pmqtest.c \
+ 	  ptsematest.c \
+ 	  rt-migrate-test.c \
+@@ -35,7 +34,6 @@ LDFLAGS ?=
+ PYLIB  ?= $(shell python3 -c 'import distutils.sysconfig;  print (distutils.sysconfig.get_python_lib())')
+ 
+ MANPAGES = src/cyclictest/cyclictest.8 \
+-	   src/pi_tests/pi_stress.8 \
+ 	   src/ptsematest/ptsematest.8 \
+ 	   src/rt-migrate-test/rt-migrate-test.8 \
+ 	   src/sigwaittest/sigwaittest.8 \
+@@ -125,9 +123,6 @@ deadline_test: $(OBJDIR)/deadline_test.o $(OBJDIR)/librttest.a
+ signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
+ 
+-pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
+-
+ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
+ 	chmod +x src/hwlatdetect/hwlatdetect.py
+ 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
+diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c
+index c1854d9660cb..ecec5c201bef 100644
+--- a/src/backfire/sendme.c
++++ b/src/backfire/sendme.c
+@@ -31,6 +31,7 @@
+ #include <errno.h>
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
++#include "musl.h"
+ 
+ #include <utmpx.h>
+ #include <sys/types.h>
+diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
+index c5f1fd46567a..8204e57cbbac 100644
+--- a/src/cyclictest/cyclictest.c
++++ b/src/cyclictest/cyclictest.c
+@@ -36,6 +36,7 @@
+ #include "rt_numa.h"
+ 
+ #include "rt-utils.h"
++#include "musl.h"
+ 
+ #include <bionic.h>
+ 
+@@ -628,12 +629,8 @@ static void *timerthread(void *param)
+ {
+ 	struct thread_param *par = param;
+ 	struct sched_param schedp;
+-	struct sigevent sigev;
+ 	sigset_t sigset;
+-	timer_t timer;
+ 	struct timespec now, next, interval, stop;
+-	struct itimerval itimer;
+-	struct itimerspec tspec;
+ 	struct thread_stat *stat = par->stats;
+ 	int stopped = 0;
+ 	cpu_set_t mask;
+@@ -664,14 +661,6 @@ static void *timerthread(void *param)
+ 	sigaddset(&sigset, par->signal);
+ 	sigprocmask(SIG_BLOCK, &sigset, NULL);
+ 
+-	if (par->mode == MODE_CYCLIC) {
+-		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
+-		sigev.sigev_signo = par->signal;
+-		sigev.sigev_notify_thread_id = stat->tid;
+-		timer_create(par->clock, &sigev, &timer);
+-		tspec.it_interval = interval;
+-	}
+-
+ 	memset(&schedp, 0, sizeof(schedp));
+ 	schedp.sched_priority = par->prio;
+ 	if (setscheduler(0, par->policy, &schedp))
+@@ -726,20 +715,6 @@ static void *timerthread(void *param)
+ 		stop = now;
+ 		stop.tv_sec += duration;
+ 	}
+-	if (par->mode == MODE_CYCLIC) {
+-		if (par->timermode == TIMER_ABSTIME)
+-			tspec.it_value = next;
+-		else
+-			tspec.it_value = interval;
+-		timer_settime(timer, par->timermode, &tspec, NULL);
+-	}
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_interval.tv_sec = interval.tv_sec;
+-		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+-		itimer.it_value = itimer.it_interval;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+ 
+ 	stat->threadstarted++;
+ 
+@@ -747,16 +722,10 @@ static void *timerthread(void *param)
+ 
+ 		uint64_t diff;
+ 		unsigned long diff_smi = 0;
+-		int sigs, ret;
++		int ret;
+ 
+ 		/* Wait for next period */
+ 		switch (par->mode) {
+-		case MODE_CYCLIC:
+-		case MODE_SYS_ITIMER:
+-			if (sigwait(&sigset, &sigs) < 0)
+-				goto out;
+-			break;
+-
+ 		case MODE_CLOCK_NANOSLEEP:
+ 			if (par->timermode == TIMER_ABSTIME) {
+ 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
+@@ -878,11 +847,6 @@ static void *timerthread(void *param)
+ 
+ 		next.tv_sec += interval.tv_sec;
+ 		next.tv_nsec += interval.tv_nsec;
+-		if (par->mode == MODE_CYCLIC) {
+-			int overrun_count = timer_getoverrun(timer);
+-			next.tv_sec += overrun_count * interval.tv_sec;
+-			next.tv_nsec += overrun_count * interval.tv_nsec;
+-		}
+ 		tsnorm(&next);
+ 
+ 		while (tsgreater(&now, &next)) {
+@@ -907,17 +871,6 @@ out:
+ 		pthread_mutex_unlock(&refresh_on_max_lock);
+ 	}
+ 
+-	if (par->mode == MODE_CYCLIC)
+-		timer_delete(timer);
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_value.tv_sec = 0;
+-		itimer.it_value.tv_usec = 0;
+-		itimer.it_interval.tv_sec = 0;
+-		itimer.it_interval.tv_usec = 0;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+-
+ 	/* close msr file */
+ 	if (smi)
+ 		close(par->msr_fd);
+@@ -1417,7 +1370,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
+ 		case OPT_VERBOSE: verbose = 1; break;
+ 		case 'x':
+ 		case OPT_POSIX_TIMERS:
+-			use_nanosleep = MODE_CYCLIC; break;
++			fatal("--posix_timers is not available on your libc\n");
++			break;
+ 		case '?':
+ 		case OPT_HELP:
+ 			display_help(0); break;
+@@ -1450,13 +1404,6 @@ 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
+@@ -2157,7 +2104,6 @@ int main(int argc, char **argv)
+ 
+ 	}
+ 
+-
+ 	mode = use_nanosleep + use_system;
+ 
+ 	sigemptyset(&sigset);
+@@ -2207,16 +2153,18 @@ int main(int argc, char **argv)
+ 			void *stack;
+ 			void *currstk;
+ 			size_t stksize;
++			int err;
+ 
+ 			/* find the memory node associated with the 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))
++			err = pthread_attr_getstack(&attr, &currstk, &stksize);
++			if (err != EINVAL)
+ 				fatal("failed to get stack size for thread %d\n", i);
+ 
+ 			/* if the stack size is zero, set a default */
+-			if (stksize == 0)
++			if (err == EINVAL || stksize == 0)
+ 				stksize = PTHREAD_STACK_MIN * 2;
+ 
+ 			/*  allocate memory for a stack on appropriate node */
+diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
+index 5a883d341f2e..9f1e4db736a7 100644
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -24,13 +24,15 @@
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+ #include <sys/time.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <limits.h>
+ #include <getopt.h>
+ #include <signal.h>
+ #include <setjmp.h>
+ #include <sched.h>
+ 
++#include "musl.h"
++
+ static unsigned int datasize = 100;
+ static unsigned int loops = 100;
+ static unsigned int num_groups = 10;
+diff --git a/src/include/musl.h b/src/include/musl.h
+new file mode 100644
+index 000000000000..ea5075e768c8
+--- /dev/null
++++ b/src/include/musl.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
++ * Time-stamp: <2020-04-04 10:54:01 kurt>
++ */
++
++#ifndef _MUSL_H_
++#define _MUSL_H_
++
++#include <unistd.h>
++#include <sys/syscall.h>
++
++/*
++ * Musl someshow defines sched_* to ENOSYS which is not correct ...
++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
++ *
++ * Workaround: define them to syscall(...)
++ */
++
++#define sched_getparam(pid, param)		\
++	syscall(SYS_sched_getparam, pid, param)
++#define sched_setparam(pid, param)		\
++	syscall(SYS_sched_setparam, pid, param)
++#define sched_getscheduler(pid)			\
++	syscall(SYS_sched_getscheduler, pid)
++#define sched_setscheduler(pid, policy, param)			\
++	syscall(SYS_sched_setscheduler, pid, policy, param)
++
++#endif /* _MUSL_H_ */
+diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
+index 1998a327d036..f7adda9c5987 100644
+--- a/src/lib/rt-utils.c
++++ b/src/lib/rt-utils.c
+@@ -23,6 +23,7 @@
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "error.h"
++#include "musl.h"
+ 
+ static char debugfileprefix[MAX_PATH];
+ 
+diff --git a/src/pi_tests/classic_pi.c b/src/pi_tests/classic_pi.c
+index 64af8890276f..bb088d3973b2 100644
+--- a/src/pi_tests/classic_pi.c
++++ b/src/pi_tests/classic_pi.c
+@@ -34,6 +34,8 @@
+ #include <signal.h>
+ #include <getopt.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+diff --git a/src/pi_tests/tst-mutexpi10.c b/src/pi_tests/tst-mutexpi10.c
+index 97a345edd26e..1028d344edff 100644
+--- a/src/pi_tests/tst-mutexpi10.c
++++ b/src/pi_tests/tst-mutexpi10.c
+@@ -35,6 +35,8 @@
+ #include <string.h>
+ #include <signal.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
+index 3ce29252b9a2..1a57841cb7e8 100644
+--- a/src/pmqtest/pmqtest.c
++++ b/src/pmqtest/pmqtest.c
+@@ -24,6 +24,7 @@
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "error.h"
++#include "musl.h"
+ 
+ #include <pthread.h>
+ 
+diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
+index 485c991ec173..c000e083615f 100644
+--- a/src/ptsematest/ptsematest.c
++++ b/src/ptsematest/ptsematest.c
+@@ -22,6 +22,7 @@
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "error.h"
++#include "musl.h"
+ 
+ #include <pthread.h>
+ 
+diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
+index 4863238edeb4..9f1aba159dc7 100644
+--- a/src/rt-migrate-test/rt-migrate-test.c
++++ b/src/rt-migrate-test/rt-migrate-test.c
+@@ -25,6 +25,7 @@
+ #include <sched.h>
+ #include <pthread.h>
+ #include "rt-utils.h"
++#include "musl.h"
+ 
+ int nr_tasks;
+ int lfd;
+diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
+index a08e28e73c42..675a0ea1a162 100644
+--- a/src/sched_deadline/cyclicdeadline.c
++++ b/src/sched_deadline/cyclicdeadline.c
+@@ -32,6 +32,8 @@
+ #include <rt-utils.h>
+ #include <rt-sched.h>
+ 
++#include "musl.h"
++
+ #define _STR(x) #x
+ #define STR(x) _STR(x)
+ #ifndef MAXPATH
+-- 
+2.24.1
+

diff --git a/dev-util/rt-tests/rt-tests-1.8.ebuild b/dev-util/rt-tests/rt-tests-1.8.ebuild
index b0d1f73bce7..c6392a91f93 100644
--- a/dev-util/rt-tests/rt-tests-1.8.ebuild
+++ b/dev-util/rt-tests/rt-tests-1.8.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=(python3_{6,7,8})
+PYTHON_COMPAT=( python3_{6..8} )
 
 inherit python-single-r1
 
@@ -22,6 +22,11 @@ DEPEND="${PYTHON_DEPS}
 	sys-process/numactl"
 RDEPEND="${DEPEND}"
 
+src_prepare() {
+	default
+	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
+}
+
 src_install() {
 	emake prefix=/usr DESTDIR="${D}" MAN_COMPRESSION=none install
 	python_fix_shebang "${ED}"


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2020-10-07  3:44 Sam James
  0 siblings, 0 replies; 14+ messages in thread
From: Sam James @ 2020-10-07  3:44 UTC (permalink / raw
  To: gentoo-commits

commit:     a89b4a4f5031fa964113a6663db48b4e18bf1217
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sat Sep 26 11:54:15 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 03:43:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a89b4a4f

dev-util/rt-tests: Drop old

Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/17676
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-1.8-musl.patch | 380 ------------------------
 dev-util/rt-tests/rt-tests-1.8.ebuild           |  38 ---
 3 files changed, 419 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 3a6f1eccd32..8ef3346de3c 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-1.8.tar.xz 105820 BLAKE2B 478ac14732393f718e6be818b82b24b1e53d2f293140012bc17fd1c9242bd885b4d70dca3c7f3187e9ba22334e5f83d9ad1993ab9f70079e1765b918deab4411 SHA512 41c0b18e84d1f76de22a4ab239d43ac678b8c8419b508c96204bef346734122b9a42df51fcea97b1e0675bd25ed1e262730236ec0cb189732d5810122e96aa39
 DIST rt-tests-1.9.tar.xz 112180 BLAKE2B fa9b7b70bd9ae5d5f5e1077ddbd916bc4556d079d4067f16289ab34fec16ed0c8074607a7a8e50ea7bad4df318a063074f1c0ec5c2e895851d3045d51a8ecd74 SHA512 66f086dbda31567e6dc5297424ec66b2c6bd7cb0e065c32e02c326f33967f3a301b1b34f9eb0dd0acd853279c64fb1c2bc271ac26648f4abc3f6090ba6484cfa

diff --git a/dev-util/rt-tests/files/rt-tests-1.8-musl.patch b/dev-util/rt-tests/files/rt-tests-1.8-musl.patch
deleted file mode 100644
index 48a7a297afc..00000000000
--- a/dev-util/rt-tests/files/rt-tests-1.8-musl.patch
+++ /dev/null
@@ -1,380 +0,0 @@
-From 4daa685588ee3848fc98fd9c6328b76f136ee876 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |  5 --
- src/backfire/sendme.c                 |  1 +
- src/cyclictest/cyclictest.c           | 68 ++++-----------------------
- src/hackbench/hackbench.c             |  4 +-
- src/include/musl.h                    | 28 +++++++++++
- src/lib/rt-utils.c                    |  1 +
- src/pi_tests/classic_pi.c             |  2 +
- src/pi_tests/tst-mutexpi10.c          |  2 +
- src/pmqtest/pmqtest.c                 |  1 +
- src/ptsematest/ptsematest.c           |  1 +
- src/rt-migrate-test/rt-migrate-test.c |  1 +
- src/sched_deadline/cyclicdeadline.c   |  2 +
- 12 files changed, 50 insertions(+), 66 deletions(-)
- create mode 100644 src/include/musl.h
-
-diff --git a/Makefile b/Makefile
-index 05fc5eda71fa..9340f28f2c32 100644
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -35,7 +34,6 @@ LDFLAGS ?=
- PYLIB  ?= $(shell python3 -c 'import distutils.sysconfig;  print (distutils.sysconfig.get_python_lib())')
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -125,9 +123,6 @@ deadline_test: $(OBJDIR)/deadline_test.o $(OBJDIR)/librttest.a
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
-diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c
-index c1854d9660cb..ecec5c201bef 100644
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -31,6 +31,7 @@
- #include <errno.h>
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
-+#include "musl.h"
- 
- #include <utmpx.h>
- #include <sys/types.h>
-diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
-index c5f1fd46567a..8204e57cbbac 100644
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -36,6 +36,7 @@
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-+#include "musl.h"
- 
- #include <bionic.h>
- 
-@@ -628,12 +629,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop;
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -664,14 +661,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -726,20 +715,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -747,16 +722,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -878,11 +847,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -907,17 +871,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1417,7 +1370,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1450,13 +1404,6 @@ 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
-@@ -2157,7 +2104,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -2207,16 +2153,18 @@ int main(int argc, char **argv)
- 			void *stack;
- 			void *currstk;
- 			size_t stksize;
-+			int err;
- 
- 			/* find the memory node associated with the 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))
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
-diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
-index 5a883d341f2e..9f1e4db736a7 100644
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -24,13 +24,15 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <limits.h>
- #include <getopt.h>
- #include <signal.h>
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
-diff --git a/src/include/musl.h b/src/include/musl.h
-new file mode 100644
-index 000000000000..ea5075e768c8
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
-diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
-index 1998a327d036..f7adda9c5987 100644
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -23,6 +23,7 @@
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "error.h"
-+#include "musl.h"
- 
- static char debugfileprefix[MAX_PATH];
- 
-diff --git a/src/pi_tests/classic_pi.c b/src/pi_tests/classic_pi.c
-index 64af8890276f..bb088d3973b2 100644
---- a/src/pi_tests/classic_pi.c
-+++ b/src/pi_tests/classic_pi.c
-@@ -34,6 +34,8 @@
- #include <signal.h>
- #include <getopt.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
-diff --git a/src/pi_tests/tst-mutexpi10.c b/src/pi_tests/tst-mutexpi10.c
-index 97a345edd26e..1028d344edff 100644
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
-diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
-index 3ce29252b9a2..1a57841cb7e8 100644
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "error.h"
-+#include "musl.h"
- 
- #include <pthread.h>
- 
-diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
-index 485c991ec173..c000e083615f 100644
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "error.h"
-+#include "musl.h"
- 
- #include <pthread.h>
- 
-diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
-index 4863238edeb4..9f1aba159dc7 100644
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -25,6 +25,7 @@
- #include <sched.h>
- #include <pthread.h>
- #include "rt-utils.h"
-+#include "musl.h"
- 
- int nr_tasks;
- int lfd;
-diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
-index a08e28e73c42..675a0ea1a162 100644
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -32,6 +32,8 @@
- #include <rt-utils.h>
- #include <rt-sched.h>
- 
-+#include "musl.h"
-+
- #define _STR(x) #x
- #define STR(x) _STR(x)
- #ifndef MAXPATH
--- 
-2.24.1
-

diff --git a/dev-util/rt-tests/rt-tests-1.8.ebuild b/dev-util/rt-tests/rt-tests-1.8.ebuild
deleted file mode 100644
index f94e433d66c..00000000000
--- a/dev-util/rt-tests/rt-tests-1.8.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6..8} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake prefix=/usr DESTDIR="${D}" MAN_COMPRESSION=none install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2020-12-27  3:37 Sam James
  0 siblings, 0 replies; 14+ messages in thread
From: Sam James @ 2020-12-27  3:37 UTC (permalink / raw
  To: gentoo-commits

commit:     c7ffbfcb430ed7bd6a62e14b8efec33a5e187c64
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Wed Dec 23 09:11:30 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 27 03:32:59 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7ffbfcb

dev-util/rt-tests: Drop old

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/18777
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-1.9-musl.patch | 380 ------------------------
 dev-util/rt-tests/rt-tests-1.9.ebuild           |  38 ---
 3 files changed, 419 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index bad4155f3b7..9ef496a4e6c 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
 DIST rt-tests-1.10.tar.xz 112300 BLAKE2B b38a7357b1402de94661014e71ed9fc48d9dde6cabbe72ed4031841b57f7fb76a01dda03c7888f11d8e5e9c11cda8281dae1b437f0d1ff971d2941547f659103 SHA512 9512419b364746ad490894c7184a391f0e8d571477ad636abff8ed473151c6f2c263475ca4aa7d498e81c18e17e42ae82260693b90bce4ef9889e0eaf0b77b58
-DIST rt-tests-1.9.tar.xz 112180 BLAKE2B fa9b7b70bd9ae5d5f5e1077ddbd916bc4556d079d4067f16289ab34fec16ed0c8074607a7a8e50ea7bad4df318a063074f1c0ec5c2e895851d3045d51a8ecd74 SHA512 66f086dbda31567e6dc5297424ec66b2c6bd7cb0e065c32e02c326f33967f3a301b1b34f9eb0dd0acd853279c64fb1c2bc271ac26648f4abc3f6090ba6484cfa

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
deleted file mode 100644
index 0114cd00447..00000000000
--- a/dev-util/rt-tests/files/rt-tests-1.9-musl.patch
+++ /dev/null
@@ -1,380 +0,0 @@
-From fd78f200ac8e9d1eb7579cd9e4adaaa1a4dc2d46 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |  5 --
- src/backfire/sendme.c                 |  1 +
- src/cyclictest/cyclictest.c           | 68 ++++-----------------------
- src/hackbench/hackbench.c             |  4 +-
- src/include/musl.h                    | 28 +++++++++++
- src/lib/rt-utils.c                    |  1 +
- src/pi_tests/classic_pi.c             |  2 +
- src/pi_tests/tst-mutexpi10.c          |  2 +
- src/pmqtest/pmqtest.c                 |  1 +
- src/ptsematest/ptsematest.c           |  1 +
- src/rt-migrate-test/rt-migrate-test.c |  1 +
- src/sched_deadline/cyclicdeadline.c   |  2 +
- 12 files changed, 50 insertions(+), 66 deletions(-)
- create mode 100644 src/include/musl.h
-
-diff --git a/Makefile b/Makefile
-index c3ebbd7b2a2e..8815c113c0df 100644
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -36,7 +35,6 @@ LDFLAGS ?=
- PYLIB  ?= $(shell python3 -c 'import distutils.sysconfig;  print (distutils.sysconfig.get_python_lib())')
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -129,9 +127,6 @@ deadline_test: $(OBJDIR)/deadline_test.o $(OBJDIR)/librttest.a
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
-diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c
-index d963723b1c93..b355bbbcfece 100644
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -31,6 +31,7 @@
- #include <errno.h>
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
-+#include "musl.h"
- 
- #include <utmpx.h>
- #include <sys/types.h>
-diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
-index b41d42f13f24..56b27a4e0547 100644
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -36,6 +36,7 @@
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-+#include "musl.h"
- 
- #include <bionic.h>
- 
-@@ -501,12 +502,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop;
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -537,14 +534,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -599,20 +588,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -620,16 +595,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -751,11 +720,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -780,17 +744,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1305,7 +1258,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1338,13 +1292,6 @@ 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
-@@ -2038,7 +1985,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -2088,16 +2034,18 @@ int main(int argc, char **argv)
- 			void *stack;
- 			void *currstk;
- 			size_t stksize;
-+			int err;
- 
- 			/* find the memory node associated with the 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))
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
-diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
-index 2cddff654df6..46f09fa9e7ba 100644
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -24,13 +24,15 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <limits.h>
- #include <getopt.h>
- #include <signal.h>
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
-diff --git a/src/include/musl.h b/src/include/musl.h
-new file mode 100644
-index 000000000000..ea5075e768c8
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
-diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
-index f786588706cd..c1a55272dfdb 100644
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -23,6 +23,7 @@
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "error.h"
-+#include "musl.h"
- 
- #define  TRACEBUFSIZ  1024
- 
-diff --git a/src/pi_tests/classic_pi.c b/src/pi_tests/classic_pi.c
-index 64af8890276f..bb088d3973b2 100644
---- a/src/pi_tests/classic_pi.c
-+++ b/src/pi_tests/classic_pi.c
-@@ -34,6 +34,8 @@
- #include <signal.h>
- #include <getopt.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
-diff --git a/src/pi_tests/tst-mutexpi10.c b/src/pi_tests/tst-mutexpi10.c
-index 97a345edd26e..1028d344edff 100644
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
-diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
-index 5db8d348cdf8..2de6c1417e4a 100644
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "error.h"
-+#include "musl.h"
- 
- #include <pthread.h>
- 
-diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
-index de8ea2fe1b0c..1568f3b78711 100644
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "error.h"
-+#include "musl.h"
- 
- #include <pthread.h>
- 
-diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
-index 4863238edeb4..9f1aba159dc7 100644
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -25,6 +25,7 @@
- #include <sched.h>
- #include <pthread.h>
- #include "rt-utils.h"
-+#include "musl.h"
- 
- int nr_tasks;
- int lfd;
-diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
-index a08e28e73c42..675a0ea1a162 100644
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -32,6 +32,8 @@
- #include <rt-utils.h>
- #include <rt-sched.h>
- 
-+#include "musl.h"
-+
- #define _STR(x) #x
- #define STR(x) _STR(x)
- #ifndef MAXPATH
--- 
-2.26.2
-

diff --git a/dev-util/rt-tests/rt-tests-1.9.ebuild b/dev-util/rt-tests/rt-tests-1.9.ebuild
deleted file mode 100644
index cb4f2d29351..00000000000
--- a/dev-util/rt-tests/rt-tests-1.9.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6..9} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake prefix=/usr DESTDIR="${D}" MAN_COMPRESSION=none install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2021-07-14 14:32 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2021-07-14 14:32 UTC (permalink / raw
  To: gentoo-commits

commit:     2cf5fb49efa0ce24ca737de70fb6a5e01297ee6e
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sat Jun 26 07:54:09 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Wed Jul 14 14:32:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2cf5fb49

dev-util/rt-tests: Bump version to v2.0

Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 +
 dev-util/rt-tests/files/rt-tests-2.0-musl.patch | 352 ++++++++++++++++++++++++
 dev-util/rt-tests/rt-tests-2.0.ebuild           |  38 +++
 3 files changed, 391 insertions(+)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 9ef496a4e6c..c246fed4f7c 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1 +1,2 @@
 DIST rt-tests-1.10.tar.xz 112300 BLAKE2B b38a7357b1402de94661014e71ed9fc48d9dde6cabbe72ed4031841b57f7fb76a01dda03c7888f11d8e5e9c11cda8281dae1b437f0d1ff971d2941547f659103 SHA512 9512419b364746ad490894c7184a391f0e8d571477ad636abff8ed473151c6f2c263475ca4aa7d498e81c18e17e42ae82260693b90bce4ef9889e0eaf0b77b58
+DIST rt-tests-2.0.tar.xz 114944 BLAKE2B 809224e6d480b098ed398c0646070f18aa25e8947485709ff309c4a2ee289797924e6df39ac2af68b91b2df064642d56bd8f7aa7332764d95d53e7d9a34d4ca7 SHA512 6c582734eb41f7addaac7d0f3dbb313e3af30eb2b662781f6c62dbaf13da2e84f36a6f918f11608406ca2a08636df93375272444a2cdf205e782ec9f4bc45dca

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
new file mode 100644
index 00000000000..4c97c640a5c
--- /dev/null
+++ b/dev-util/rt-tests/files/rt-tests-2.0-musl.patch
@@ -0,0 +1,352 @@
+From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <kurt@kmk-computers.de>
+Date: Wed, 1 Apr 2020 20:15:24 +0200
+Subject: [PATCH] all: Fix musl build
+
+There are a few problems:
+
+ * pi stress:  pthread_attr_setaffinity_np() is not supported
+ * cyclictest: SIGEV_THREAD_ID is not supported
+ * hackbench:  Fix include
+ * all:        Fix sched_* calls
+
+With these changes applied, the rt-tests seem to run fine.
+
+Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
+---
+ Makefile                              |    5 --
+ src/backfire/sendme.c                 |    1 
+ src/cyclictest/cyclictest.c           |   70 ++++------------------------------
+ src/hackbench/hackbench.c             |    4 +
+ src/include/musl.h                    |   28 +++++++++++++
+ src/lib/rt-utils.c                    |    1 
+ src/pi_tests/classic_pi.c             |    2 
+ src/pi_tests/tst-mutexpi10.c          |    2 
+ src/pmqtest/pmqtest.c                 |    1 
+ src/ptsematest/ptsematest.c           |    1 
+ src/rt-migrate-test/rt-migrate-test.c |    1 
+ src/sched_deadline/cyclicdeadline.c   |    1 
+ 12 files changed, 50 insertions(+), 67 deletions(-)
+ create mode 100644 src/include/musl.h
+
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,6 @@ OBJDIR = bld
+ sources = cyclictest.c \
+ 	  hackbench.c \
+ 	  pip_stress.c \
+-	  pi_stress.c \
+ 	  pmqtest.c \
+ 	  ptsematest.c \
+ 	  rt-migrate-test.c \
+@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
+ endif
+ 
+ MANPAGES = src/cyclictest/cyclictest.8 \
+-	   src/pi_tests/pi_stress.8 \
+ 	   src/ptsematest/ptsematest.8 \
+ 	   src/rt-migrate-test/rt-migrate-test.8 \
+ 	   src/sigwaittest/sigwaittest.8 \
+@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
+ signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
+ 
+-pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
+-
+ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
+ 	chmod +x src/hwlatdetect/hwlatdetect.py
+ 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
+--- a/src/backfire/sendme.c
++++ b/src/backfire/sendme.c
+@@ -29,6 +29,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <errno.h>
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ 
+--- a/src/cyclictest/cyclictest.c
++++ b/src/cyclictest/cyclictest.c
+@@ -33,6 +33,7 @@
+ #include <sys/utsname.h>
+ #include <sys/mman.h>
+ #include <sys/syscall.h>
++#include "musl.h"
+ #include "rt_numa.h"
+ 
+ #include "rt-utils.h"
+@@ -502,12 +503,8 @@ static void *timerthread(void *param)
+ {
+ 	struct thread_param *par = param;
+ 	struct sched_param schedp;
+-	struct sigevent sigev;
+ 	sigset_t sigset;
+-	timer_t timer;
+ 	struct timespec now, next, interval, stop;
+-	struct itimerval itimer;
+-	struct itimerspec tspec;
+ 	struct thread_stat *stat = par->stats;
+ 	int stopped = 0;
+ 	cpu_set_t mask;
+@@ -538,14 +535,6 @@ static void *timerthread(void *param)
+ 	sigaddset(&sigset, par->signal);
+ 	sigprocmask(SIG_BLOCK, &sigset, NULL);
+ 
+-	if (par->mode == MODE_CYCLIC) {
+-		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
+-		sigev.sigev_signo = par->signal;
+-		sigev.sigev_notify_thread_id = stat->tid;
+-		timer_create(par->clock, &sigev, &timer);
+-		tspec.it_interval = interval;
+-	}
+-
+ 	memset(&schedp, 0, sizeof(schedp));
+ 	schedp.sched_priority = par->prio;
+ 	if (setscheduler(0, par->policy, &schedp))
+@@ -600,20 +589,6 @@ static void *timerthread(void *param)
+ 		stop = now;
+ 		stop.tv_sec += duration;
+ 	}
+-	if (par->mode == MODE_CYCLIC) {
+-		if (par->timermode == TIMER_ABSTIME)
+-			tspec.it_value = next;
+-		else
+-			tspec.it_value = interval;
+-		timer_settime(timer, par->timermode, &tspec, NULL);
+-	}
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_interval.tv_sec = interval.tv_sec;
+-		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+-		itimer.it_value = itimer.it_interval;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+ 
+ 	rt_test_start();
+ 	stat->threadstarted++;
+@@ -622,16 +597,10 @@ static void *timerthread(void *param)
+ 
+ 		uint64_t diff;
+ 		unsigned long diff_smi = 0;
+-		int sigs, ret;
++		int ret;
+ 
+ 		/* Wait for next period */
+ 		switch (par->mode) {
+-		case MODE_CYCLIC:
+-		case MODE_SYS_ITIMER:
+-			if (sigwait(&sigset, &sigs) < 0)
+-				goto out;
+-			break;
+-
+ 		case MODE_CLOCK_NANOSLEEP:
+ 			if (par->timermode == TIMER_ABSTIME) {
+ 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
+@@ -752,11 +721,6 @@ static void *timerthread(void *param)
+ 
+ 		next.tv_sec += interval.tv_sec;
+ 		next.tv_nsec += interval.tv_nsec;
+-		if (par->mode == MODE_CYCLIC) {
+-			int overrun_count = timer_getoverrun(timer);
+-			next.tv_sec += overrun_count * interval.tv_sec;
+-			next.tv_nsec += overrun_count * interval.tv_nsec;
+-		}
+ 		tsnorm(&next);
+ 
+ 		while (tsgreater(&now, &next)) {
+@@ -781,17 +745,6 @@ out:
+ 		pthread_mutex_unlock(&refresh_on_max_lock);
+ 	}
+ 
+-	if (par->mode == MODE_CYCLIC)
+-		timer_delete(timer);
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_value.tv_sec = 0;
+-		itimer.it_value.tv_usec = 0;
+-		itimer.it_interval.tv_sec = 0;
+-		itimer.it_interval.tv_usec = 0;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+-
+ 	/* close msr file */
+ 	if (smi)
+ 		close(par->msr_fd);
+@@ -1175,7 +1128,8 @@ static void process_options(int argc, ch
+ 		case OPT_VERBOSE: verbose = 1; break;
+ 		case 'x':
+ 		case OPT_POSIX_TIMERS:
+-			use_nanosleep = MODE_CYCLIC; break;
++			fatal("--posix_timers is not available on your libc\n");
++			break;
+ 		case '?':
+ 		case OPT_HELP:
+ 			display_help(0); break;
+@@ -1208,13 +1162,6 @@ static void process_options(int argc, ch
+ 		}
+ 	}
+ 
+-	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) {
+ 		numa = numa_initialize();
+@@ -1944,7 +1891,6 @@ int main(int argc, char **argv)
+ 
+ 	}
+ 
+-
+ 	mode = use_nanosleep + use_system;
+ 
+ 	sigemptyset(&sigset);
+@@ -1994,16 +1940,18 @@ int main(int argc, char **argv)
+ 			void *stack;
+ 			void *currstk;
+ 			size_t stksize;
++			int err;
+ 
+ 			/* find the memory node associated with the cpu i */
+ 			node = rt_numa_numa_node_of_cpu(cpu);
+ 
+-			/* get the stack size set for this thread */
+-			if (pthread_attr_getstack(&attr, &currstk, &stksize))
++			/* get the stack size set for for this thread */
++			err = pthread_attr_getstack(&attr, &currstk, &stksize);
++			if (err != EINVAL)
+ 				fatal("failed to get stack size for thread %d\n", i);
+ 
+ 			/* if the stack size is zero, set a default */
+-			if (stksize == 0)
++			if (err == EINVAL || stksize == 0)
+ 				stksize = PTHREAD_STACK_MIN * 2;
+ 
+ 			/*  allocate memory for a stack on appropriate node */
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -24,13 +24,15 @@
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+ #include <sys/time.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <limits.h>
+ #include <getopt.h>
+ #include <signal.h>
+ #include <setjmp.h>
+ #include <sched.h>
+ 
++#include "musl.h"
++
+ static unsigned int datasize = 100;
+ static unsigned int loops = 100;
+ static unsigned int num_groups = 10;
+--- /dev/null
++++ b/src/include/musl.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
++ * Time-stamp: <2020-04-04 10:54:01 kurt>
++ */
++
++#ifndef _MUSL_H_
++#define _MUSL_H_
++
++#include <unistd.h>
++#include <sys/syscall.h>
++
++/*
++ * Musl someshow defines sched_* to ENOSYS which is not correct ...
++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
++ *
++ * Workaround: define them to syscall(...)
++ */
++
++#define sched_getparam(pid, param)		\
++	syscall(SYS_sched_getparam, pid, param)
++#define sched_setparam(pid, param)		\
++	syscall(SYS_sched_setparam, pid, param)
++#define sched_getscheduler(pid)			\
++	syscall(SYS_sched_getscheduler, pid)
++#define sched_setscheduler(pid, policy, param)			\
++	syscall(SYS_sched_setscheduler, pid, policy, param)
++
++#endif /* _MUSL_H_ */
+--- a/src/lib/rt-utils.c
++++ b/src/lib/rt-utils.c
+@@ -24,6 +24,7 @@
+ #include <time.h>
+ #include <sys/time.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"
+--- a/src/pi_tests/classic_pi.c
++++ b/src/pi_tests/classic_pi.c
+@@ -34,6 +34,8 @@
+ #include <signal.h>
+ #include <getopt.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+--- a/src/pi_tests/tst-mutexpi10.c
++++ b/src/pi_tests/tst-mutexpi10.c
+@@ -35,6 +35,8 @@
+ #include <string.h>
+ #include <signal.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+--- a/src/pmqtest/pmqtest.c
++++ b/src/pmqtest/pmqtest.c
+@@ -24,6 +24,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/ptsematest/ptsematest.c
++++ b/src/ptsematest/ptsematest.c
+@@ -22,6 +22,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/rt-migrate-test/rt-migrate-test.c
++++ b/src/rt-migrate-test/rt-migrate-test.c
+@@ -27,6 +27,7 @@
+ 
+ #include <linux/unistd.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ 
+ int nr_tasks;
+--- a/src/sched_deadline/cyclicdeadline.c
++++ b/src/sched_deadline/cyclicdeadline.c
+@@ -30,6 +30,7 @@
+ #include <linux/unistd.h>
+ #include <linux/magic.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.0.ebuild b/dev-util/rt-tests/rt-tests-2.0.ebuild
new file mode 100644
index 00000000000..8f2df0599b2
--- /dev/null
+++ b/dev-util/rt-tests/rt-tests-2.0.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..10} )
+
+inherit python-single-r1 toolchain-funcs
+
+DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
+SRC_URI="
+	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
+	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
+
+LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	sys-process/numactl"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	default
+	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
+}
+
+src_install() {
+	emake prefix=/usr DESTDIR="${ED}" install
+	python_fix_shebang "${ED}"
+	python_optimize
+}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2021-09-04  6:26 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2021-09-04  6:26 UTC (permalink / raw
  To: gentoo-commits

commit:     0ac86047562e2af91930409099450a8c27ebf5da
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Thu Sep  2 19:37:45 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sat Sep  4 05:46:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ac86047

dev-util/rt-tests: Drop old

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/22196
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-2.1-musl.patch | 352 ------------------------
 dev-util/rt-tests/rt-tests-2.1.ebuild           |  38 ---
 3 files changed, 391 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index b46d2349770..0617ddb9a28 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-2.1.tar.xz 114892 BLAKE2B 25a382c898ffdbbe7b6c3f69f440b87ca6b88cc634aae06a3e02154954b8b50da46e2f2b3291d7473bb0ae533f5a90a7769433650bab3f7c229a5d3022e32b50 SHA512 7abab6c1191247ac44f4e5193752474756d82fdf1d8a3b69c92c8d37bd4fe8458444d2165894fc8483590809ff5b4f1c755d66afb296e72041f9efbedd048d0d
 DIST rt-tests-2.2.tar.xz 115120 BLAKE2B 46db78d32b2d5830859757c21e42d4e21cb0da8b2ebcbf8ba738c8e3832a6ea597d686ee6c9cad23f269853ad188219f46a0e5326124f056b4822619076268ac SHA512 826dc8894dd8670e705566b5224f54bdee89e5b48f21ca00e6c4061f28c4fbe2dab14c1e1b1302fec7011dbf28f3eb88c1b8adc137fed7d17958ea972e3c08b1

diff --git a/dev-util/rt-tests/files/rt-tests-2.1-musl.patch b/dev-util/rt-tests/files/rt-tests-2.1-musl.patch
deleted file mode 100644
index caa8d415aad..00000000000
--- a/dev-util/rt-tests/files/rt-tests-2.1-musl.patch
+++ /dev/null
@@ -1,352 +0,0 @@
-From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |    5 --
- src/backfire/sendme.c                 |    1 
- src/cyclictest/cyclictest.c           |   70 ++++------------------------------
- src/hackbench/hackbench.c             |    4 +
- src/include/musl.h                    |   28 +++++++++++++
- src/lib/rt-utils.c                    |    1 
- src/pi_tests/classic_pi.c             |    2 
- src/pi_tests/tst-mutexpi10.c          |    2 
- src/pmqtest/pmqtest.c                 |    1 
- src/ptsematest/ptsematest.c           |    1 
- src/rt-migrate-test/rt-migrate-test.c |    1 
- src/sched_deadline/cyclicdeadline.c   |    1 
- 12 files changed, 50 insertions(+), 67 deletions(-)
- create mode 100644 src/include/musl.h
-
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
- endif
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -29,6 +29,7 @@
- #include <string.h>
- #include <time.h>
- #include <errno.h>
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- 
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -33,6 +33,7 @@
- #include <sys/utsname.h>
- #include <sys/mman.h>
- #include <sys/syscall.h>
-+#include "musl.h"
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-@@ -502,12 +503,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop;
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -538,14 +535,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -600,20 +589,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -621,16 +596,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -751,11 +720,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -780,17 +744,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1174,7 +1127,8 @@ static void process_options(int argc, ch
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1207,13 +1161,6 @@ static void process_options(int argc, ch
- 		}
- 	}
- 
--	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) {
- 		numa = numa_initialize();
-@@ -1943,7 +1890,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -1993,16 +1939,18 @@ int main(int argc, char **argv)
- 			void *stack;
- 			void *currstk;
- 			size_t stksize;
-+			int err;
- 
- 			/* find the memory node associated with the cpu i */
- 			node = rt_numa_numa_node_of_cpu(cpu);
- 
--			/* get the stack size set for this thread */
--			if (pthread_attr_getstack(&attr, &currstk, &stksize))
-+			/* get the stack size set for for this thread */
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -24,13 +24,15 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <limits.h>
- #include <getopt.h>
- #include <signal.h>
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -24,6 +24,7 @@
- #include <time.h>
- #include <sys/time.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"
---- a/src/pi_tests/classic_pi.c
-+++ b/src/pi_tests/classic_pi.c
-@@ -34,6 +34,8 @@
- #include <signal.h>
- #include <getopt.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -27,6 +27,7 @@
- 
- #include <linux/unistd.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- 
- int nr_tasks;
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -30,6 +30,7 @@
- #include <linux/unistd.h>
- #include <linux/magic.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.1.ebuild b/dev-util/rt-tests/rt-tests-2.1.ebuild
deleted file mode 100644
index 8f2df0599b2..00000000000
--- a/dev-util/rt-tests/rt-tests-2.1.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7..10} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake prefix=/usr DESTDIR="${ED}" install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2022-01-05 19:19 Florian Schmaus
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Schmaus @ 2022-01-05 19:19 UTC (permalink / raw
  To: gentoo-commits

commit:     e78e6351429ea293f27c43ec6d03fc68b1ea0b24
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Mon Dec 27 19:51:57 2021 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Jan  5 19:18:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e78e6351

dev-util/rt-tests: Drop old

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/23551
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-2.2-musl.patch | 352 ------------------------
 dev-util/rt-tests/rt-tests-2.2.ebuild           |  38 ---
 3 files changed, 391 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index b157404b489c..6f230e4f00d8 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-2.2.tar.xz 115120 BLAKE2B 46db78d32b2d5830859757c21e42d4e21cb0da8b2ebcbf8ba738c8e3832a6ea597d686ee6c9cad23f269853ad188219f46a0e5326124f056b4822619076268ac SHA512 826dc8894dd8670e705566b5224f54bdee89e5b48f21ca00e6c4061f28c4fbe2dab14c1e1b1302fec7011dbf28f3eb88c1b8adc137fed7d17958ea972e3c08b1
 DIST rt-tests-2.3.tar.xz 115000 BLAKE2B d5f6a31a31340873348b5ffa6c706deb080e9686944a759fa4e4d53f2041d3f27aa1e9512d7413438bce7c61e05e2495c96eeef0b976ee09377f89d847225aef SHA512 3bf6fe95c5ac9911fb51fba1d4a8e6ad3b96a6cdce464372917673862801353cbbb377c76d3a19325f0b5402f65daf5c605e496d7460949615069366a00a978a

diff --git a/dev-util/rt-tests/files/rt-tests-2.2-musl.patch b/dev-util/rt-tests/files/rt-tests-2.2-musl.patch
deleted file mode 100644
index caa8d415aad5..000000000000
--- a/dev-util/rt-tests/files/rt-tests-2.2-musl.patch
+++ /dev/null
@@ -1,352 +0,0 @@
-From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |    5 --
- src/backfire/sendme.c                 |    1 
- src/cyclictest/cyclictest.c           |   70 ++++------------------------------
- src/hackbench/hackbench.c             |    4 +
- src/include/musl.h                    |   28 +++++++++++++
- src/lib/rt-utils.c                    |    1 
- src/pi_tests/classic_pi.c             |    2 
- src/pi_tests/tst-mutexpi10.c          |    2 
- src/pmqtest/pmqtest.c                 |    1 
- src/ptsematest/ptsematest.c           |    1 
- src/rt-migrate-test/rt-migrate-test.c |    1 
- src/sched_deadline/cyclicdeadline.c   |    1 
- 12 files changed, 50 insertions(+), 67 deletions(-)
- create mode 100644 src/include/musl.h
-
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
- endif
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -29,6 +29,7 @@
- #include <string.h>
- #include <time.h>
- #include <errno.h>
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- 
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -33,6 +33,7 @@
- #include <sys/utsname.h>
- #include <sys/mman.h>
- #include <sys/syscall.h>
-+#include "musl.h"
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-@@ -502,12 +503,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop;
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -538,14 +535,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -600,20 +589,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -621,16 +596,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -751,11 +720,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -780,17 +744,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1174,7 +1127,8 @@ static void process_options(int argc, ch
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1207,13 +1161,6 @@ static void process_options(int argc, ch
- 		}
- 	}
- 
--	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) {
- 		numa = numa_initialize();
-@@ -1943,7 +1890,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -1993,16 +1939,18 @@ int main(int argc, char **argv)
- 			void *stack;
- 			void *currstk;
- 			size_t stksize;
-+			int err;
- 
- 			/* find the memory node associated with the cpu i */
- 			node = rt_numa_numa_node_of_cpu(cpu);
- 
--			/* get the stack size set for this thread */
--			if (pthread_attr_getstack(&attr, &currstk, &stksize))
-+			/* get the stack size set for for this thread */
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -24,13 +24,15 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <limits.h>
- #include <getopt.h>
- #include <signal.h>
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -24,6 +24,7 @@
- #include <time.h>
- #include <sys/time.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"
---- a/src/pi_tests/classic_pi.c
-+++ b/src/pi_tests/classic_pi.c
-@@ -34,6 +34,8 @@
- #include <signal.h>
- #include <getopt.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -27,6 +27,7 @@
- 
- #include <linux/unistd.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- 
- int nr_tasks;
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -30,6 +30,7 @@
- #include <linux/unistd.h>
- #include <linux/magic.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.2.ebuild b/dev-util/rt-tests/rt-tests-2.2.ebuild
deleted file mode 100644
index 247753110450..000000000000
--- a/dev-util/rt-tests/rt-tests-2.2.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{7..10} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2022-07-15  8:38 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2022-07-15  8:38 UTC (permalink / raw
  To: gentoo-commits

commit:     4e7a8cced97fafdfbd2ffb60b6e45c94962ef831
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sat Jul  9 11:01:58 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 08:38:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e7a8cce

dev-util/rt-tests: drop 2.3

Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/26310
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-2.3-musl.patch | 352 ------------------------
 dev-util/rt-tests/rt-tests-2.3.ebuild           |  38 ---
 3 files changed, 391 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 26e82f44e3de..498f459a860d 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-2.3.tar.xz 115000 BLAKE2B d5f6a31a31340873348b5ffa6c706deb080e9686944a759fa4e4d53f2041d3f27aa1e9512d7413438bce7c61e05e2495c96eeef0b976ee09377f89d847225aef SHA512 3bf6fe95c5ac9911fb51fba1d4a8e6ad3b96a6cdce464372917673862801353cbbb377c76d3a19325f0b5402f65daf5c605e496d7460949615069366a00a978a
 DIST rt-tests-2.4.tar.xz 104172 BLAKE2B bd7ac3ff64171b122341eec81ac61dcda429d33d6a69362d498d5db667b8cb77502d745bc2f7ce03cc1e958d02889a902f65544c7fef994fb4d7e72230c73e10 SHA512 308207ad620ee458e4ac000a9437266a84f4807d9cecd8030d5ae12a210c2a01f80a331bb60faeb41244d7ab80b3cadf8164711547a02f5afa353d1a3644d794

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
deleted file mode 100644
index 6732521a07a6..000000000000
--- a/dev-util/rt-tests/files/rt-tests-2.3-musl.patch
+++ /dev/null
@@ -1,352 +0,0 @@
-From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |    5 --
- src/backfire/sendme.c                 |    1 
- src/cyclictest/cyclictest.c           |   70 ++++------------------------------
- src/hackbench/hackbench.c             |    4 +
- src/include/musl.h                    |   28 +++++++++++++
- src/lib/rt-utils.c                    |    1 
- src/pi_tests/classic_pi.c             |    2 
- src/pi_tests/tst-mutexpi10.c          |    2 
- src/pmqtest/pmqtest.c                 |    1 
- src/ptsematest/ptsematest.c           |    1 
- src/rt-migrate-test/rt-migrate-test.c |    1 
- src/sched_deadline/cyclicdeadline.c   |    1 
- 12 files changed, 50 insertions(+), 67 deletions(-)
- create mode 100644 src/include/musl.h
-
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
- endif
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -29,6 +29,7 @@
- #include <string.h>
- #include <time.h>
- #include <errno.h>
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- 
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -33,6 +33,7 @@
- #include <sys/utsname.h>
- #include <sys/mman.h>
- #include <sys/syscall.h>
-+#include "musl.h"
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-@@ -504,12 +505,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop = { 0 };
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -538,14 +535,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -599,20 +588,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -620,16 +595,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -750,11 +719,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -779,17 +743,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1183,7 +1136,8 @@ static void process_options(int argc, ch
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1216,13 +1170,6 @@ static void process_options(int argc, ch
- 		}
- 	}
- 
--	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) {
- 		numa = numa_initialize();
-@@ -1952,7 +1899,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -2002,16 +1948,18 @@ int main(int argc, char **argv)
- 			void *stack;
- 			void *currstk;
- 			size_t stksize;
-+			int err;
- 
- 			/* find the memory node associated with the cpu i */
- 			node = rt_numa_numa_node_of_cpu(cpu);
- 
--			/* get the stack size set for this thread */
--			if (pthread_attr_getstack(&attr, &currstk, &stksize))
-+			/* get the stack size set for for this thread */
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -24,13 +24,15 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <limits.h>
- #include <getopt.h>
- #include <signal.h>
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -24,6 +24,7 @@
- #include <time.h>
- #include <sys/time.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"
---- a/src/pi_tests/classic_pi.c
-+++ b/src/pi_tests/classic_pi.c
-@@ -34,6 +34,8 @@
- #include <signal.h>
- #include <getopt.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -27,6 +27,7 @@
- 
- #include <linux/unistd.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- 
- int nr_tasks;
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -30,6 +30,7 @@
- #include <linux/unistd.h>
- #include <linux/magic.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.3.ebuild b/dev-util/rt-tests/rt-tests-2.3.ebuild
deleted file mode 100644
index 247753110450..000000000000
--- a/dev-util/rt-tests/rt-tests-2.3.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{7..10} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/about/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2023-02-05  8:30 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2023-02-05  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     9e71ff9ee41fc121d13c8997e428f13bed5f0689
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sun Jan 22 12:28:13 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Feb  5 08:30:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e71ff9e

dev-util/rt-tests: add 2.5

Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 +
 dev-util/rt-tests/files/rt-tests-2.5-musl.patch | 342 ++++++++++++++++++++++++
 dev-util/rt-tests/rt-tests-2.5.ebuild           |  38 +++
 3 files changed, 381 insertions(+)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 498f459a860d..67bb652596b0 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1 +1,2 @@
 DIST rt-tests-2.4.tar.xz 104172 BLAKE2B bd7ac3ff64171b122341eec81ac61dcda429d33d6a69362d498d5db667b8cb77502d745bc2f7ce03cc1e958d02889a902f65544c7fef994fb4d7e72230c73e10 SHA512 308207ad620ee458e4ac000a9437266a84f4807d9cecd8030d5ae12a210c2a01f80a331bb60faeb41244d7ab80b3cadf8164711547a02f5afa353d1a3644d794
+DIST rt-tests-2.5.tar.xz 104596 BLAKE2B 3c03be9fb58ede744b6521cd74cef923f667c94ad8a3abb3d88efa7733f7672c8151b22e122499d1811f16ccd5a9335110eeb6c7c722c9899c369c912112f3b2 SHA512 a9966b6da89a9778f668faee5c347024a43bf978826bf16f0f8034acbf383eb688c6962e1de80e7efd34a5a0c67cb7c37ed5822979676b76a1e725d620bfd391

diff --git a/dev-util/rt-tests/files/rt-tests-2.5-musl.patch b/dev-util/rt-tests/files/rt-tests-2.5-musl.patch
new file mode 100644
index 000000000000..a7aca4392ebb
--- /dev/null
+++ b/dev-util/rt-tests/files/rt-tests-2.5-musl.patch
@@ -0,0 +1,342 @@
+From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <kurt@kmk-computers.de>
+Date: Wed, 1 Apr 2020 20:15:24 +0200
+Subject: [PATCH] all: Fix musl build
+
+There are a few problems:
+
+ * pi stress:  pthread_attr_setaffinity_np() is not supported
+ * cyclictest: SIGEV_THREAD_ID is not supported
+ * hackbench:  Fix include
+ * all:        Fix sched_* calls
+
+With these changes applied, the rt-tests seem to run fine.
+
+Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
+---
+ Makefile                              |    5 --
+ src/backfire/sendme.c                 |    1 
+ src/cyclictest/cyclictest.c           |   68 ++++------------------------------
+ src/hackbench/hackbench.c             |    4 +-
+ src/include/musl.h                    |   28 ++++++++++++++
+ src/lib/rt-utils.c                    |    1 
+ src/pi_tests/tst-mutexpi10.c          |    2 +
+ src/pmqtest/pmqtest.c                 |    1 
+ src/ptsematest/ptsematest.c           |    1 
+ src/rt-migrate-test/rt-migrate-test.c |    1 
+ src/sched_deadline/cyclicdeadline.c   |    1 
+ 11 files changed, 47 insertions(+), 66 deletions(-)
+ create mode 100644 src/include/musl.h
+
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,6 @@ OBJDIR = bld
+ sources = cyclictest.c \
+ 	  hackbench.c \
+ 	  pip_stress.c \
+-	  pi_stress.c \
+ 	  pmqtest.c \
+ 	  ptsematest.c \
+ 	  rt-migrate-test.c \
+@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
+ endif
+ 
+ MANPAGES = src/cyclictest/cyclictest.8 \
+-	   src/pi_tests/pi_stress.8 \
+ 	   src/ptsematest/ptsematest.8 \
+ 	   src/rt-migrate-test/rt-migrate-test.8 \
+ 	   src/sigwaittest/sigwaittest.8 \
+@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
+ signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
+ 
+-pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
+-
+ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
+ 	chmod +x src/hwlatdetect/hwlatdetect.py
+ 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
+--- a/src/backfire/sendme.c
++++ b/src/backfire/sendme.c
+@@ -29,6 +29,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <errno.h>
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ 
+--- a/src/cyclictest/cyclictest.c
++++ b/src/cyclictest/cyclictest.c
+@@ -33,6 +33,7 @@
+ #include <sys/utsname.h>
+ #include <sys/mman.h>
+ #include <sys/syscall.h>
++#include "musl.h"
+ #include "rt_numa.h"
+ 
+ #include "rt-utils.h"
+@@ -546,12 +547,8 @@ static void *timerthread(void *param)
+ {
+ 	struct thread_param *par = param;
+ 	struct sched_param schedp;
+-	struct sigevent sigev;
+ 	sigset_t sigset;
+-	timer_t timer;
+ 	struct timespec now, next, interval, stop = { 0 };
+-	struct itimerval itimer;
+-	struct itimerspec tspec;
+ 	struct thread_stat *stat = par->stats;
+ 	int stopped = 0;
+ 	cpu_set_t mask;
+@@ -580,14 +577,6 @@ static void *timerthread(void *param)
+ 	sigaddset(&sigset, par->signal);
+ 	sigprocmask(SIG_BLOCK, &sigset, NULL);
+ 
+-	if (par->mode == MODE_CYCLIC) {
+-		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
+-		sigev.sigev_signo = par->signal;
+-		sigev.sigev_notify_thread_id = stat->tid;
+-		timer_create(par->clock, &sigev, &timer);
+-		tspec.it_interval = interval;
+-	}
+-
+ 	memset(&schedp, 0, sizeof(schedp));
+ 	schedp.sched_priority = par->prio;
+ 	if (setscheduler(0, par->policy, &schedp))
+@@ -641,20 +630,6 @@ static void *timerthread(void *param)
+ 		stop = now;
+ 		stop.tv_sec += duration;
+ 	}
+-	if (par->mode == MODE_CYCLIC) {
+-		if (par->timermode == TIMER_ABSTIME)
+-			tspec.it_value = next;
+-		else
+-			tspec.it_value = interval;
+-		timer_settime(timer, par->timermode, &tspec, NULL);
+-	}
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_interval.tv_sec = interval.tv_sec;
+-		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+-		itimer.it_value = itimer.it_interval;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+ 
+ 	stat->threadstarted++;
+ 
+@@ -662,16 +637,10 @@ static void *timerthread(void *param)
+ 
+ 		uint64_t diff;
+ 		unsigned long diff_smi = 0;
+-		int sigs, ret;
++		int ret;
+ 
+ 		/* Wait for next period */
+ 		switch (par->mode) {
+-		case MODE_CYCLIC:
+-		case MODE_SYS_ITIMER:
+-			if (sigwait(&sigset, &sigs) < 0)
+-				goto out;
+-			break;
+-
+ 		case MODE_CLOCK_NANOSLEEP:
+ 			if (par->timermode == TIMER_ABSTIME) {
+ 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
+@@ -792,11 +761,6 @@ static void *timerthread(void *param)
+ 
+ 		next.tv_sec += interval.tv_sec;
+ 		next.tv_nsec += interval.tv_nsec;
+-		if (par->mode == MODE_CYCLIC) {
+-			int overrun_count = timer_getoverrun(timer);
+-			next.tv_sec += overrun_count * interval.tv_sec;
+-			next.tv_nsec += overrun_count * interval.tv_nsec;
+-		}
+ 		tsnorm(&next);
+ 
+ 		while (tsgreater(&now, &next)) {
+@@ -821,17 +785,6 @@ out:
+ 		pthread_mutex_unlock(&refresh_on_max_lock);
+ 	}
+ 
+-	if (par->mode == MODE_CYCLIC)
+-		timer_delete(timer);
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_value.tv_sec = 0;
+-		itimer.it_value.tv_usec = 0;
+-		itimer.it_interval.tv_sec = 0;
+-		itimer.it_interval.tv_usec = 0;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+-
+ 	/* close msr file */
+ 	if (smi)
+ 		close(par->msr_fd);
+@@ -1227,7 +1180,8 @@ static void process_options(int argc, ch
+ 		case OPT_VERBOSE: verbose = 1; break;
+ 		case 'x':
+ 		case OPT_POSIX_TIMERS:
+-			use_nanosleep = MODE_CYCLIC; break;
++			fatal("--posix_timers is not available on your libc\n");
++			break;
+ 		case '?':
+ 		case OPT_HELP:
+ 			display_help(0); break;
+@@ -1260,13 +1214,6 @@ static void process_options(int argc, ch
+ 		}
+ 	}
+ 
+-	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) {
+ 		numa = numa_initialize();
+@@ -1991,7 +1938,6 @@ int main(int argc, char **argv)
+ 
+ 	}
+ 
+-
+ 	mode = use_nanosleep + use_system;
+ 
+ 	sigemptyset(&sigset);
+@@ -2042,6 +1988,7 @@ int main(int argc, char **argv)
+ 			void *currstk;
+ 			size_t stksize;
+ 			int node_cpu = cpu;
++			int err;
+ 
+ 			if (node_cpu == -1)
+ 				node_cpu = cpu_for_thread_ua(i, max_cpus);
+@@ -2050,11 +1997,12 @@ int main(int argc, char **argv)
+ 			node = rt_numa_numa_node_of_cpu(node_cpu);
+ 
+ 			/* get the stack size set for this thread */
+-			if (pthread_attr_getstack(&attr, &currstk, &stksize))
++			err = pthread_attr_getstack(&attr, &currstk, &stksize);
++			if (err != EINVAL)
+ 				fatal("failed to get stack size for thread %d\n", i);
+ 
+ 			/* if the stack size is zero, set a default */
+-			if (stksize == 0)
++			if (err == EINVAL || stksize == 0)
+ 				stksize = PTHREAD_STACK_MIN * 2;
+ 
+ 			/*  allocate memory for a stack on appropriate node */
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -25,7 +25,7 @@
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+ #include <sys/time.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <limits.h>
+@@ -34,6 +34,8 @@
+ #include <setjmp.h>
+ #include <sched.h>
+ 
++#include "musl.h"
++
+ static unsigned int datasize = 100;
+ static unsigned int loops = 100;
+ static unsigned int num_groups = 10;
+--- /dev/null
++++ b/src/include/musl.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
++ * Time-stamp: <2020-04-04 10:54:01 kurt>
++ */
++
++#ifndef _MUSL_H_
++#define _MUSL_H_
++
++#include <unistd.h>
++#include <sys/syscall.h>
++
++/*
++ * Musl someshow defines sched_* to ENOSYS which is not correct ...
++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
++ *
++ * Workaround: define them to syscall(...)
++ */
++
++#define sched_getparam(pid, param)		\
++	syscall(SYS_sched_getparam, pid, param)
++#define sched_setparam(pid, param)		\
++	syscall(SYS_sched_setparam, pid, param)
++#define sched_getscheduler(pid)			\
++	syscall(SYS_sched_getscheduler, pid)
++#define sched_setscheduler(pid, policy, param)			\
++	syscall(SYS_sched_setscheduler, pid, policy, param)
++
++#endif /* _MUSL_H_ */
+--- a/src/lib/rt-utils.c
++++ b/src/lib/rt-utils.c
+@@ -24,6 +24,7 @@
+ #include <time.h>
+ #include <sys/time.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"
+--- a/src/pi_tests/tst-mutexpi10.c
++++ b/src/pi_tests/tst-mutexpi10.c
+@@ -35,6 +35,8 @@
+ #include <string.h>
+ #include <signal.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+--- a/src/pmqtest/pmqtest.c
++++ b/src/pmqtest/pmqtest.c
+@@ -24,6 +24,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/ptsematest/ptsematest.c
++++ b/src/ptsematest/ptsematest.c
+@@ -22,6 +22,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/rt-migrate-test/rt-migrate-test.c
++++ b/src/rt-migrate-test/rt-migrate-test.c
+@@ -27,6 +27,7 @@
+ 
+ #include <linux/unistd.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ 
+ int nr_tasks;
+--- a/src/sched_deadline/cyclicdeadline.c
++++ b/src/sched_deadline/cyclicdeadline.c
+@@ -30,6 +30,7 @@
+ #include <linux/unistd.h>
+ #include <linux/magic.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.5.ebuild b/dev-util/rt-tests/rt-tests-2.5.ebuild
new file mode 100644
index 000000000000..503b4965a276
--- /dev/null
+++ b/dev-util/rt-tests/rt-tests-2.5.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit python-single-r1 toolchain-funcs
+
+DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/"
+SRC_URI="
+	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
+	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
+
+LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	sys-process/numactl"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	default
+	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
+}
+
+src_install() {
+	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
+	python_fix_shebang "${ED}"
+	python_optimize
+}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2023-02-05  8:30 Joonas Niilola
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Niilola @ 2023-02-05  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     b1b9a9cc7cb95402d896b6ca51f7b6dc77eff592
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sun Jan 22 12:28:23 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Feb  5 08:30:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1b9a9cc

dev-util/rt-tests: drop 2.4

Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Closes: https://github.com/gentoo/gentoo/pull/29218
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-2.4-musl.patch | 341 ------------------------
 dev-util/rt-tests/rt-tests-2.4.ebuild           |  38 ---
 3 files changed, 380 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 67bb652596b0..53604d6b138e 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-2.4.tar.xz 104172 BLAKE2B bd7ac3ff64171b122341eec81ac61dcda429d33d6a69362d498d5db667b8cb77502d745bc2f7ce03cc1e958d02889a902f65544c7fef994fb4d7e72230c73e10 SHA512 308207ad620ee458e4ac000a9437266a84f4807d9cecd8030d5ae12a210c2a01f80a331bb60faeb41244d7ab80b3cadf8164711547a02f5afa353d1a3644d794
 DIST rt-tests-2.5.tar.xz 104596 BLAKE2B 3c03be9fb58ede744b6521cd74cef923f667c94ad8a3abb3d88efa7733f7672c8151b22e122499d1811f16ccd5a9335110eeb6c7c722c9899c369c912112f3b2 SHA512 a9966b6da89a9778f668faee5c347024a43bf978826bf16f0f8034acbf383eb688c6962e1de80e7efd34a5a0c67cb7c37ed5822979676b76a1e725d620bfd391

diff --git a/dev-util/rt-tests/files/rt-tests-2.4-musl.patch b/dev-util/rt-tests/files/rt-tests-2.4-musl.patch
deleted file mode 100644
index 886359894cdf..000000000000
--- a/dev-util/rt-tests/files/rt-tests-2.4-musl.patch
+++ /dev/null
@@ -1,341 +0,0 @@
-From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |    5 --
- src/backfire/sendme.c                 |    1 
- src/cyclictest/cyclictest.c           |   70 ++++------------------------------
- src/hackbench/hackbench.c             |    4 +
- src/include/musl.h                    |   28 +++++++++++++
- src/lib/rt-utils.c                    |    1 
- src/pi_tests/tst-mutexpi10.c          |    2 
- src/pmqtest/pmqtest.c                 |    1 
- src/ptsematest/ptsematest.c           |    1 
- src/rt-migrate-test/rt-migrate-test.c |    1 
- src/sched_deadline/cyclicdeadline.c   |    1 
- 11 files changed, 48 insertions(+), 67 deletions(-)
- create mode 100644 src/include/musl.h
-
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
- endif
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -29,6 +29,7 @@
- #include <string.h>
- #include <time.h>
- #include <errno.h>
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- 
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -33,6 +33,7 @@
- #include <sys/utsname.h>
- #include <sys/mman.h>
- #include <sys/syscall.h>
-+#include "musl.h"
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-@@ -546,12 +547,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop = { 0 };
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -580,14 +577,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -641,20 +630,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -662,16 +637,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -792,11 +761,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -821,17 +785,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1227,7 +1180,8 @@ static void process_options(int argc, ch
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1260,13 +1214,6 @@ static void process_options(int argc, ch
- 		}
- 	}
- 
--	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) {
- 		numa = numa_initialize();
-@@ -1993,7 +1940,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -2043,16 +1989,18 @@ int main(int argc, char **argv)
- 			void *stack;
- 			void *currstk;
- 			size_t stksize;
-+			int err;
- 
- 			/* find the memory node associated with the cpu i */
- 			node = rt_numa_numa_node_of_cpu(cpu);
- 
--			/* get the stack size set for this thread */
--			if (pthread_attr_getstack(&attr, &currstk, &stksize))
-+			/* get the stack size set for for this thread */
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -25,7 +25,7 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <limits.h>
-@@ -34,6 +34,8 @@
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -24,6 +24,7 @@
- #include <time.h>
- #include <sys/time.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -27,6 +27,7 @@
- 
- #include <linux/unistd.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- 
- int nr_tasks;
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -30,6 +30,7 @@
- #include <linux/unistd.h>
- #include <linux/magic.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.4.ebuild b/dev-util/rt-tests/rt-tests-2.4.ebuild
deleted file mode 100644
index 503b4965a276..000000000000
--- a/dev-util/rt-tests/rt-tests-2.4.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2023-12-27  7:54 Viorel Munteanu
  0 siblings, 0 replies; 14+ messages in thread
From: Viorel Munteanu @ 2023-12-27  7:54 UTC (permalink / raw
  To: gentoo-commits

commit:     df4f24e06d505a66df4f0292bdbe62c2637bcbe9
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sat Oct 14 07:44:36 2023 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Wed Dec 27 07:50:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df4f24e0

dev-util/rt-tests: add 2.6

Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 +
 dev-util/rt-tests/files/rt-tests-2.6-musl.patch | 342 ++++++++++++++++++++++++
 dev-util/rt-tests/rt-tests-2.6.ebuild           |  38 +++
 3 files changed, 381 insertions(+)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 53604d6b138e..ca23204c7a1d 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1 +1,2 @@
 DIST rt-tests-2.5.tar.xz 104596 BLAKE2B 3c03be9fb58ede744b6521cd74cef923f667c94ad8a3abb3d88efa7733f7672c8151b22e122499d1811f16ccd5a9335110eeb6c7c722c9899c369c912112f3b2 SHA512 a9966b6da89a9778f668faee5c347024a43bf978826bf16f0f8034acbf383eb688c6962e1de80e7efd34a5a0c67cb7c37ed5822979676b76a1e725d620bfd391
+DIST rt-tests-2.6.tar.xz 104996 BLAKE2B 40b898a0ecf512eafafa277857566cea358277f4fd6aca2595077409dbbb1c2eb4c7ed5ea1b61a378506eca4f989527d7c5fb94d9c3a16d7b0286cc940496cc8 SHA512 0cfb93ef8718b8e291a23963ef8e5bf1092b5f1c377f220d35005c0fdc7982ac074da824cb26ad5b2c71a2ebadd8bf753259c6f3ca9e00f42d9198e2dbc5999a

diff --git a/dev-util/rt-tests/files/rt-tests-2.6-musl.patch b/dev-util/rt-tests/files/rt-tests-2.6-musl.patch
new file mode 100644
index 000000000000..830f31184fe4
--- /dev/null
+++ b/dev-util/rt-tests/files/rt-tests-2.6-musl.patch
@@ -0,0 +1,342 @@
+From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <kurt@kmk-computers.de>
+Date: Wed, 1 Apr 2020 20:15:24 +0200
+Subject: [PATCH] all: Fix musl build
+
+There are a few problems:
+
+ * pi stress:  pthread_attr_setaffinity_np() is not supported
+ * cyclictest: SIGEV_THREAD_ID is not supported
+ * hackbench:  Fix include
+ * all:        Fix sched_* calls
+
+With these changes applied, the rt-tests seem to run fine.
+
+Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
+---
+ Makefile                              |    5 --
+ src/backfire/sendme.c                 |    1 
+ src/cyclictest/cyclictest.c           |   68 ++++------------------------------
+ src/hackbench/hackbench.c             |    4 +-
+ src/include/musl.h                    |   28 ++++++++++++++
+ src/lib/rt-utils.c                    |    1 
+ src/pi_tests/tst-mutexpi10.c          |    2 +
+ src/pmqtest/pmqtest.c                 |    1 
+ src/ptsematest/ptsematest.c           |    1 
+ src/rt-migrate-test/rt-migrate-test.c |    1 
+ src/sched_deadline/cyclicdeadline.c   |    1 
+ 11 files changed, 47 insertions(+), 66 deletions(-)
+ create mode 100644 src/include/musl.h
+
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,6 @@ OBJDIR = bld
+ sources = cyclictest.c \
+ 	  hackbench.c \
+ 	  pip_stress.c \
+-	  pi_stress.c \
+ 	  pmqtest.c \
+ 	  ptsematest.c \
+ 	  rt-migrate-test.c \
+@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
+ endif
+ 
+ MANPAGES = src/cyclictest/cyclictest.8 \
+-	   src/pi_tests/pi_stress.8 \
+ 	   src/ptsematest/ptsematest.8 \
+ 	   src/rt-migrate-test/rt-migrate-test.8 \
+ 	   src/sigwaittest/sigwaittest.8 \
+@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
+ signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
+ 
+-pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
+-
+ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
+ 	chmod +x src/hwlatdetect/hwlatdetect.py
+ 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
+--- a/src/backfire/sendme.c
++++ b/src/backfire/sendme.c
+@@ -29,6 +29,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <errno.h>
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ 
+--- a/src/cyclictest/cyclictest.c
++++ b/src/cyclictest/cyclictest.c
+@@ -30,6 +30,7 @@
+ #include <sys/utsname.h>
+ #include <sys/mman.h>
+ #include <sys/syscall.h>
++#include "musl.h"
+ #include "rt_numa.h"
+ 
+ #include "rt-utils.h"
+@@ -545,12 +546,8 @@ static void *timerthread(void *param)
+ {
+ 	struct thread_param *par = param;
+ 	struct sched_param schedp;
+-	struct sigevent sigev;
+ 	sigset_t sigset;
+-	timer_t timer;
+ 	struct timespec now, next, interval, stop = { 0 };
+-	struct itimerval itimer;
+-	struct itimerspec tspec;
+ 	struct thread_stat *stat = par->stats;
+ 	int stopped = 0;
+ 	cpu_set_t mask;
+@@ -579,14 +576,6 @@ static void *timerthread(void *param)
+ 	sigaddset(&sigset, par->signal);
+ 	sigprocmask(SIG_BLOCK, &sigset, NULL);
+ 
+-	if (par->mode == MODE_CYCLIC) {
+-		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
+-		sigev.sigev_signo = par->signal;
+-		sigev.sigev_notify_thread_id = stat->tid;
+-		timer_create(par->clock, &sigev, &timer);
+-		tspec.it_interval = interval;
+-	}
+-
+ 	memset(&schedp, 0, sizeof(schedp));
+ 	schedp.sched_priority = par->prio;
+ 	if (setscheduler(0, par->policy, &schedp))
+@@ -640,20 +629,6 @@ static void *timerthread(void *param)
+ 		stop = now;
+ 		stop.tv_sec += duration;
+ 	}
+-	if (par->mode == MODE_CYCLIC) {
+-		if (par->timermode == TIMER_ABSTIME)
+-			tspec.it_value = next;
+-		else
+-			tspec.it_value = interval;
+-		timer_settime(timer, par->timermode, &tspec, NULL);
+-	}
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_interval.tv_sec = interval.tv_sec;
+-		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+-		itimer.it_value = itimer.it_interval;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+ 
+ 	stat->threadstarted++;
+ 
+@@ -661,16 +636,10 @@ static void *timerthread(void *param)
+ 
+ 		uint64_t diff;
+ 		unsigned long diff_smi = 0;
+-		int sigs, ret;
++		int ret;
+ 
+ 		/* Wait for next period */
+ 		switch (par->mode) {
+-		case MODE_CYCLIC:
+-		case MODE_SYS_ITIMER:
+-			if (sigwait(&sigset, &sigs) < 0)
+-				goto out;
+-			break;
+-
+ 		case MODE_CLOCK_NANOSLEEP:
+ 			if (par->timermode == TIMER_ABSTIME) {
+ 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
+@@ -791,11 +760,6 @@ static void *timerthread(void *param)
+ 
+ 		next.tv_sec += interval.tv_sec;
+ 		next.tv_nsec += interval.tv_nsec;
+-		if (par->mode == MODE_CYCLIC) {
+-			int overrun_count = timer_getoverrun(timer);
+-			next.tv_sec += overrun_count * interval.tv_sec;
+-			next.tv_nsec += overrun_count * interval.tv_nsec;
+-		}
+ 		tsnorm(&next);
+ 
+ 		while (tsgreater(&now, &next)) {
+@@ -820,17 +784,6 @@ out:
+ 		pthread_mutex_unlock(&refresh_on_max_lock);
+ 	}
+ 
+-	if (par->mode == MODE_CYCLIC)
+-		timer_delete(timer);
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_value.tv_sec = 0;
+-		itimer.it_value.tv_usec = 0;
+-		itimer.it_interval.tv_sec = 0;
+-		itimer.it_interval.tv_usec = 0;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+-
+ 	/* close msr file */
+ 	if (smi)
+ 		close(par->msr_fd);
+@@ -1226,7 +1179,8 @@ static void process_options(int argc, ch
+ 		case OPT_VERBOSE: verbose = 1; break;
+ 		case 'x':
+ 		case OPT_POSIX_TIMERS:
+-			use_nanosleep = MODE_CYCLIC; break;
++			fatal("--posix_timers is not available on your libc\n");
++			break;
+ 		case '?':
+ 		case OPT_HELP:
+ 			display_help(0); break;
+@@ -1259,13 +1213,6 @@ static void process_options(int argc, ch
+ 		}
+ 	}
+ 
+-	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) {
+ 		numa = numa_initialize();
+@@ -1988,7 +1935,6 @@ int main(int argc, char **argv)
+ 
+ 	}
+ 
+-
+ 	mode = use_nanosleep + use_system;
+ 
+ 	sigemptyset(&sigset);
+@@ -2039,6 +1985,7 @@ int main(int argc, char **argv)
+ 			void *currstk;
+ 			size_t stksize;
+ 			int node_cpu = cpu;
++			int err;
+ 
+ 			if (node_cpu == -1)
+ 				node_cpu = cpu_for_thread_ua(i, max_cpus);
+@@ -2047,11 +1994,12 @@ int main(int argc, char **argv)
+ 			node = rt_numa_numa_node_of_cpu(node_cpu);
+ 
+ 			/* get the stack size set for this thread */
+-			if (pthread_attr_getstack(&attr, &currstk, &stksize))
++			err = pthread_attr_getstack(&attr, &currstk, &stksize);
++			if (err != EINVAL)
+ 				fatal("failed to get stack size for thread %d\n", i);
+ 
+ 			/* if the stack size is zero, set a default */
+-			if (stksize == 0)
++			if (err == EINVAL || stksize == 0)
+ 				stksize = PTHREAD_STACK_MIN * 2;
+ 
+ 			/*  allocate memory for a stack on appropriate node */
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -25,7 +25,7 @@
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+ #include <sys/time.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <limits.h>
+@@ -34,6 +34,8 @@
+ #include <setjmp.h>
+ #include <sched.h>
+ 
++#include "musl.h"
++
+ static unsigned int datasize = 100;
+ static unsigned int loops = 100;
+ static unsigned int num_groups = 10;
+--- /dev/null
++++ b/src/include/musl.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
++ * Time-stamp: <2020-04-04 10:54:01 kurt>
++ */
++
++#ifndef _MUSL_H_
++#define _MUSL_H_
++
++#include <unistd.h>
++#include <sys/syscall.h>
++
++/*
++ * Musl someshow defines sched_* to ENOSYS which is not correct ...
++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
++ *
++ * Workaround: define them to syscall(...)
++ */
++
++#define sched_getparam(pid, param)		\
++	syscall(SYS_sched_getparam, pid, param)
++#define sched_setparam(pid, param)		\
++	syscall(SYS_sched_setparam, pid, param)
++#define sched_getscheduler(pid)			\
++	syscall(SYS_sched_getscheduler, pid)
++#define sched_setscheduler(pid, policy, param)			\
++	syscall(SYS_sched_setscheduler, pid, policy, param)
++
++#endif /* _MUSL_H_ */
+--- a/src/lib/rt-utils.c
++++ b/src/lib/rt-utils.c
+@@ -24,6 +24,7 @@
+ #include <time.h>
+ #include <sys/time.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"
+--- a/src/pi_tests/tst-mutexpi10.c
++++ b/src/pi_tests/tst-mutexpi10.c
+@@ -35,6 +35,8 @@
+ #include <string.h>
+ #include <signal.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+--- a/src/pmqtest/pmqtest.c
++++ b/src/pmqtest/pmqtest.c
+@@ -24,6 +24,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/ptsematest/ptsematest.c
++++ b/src/ptsematest/ptsematest.c
+@@ -22,6 +22,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/rt-migrate-test/rt-migrate-test.c
++++ b/src/rt-migrate-test/rt-migrate-test.c
+@@ -27,6 +27,7 @@
+ 
+ #include <linux/unistd.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ 
+ int nr_tasks;
+--- a/src/sched_deadline/cyclicdeadline.c
++++ b/src/sched_deadline/cyclicdeadline.c
+@@ -30,6 +30,7 @@
+ #include <linux/unistd.h>
+ #include <linux/magic.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.6.ebuild b/dev-util/rt-tests/rt-tests-2.6.ebuild
new file mode 100644
index 000000000000..503b4965a276
--- /dev/null
+++ b/dev-util/rt-tests/rt-tests-2.6.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit python-single-r1 toolchain-funcs
+
+DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/"
+SRC_URI="
+	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
+	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
+
+LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	sys-process/numactl"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	default
+	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
+}
+
+src_install() {
+	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
+	python_fix_shebang "${ED}"
+	python_optimize
+}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2023-12-27  7:54 Viorel Munteanu
  0 siblings, 0 replies; 14+ messages in thread
From: Viorel Munteanu @ 2023-12-27  7:54 UTC (permalink / raw
  To: gentoo-commits

commit:     be7efdf591a471a0b53ad7714ca56f0dd3aead96
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Sat Oct 14 07:44:52 2023 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Wed Dec 27 07:50:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be7efdf5

dev-util/rt-tests: drop 2.5

Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 -
 dev-util/rt-tests/files/rt-tests-2.5-musl.patch | 342 ------------------------
 dev-util/rt-tests/rt-tests-2.5.ebuild           |  38 ---
 3 files changed, 381 deletions(-)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index ca23204c7a1d..8525d3d1e94e 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1,2 +1 @@
-DIST rt-tests-2.5.tar.xz 104596 BLAKE2B 3c03be9fb58ede744b6521cd74cef923f667c94ad8a3abb3d88efa7733f7672c8151b22e122499d1811f16ccd5a9335110eeb6c7c722c9899c369c912112f3b2 SHA512 a9966b6da89a9778f668faee5c347024a43bf978826bf16f0f8034acbf383eb688c6962e1de80e7efd34a5a0c67cb7c37ed5822979676b76a1e725d620bfd391
 DIST rt-tests-2.6.tar.xz 104996 BLAKE2B 40b898a0ecf512eafafa277857566cea358277f4fd6aca2595077409dbbb1c2eb4c7ed5ea1b61a378506eca4f989527d7c5fb94d9c3a16d7b0286cc940496cc8 SHA512 0cfb93ef8718b8e291a23963ef8e5bf1092b5f1c377f220d35005c0fdc7982ac074da824cb26ad5b2c71a2ebadd8bf753259c6f3ca9e00f42d9198e2dbc5999a

diff --git a/dev-util/rt-tests/files/rt-tests-2.5-musl.patch b/dev-util/rt-tests/files/rt-tests-2.5-musl.patch
deleted file mode 100644
index a7aca4392ebb..000000000000
--- a/dev-util/rt-tests/files/rt-tests-2.5-musl.patch
+++ /dev/null
@@ -1,342 +0,0 @@
-From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
-From: Kurt Kanzenbach <kurt@kmk-computers.de>
-Date: Wed, 1 Apr 2020 20:15:24 +0200
-Subject: [PATCH] all: Fix musl build
-
-There are a few problems:
-
- * pi stress:  pthread_attr_setaffinity_np() is not supported
- * cyclictest: SIGEV_THREAD_ID is not supported
- * hackbench:  Fix include
- * all:        Fix sched_* calls
-
-With these changes applied, the rt-tests seem to run fine.
-
-Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
----
- Makefile                              |    5 --
- src/backfire/sendme.c                 |    1 
- src/cyclictest/cyclictest.c           |   68 ++++------------------------------
- src/hackbench/hackbench.c             |    4 +-
- src/include/musl.h                    |   28 ++++++++++++++
- src/lib/rt-utils.c                    |    1 
- src/pi_tests/tst-mutexpi10.c          |    2 +
- src/pmqtest/pmqtest.c                 |    1 
- src/ptsematest/ptsematest.c           |    1 
- src/rt-migrate-test/rt-migrate-test.c |    1 
- src/sched_deadline/cyclicdeadline.c   |    1 
- 11 files changed, 47 insertions(+), 66 deletions(-)
- create mode 100644 src/include/musl.h
-
---- a/Makefile
-+++ b/Makefile
-@@ -7,7 +7,6 @@ OBJDIR = bld
- sources = cyclictest.c \
- 	  hackbench.c \
- 	  pip_stress.c \
--	  pi_stress.c \
- 	  pmqtest.c \
- 	  ptsematest.c \
- 	  rt-migrate-test.c \
-@@ -42,7 +41,6 @@ ifeq (${PYLIB},)
- endif
- 
- MANPAGES = src/cyclictest/cyclictest.8 \
--	   src/pi_tests/pi_stress.8 \
- 	   src/ptsematest/ptsematest.8 \
- 	   src/rt-migrate-test/rt-migrate-test.8 \
- 	   src/sigwaittest/sigwaittest.8 \
-@@ -130,9 +128,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
- signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
- 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
- 
--pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
--	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
--
- hwlatdetect:  src/hwlatdetect/hwlatdetect.py
- 	chmod +x src/hwlatdetect/hwlatdetect.py
- 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
---- a/src/backfire/sendme.c
-+++ b/src/backfire/sendme.c
-@@ -29,6 +29,7 @@
- #include <string.h>
- #include <time.h>
- #include <errno.h>
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- 
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -33,6 +33,7 @@
- #include <sys/utsname.h>
- #include <sys/mman.h>
- #include <sys/syscall.h>
-+#include "musl.h"
- #include "rt_numa.h"
- 
- #include "rt-utils.h"
-@@ -546,12 +547,8 @@ static void *timerthread(void *param)
- {
- 	struct thread_param *par = param;
- 	struct sched_param schedp;
--	struct sigevent sigev;
- 	sigset_t sigset;
--	timer_t timer;
- 	struct timespec now, next, interval, stop = { 0 };
--	struct itimerval itimer;
--	struct itimerspec tspec;
- 	struct thread_stat *stat = par->stats;
- 	int stopped = 0;
- 	cpu_set_t mask;
-@@ -580,14 +577,6 @@ static void *timerthread(void *param)
- 	sigaddset(&sigset, par->signal);
- 	sigprocmask(SIG_BLOCK, &sigset, NULL);
- 
--	if (par->mode == MODE_CYCLIC) {
--		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
--		sigev.sigev_signo = par->signal;
--		sigev.sigev_notify_thread_id = stat->tid;
--		timer_create(par->clock, &sigev, &timer);
--		tspec.it_interval = interval;
--	}
--
- 	memset(&schedp, 0, sizeof(schedp));
- 	schedp.sched_priority = par->prio;
- 	if (setscheduler(0, par->policy, &schedp))
-@@ -641,20 +630,6 @@ static void *timerthread(void *param)
- 		stop = now;
- 		stop.tv_sec += duration;
- 	}
--	if (par->mode == MODE_CYCLIC) {
--		if (par->timermode == TIMER_ABSTIME)
--			tspec.it_value = next;
--		else
--			tspec.it_value = interval;
--		timer_settime(timer, par->timermode, &tspec, NULL);
--	}
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_interval.tv_sec = interval.tv_sec;
--		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
--		itimer.it_value = itimer.it_interval;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
- 
- 	stat->threadstarted++;
- 
-@@ -662,16 +637,10 @@ static void *timerthread(void *param)
- 
- 		uint64_t diff;
- 		unsigned long diff_smi = 0;
--		int sigs, ret;
-+		int ret;
- 
- 		/* Wait for next period */
- 		switch (par->mode) {
--		case MODE_CYCLIC:
--		case MODE_SYS_ITIMER:
--			if (sigwait(&sigset, &sigs) < 0)
--				goto out;
--			break;
--
- 		case MODE_CLOCK_NANOSLEEP:
- 			if (par->timermode == TIMER_ABSTIME) {
- 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
-@@ -792,11 +761,6 @@ static void *timerthread(void *param)
- 
- 		next.tv_sec += interval.tv_sec;
- 		next.tv_nsec += interval.tv_nsec;
--		if (par->mode == MODE_CYCLIC) {
--			int overrun_count = timer_getoverrun(timer);
--			next.tv_sec += overrun_count * interval.tv_sec;
--			next.tv_nsec += overrun_count * interval.tv_nsec;
--		}
- 		tsnorm(&next);
- 
- 		while (tsgreater(&now, &next)) {
-@@ -821,17 +785,6 @@ out:
- 		pthread_mutex_unlock(&refresh_on_max_lock);
- 	}
- 
--	if (par->mode == MODE_CYCLIC)
--		timer_delete(timer);
--
--	if (par->mode == MODE_SYS_ITIMER) {
--		itimer.it_value.tv_sec = 0;
--		itimer.it_value.tv_usec = 0;
--		itimer.it_interval.tv_sec = 0;
--		itimer.it_interval.tv_usec = 0;
--		setitimer(ITIMER_REAL, &itimer, NULL);
--	}
--
- 	/* close msr file */
- 	if (smi)
- 		close(par->msr_fd);
-@@ -1227,7 +1180,8 @@ static void process_options(int argc, ch
- 		case OPT_VERBOSE: verbose = 1; break;
- 		case 'x':
- 		case OPT_POSIX_TIMERS:
--			use_nanosleep = MODE_CYCLIC; break;
-+			fatal("--posix_timers is not available on your libc\n");
-+			break;
- 		case '?':
- 		case OPT_HELP:
- 			display_help(0); break;
-@@ -1260,13 +1214,6 @@ static void process_options(int argc, ch
- 		}
- 	}
- 
--	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) {
- 		numa = numa_initialize();
-@@ -1991,7 +1938,6 @@ int main(int argc, char **argv)
- 
- 	}
- 
--
- 	mode = use_nanosleep + use_system;
- 
- 	sigemptyset(&sigset);
-@@ -2042,6 +1988,7 @@ int main(int argc, char **argv)
- 			void *currstk;
- 			size_t stksize;
- 			int node_cpu = cpu;
-+			int err;
- 
- 			if (node_cpu == -1)
- 				node_cpu = cpu_for_thread_ua(i, max_cpus);
-@@ -2050,11 +1997,12 @@ int main(int argc, char **argv)
- 			node = rt_numa_numa_node_of_cpu(node_cpu);
- 
- 			/* get the stack size set for this thread */
--			if (pthread_attr_getstack(&attr, &currstk, &stksize))
-+			err = pthread_attr_getstack(&attr, &currstk, &stksize);
-+			if (err != EINVAL)
- 				fatal("failed to get stack size for thread %d\n", i);
- 
- 			/* if the stack size is zero, set a default */
--			if (stksize == 0)
-+			if (err == EINVAL || stksize == 0)
- 				stksize = PTHREAD_STACK_MIN * 2;
- 
- 			/*  allocate memory for a stack on appropriate node */
---- a/src/hackbench/hackbench.c
-+++ b/src/hackbench/hackbench.c
-@@ -25,7 +25,7 @@
- #include <sys/socket.h>
- #include <sys/wait.h>
- #include <sys/time.h>
--#include <sys/poll.h>
-+#include <poll.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <limits.h>
-@@ -34,6 +34,8 @@
- #include <setjmp.h>
- #include <sched.h>
- 
-+#include "musl.h"
-+
- static unsigned int datasize = 100;
- static unsigned int loops = 100;
- static unsigned int num_groups = 10;
---- /dev/null
-+++ b/src/include/musl.h
-@@ -0,0 +1,28 @@
-+/*
-+ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
-+ * Time-stamp: <2020-04-04 10:54:01 kurt>
-+ */
-+
-+#ifndef _MUSL_H_
-+#define _MUSL_H_
-+
-+#include <unistd.h>
-+#include <sys/syscall.h>
-+
-+/*
-+ * Musl someshow defines sched_* to ENOSYS which is not correct ...
-+ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
-+ *
-+ * Workaround: define them to syscall(...)
-+ */
-+
-+#define sched_getparam(pid, param)		\
-+	syscall(SYS_sched_getparam, pid, param)
-+#define sched_setparam(pid, param)		\
-+	syscall(SYS_sched_setparam, pid, param)
-+#define sched_getscheduler(pid)			\
-+	syscall(SYS_sched_getscheduler, pid)
-+#define sched_setscheduler(pid, policy, param)			\
-+	syscall(SYS_sched_setscheduler, pid, policy, param)
-+
-+#endif /* _MUSL_H_ */
---- a/src/lib/rt-utils.c
-+++ b/src/lib/rt-utils.c
-@@ -24,6 +24,7 @@
- #include <time.h>
- #include <sys/time.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"
---- a/src/pi_tests/tst-mutexpi10.c
-+++ b/src/pi_tests/tst-mutexpi10.c
-@@ -35,6 +35,8 @@
- #include <string.h>
- #include <signal.h>
- 
-+#include "musl.h"
-+
- /* test timeout */
- #define TIMEOUT 2
- 
---- a/src/pmqtest/pmqtest.c
-+++ b/src/pmqtest/pmqtest.c
-@@ -24,6 +24,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/ptsematest/ptsematest.c
-+++ b/src/ptsematest/ptsematest.c
-@@ -22,6 +22,7 @@
- #include <pthread.h>
- #include <inttypes.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-get_cpu.h"
- #include "rt-error.h"
---- a/src/rt-migrate-test/rt-migrate-test.c
-+++ b/src/rt-migrate-test/rt-migrate-test.c
-@@ -27,6 +27,7 @@
- 
- #include <linux/unistd.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- 
- int nr_tasks;
---- a/src/sched_deadline/cyclicdeadline.c
-+++ b/src/sched_deadline/cyclicdeadline.c
-@@ -30,6 +30,7 @@
- #include <linux/unistd.h>
- #include <linux/magic.h>
- 
-+#include "musl.h"
- #include "rt-utils.h"
- #include "rt-sched.h"
- #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.5.ebuild b/dev-util/rt-tests/rt-tests-2.5.ebuild
deleted file mode 100644
index 503b4965a276..000000000000
--- a/dev-util/rt-tests/rt-tests-2.5.ebuild
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{9..11} )
-
-inherit python-single-r1 toolchain-funcs
-
-DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
-HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/"
-SRC_URI="
-	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
-	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
-
-LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
-SLOT="0"
-KEYWORDS="~amd64 ~arm64 ~x86"
-REQUIRED_USE="${PYTHON_REQUIRED_USE}"
-
-DEPEND="${PYTHON_DEPS}
-	sys-process/numactl"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	default
-	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
-}
-
-src_compile() {
-	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
-}
-
-src_install() {
-	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
-	python_fix_shebang "${ED}"
-	python_optimize
-}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/
@ 2024-05-23  9:17 Florian Schmaus
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Schmaus @ 2024-05-23  9:17 UTC (permalink / raw
  To: gentoo-commits

commit:     88ed0481e19312378e10b3902488c53193c6f2b9
Author:     Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
AuthorDate: Thu May  9 08:58:54 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu May 23 09:15:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88ed0481

dev-util/rt-tests: add 2.7

Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 dev-util/rt-tests/Manifest                      |   1 +
 dev-util/rt-tests/files/rt-tests-2.7-musl.patch | 342 ++++++++++++++++++++++++
 dev-util/rt-tests/rt-tests-2.7.ebuild           |  38 +++
 3 files changed, 381 insertions(+)

diff --git a/dev-util/rt-tests/Manifest b/dev-util/rt-tests/Manifest
index 8525d3d1e94e..3e1e017cf313 100644
--- a/dev-util/rt-tests/Manifest
+++ b/dev-util/rt-tests/Manifest
@@ -1 +1,2 @@
 DIST rt-tests-2.6.tar.xz 104996 BLAKE2B 40b898a0ecf512eafafa277857566cea358277f4fd6aca2595077409dbbb1c2eb4c7ed5ea1b61a378506eca4f989527d7c5fb94d9c3a16d7b0286cc940496cc8 SHA512 0cfb93ef8718b8e291a23963ef8e5bf1092b5f1c377f220d35005c0fdc7982ac074da824cb26ad5b2c71a2ebadd8bf753259c6f3ca9e00f42d9198e2dbc5999a
+DIST rt-tests-2.7.tar.xz 106864 BLAKE2B 89af0a92465ca29eb19adb6bb521be377dedb4153fc98bdcce48e1bad71803ed4aad2088227cfc679ce2441d09932acae437911535daec266b7ac2247fbad8d8 SHA512 6f2e523a6ff683473a222dc3b38abd34a06610c78b488d9d103643e410089d03820c76a4f40afaa4694d29f36e1aef6ced584cae9bad72921e3d633e36a5cda3

diff --git a/dev-util/rt-tests/files/rt-tests-2.7-musl.patch b/dev-util/rt-tests/files/rt-tests-2.7-musl.patch
new file mode 100644
index 000000000000..3edf92b7eb17
--- /dev/null
+++ b/dev-util/rt-tests/files/rt-tests-2.7-musl.patch
@@ -0,0 +1,342 @@
+From 0b7a1e0d3463aa8aa4b7dcad0ec154e658d68036 Mon Sep 17 00:00:00 2001
+From: Kurt Kanzenbach <kurt@kmk-computers.de>
+Date: Wed, 1 Apr 2020 20:15:24 +0200
+Subject: [PATCH] all: Fix musl build
+
+There are a few problems:
+
+ * pi stress:  pthread_attr_setaffinity_np() is not supported
+ * cyclictest: SIGEV_THREAD_ID is not supported
+ * hackbench:  Fix include
+ * all:        Fix sched_* calls
+
+With these changes applied, the rt-tests seem to run fine.
+
+Signed-off-by: Kurt Kanzenbach <kurt@kmk-computers.de>
+---
+ Makefile                              |    5 --
+ src/backfire/sendme.c                 |    1 
+ src/cyclictest/cyclictest.c           |   68 ++++------------------------------
+ src/hackbench/hackbench.c             |    4 +-
+ src/include/musl.h                    |   28 ++++++++++++++
+ src/lib/rt-utils.c                    |    1 
+ src/pi_tests/tst-mutexpi10.c          |    2 +
+ src/pmqtest/pmqtest.c                 |    1 
+ src/ptsematest/ptsematest.c           |    1 
+ src/rt-migrate-test/rt-migrate-test.c |    1 
+ src/sched_deadline/cyclicdeadline.c   |    1 
+ 11 files changed, 47 insertions(+), 66 deletions(-)
+ create mode 100644 src/include/musl.h
+
+--- a/Makefile
++++ b/Makefile
+@@ -8,7 +8,6 @@ OBJDIR = bld
+ sources = cyclictest.c \
+ 	  hackbench.c \
+ 	  pip_stress.c \
+-	  pi_stress.c \
+ 	  pmqtest.c \
+ 	  ptsematest.c \
+ 	  rt-migrate-test.c \
+@@ -43,7 +42,6 @@ ifeq (${PYLIB},)
+ endif
+ 
+ MANPAGES = src/cyclictest/cyclictest.8 \
+-	   src/pi_tests/pi_stress.8 \
+ 	   src/ptsematest/ptsematest.8 \
+ 	   src/rt-migrate-test/rt-migrate-test.8 \
+ 	   src/sigwaittest/sigwaittest.8 \
+@@ -131,9 +129,6 @@ deadline_test: $(OBJDIR)/deadline_test.o
+ signaltest: $(OBJDIR)/signaltest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
+ 
+-pi_stress: $(OBJDIR)/pi_stress.o $(OBJDIR)/librttest.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
+-
+ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
+ 	chmod +x src/hwlatdetect/hwlatdetect.py
+ 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
+--- a/src/backfire/sendme.c
++++ b/src/backfire/sendme.c
+@@ -16,6 +16,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <errno.h>
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ 
+--- a/src/cyclictest/cyclictest.c
++++ b/src/cyclictest/cyclictest.c
+@@ -30,6 +30,7 @@
+ #include <sys/utsname.h>
+ #include <sys/mman.h>
+ #include <sys/syscall.h>
++#include "musl.h"
+ #include "rt_numa.h"
+ 
+ #include "rt-utils.h"
+@@ -469,12 +470,8 @@ static void *timerthread(void *param)
+ {
+ 	struct thread_param *par = param;
+ 	struct sched_param schedp;
+-	struct sigevent sigev;
+ 	sigset_t sigset;
+-	timer_t timer;
+ 	struct timespec now, next, interval, stop = { 0 };
+-	struct itimerval itimer;
+-	struct itimerspec tspec;
+ 	struct thread_stat *stat = par->stats;
+ 	int stopped = 0;
+ 	cpu_set_t mask;
+@@ -503,14 +500,6 @@ static void *timerthread(void *param)
+ 	sigaddset(&sigset, par->signal);
+ 	sigprocmask(SIG_BLOCK, &sigset, NULL);
+ 
+-	if (par->mode == MODE_CYCLIC) {
+-		sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL;
+-		sigev.sigev_signo = par->signal;
+-		sigev.sigev_notify_thread_id = stat->tid;
+-		timer_create(par->clock, &sigev, &timer);
+-		tspec.it_interval = interval;
+-	}
+-
+ 	memset(&schedp, 0, sizeof(schedp));
+ 	schedp.sched_priority = par->prio;
+ 	if (setscheduler(0, par->policy, &schedp))
+@@ -564,20 +553,6 @@ static void *timerthread(void *param)
+ 		stop = now;
+ 		stop.tv_sec += duration;
+ 	}
+-	if (par->mode == MODE_CYCLIC) {
+-		if (par->timermode == TIMER_ABSTIME)
+-			tspec.it_value = next;
+-		else
+-			tspec.it_value = interval;
+-		timer_settime(timer, par->timermode, &tspec, NULL);
+-	}
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_interval.tv_sec = interval.tv_sec;
+-		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+-		itimer.it_value = itimer.it_interval;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+ 
+ 	stat->threadstarted++;
+ 
+@@ -585,16 +560,10 @@ static void *timerthread(void *param)
+ 
+ 		uint64_t diff;
+ 		unsigned long diff_smi = 0;
+-		int sigs, ret;
++		int ret;
+ 
+ 		/* Wait for next period */
+ 		switch (par->mode) {
+-		case MODE_CYCLIC:
+-		case MODE_SYS_ITIMER:
+-			if (sigwait(&sigset, &sigs) < 0)
+-				goto out;
+-			break;
+-
+ 		case MODE_CLOCK_NANOSLEEP:
+ 			if (par->timermode == TIMER_ABSTIME) {
+ 				ret = clock_nanosleep(par->clock, TIMER_ABSTIME,
+@@ -708,11 +677,6 @@ static void *timerthread(void *param)
+ 
+ 		next.tv_sec += interval.tv_sec;
+ 		next.tv_nsec += interval.tv_nsec;
+-		if (par->mode == MODE_CYCLIC) {
+-			int overrun_count = timer_getoverrun(timer);
+-			next.tv_sec += overrun_count * interval.tv_sec;
+-			next.tv_nsec += overrun_count * interval.tv_nsec;
+-		}
+ 		tsnorm(&next);
+ 
+ 		while (tsgreater(&now, &next)) {
+@@ -737,17 +701,6 @@ out:
+ 		pthread_mutex_unlock(&refresh_on_max_lock);
+ 	}
+ 
+-	if (par->mode == MODE_CYCLIC)
+-		timer_delete(timer);
+-
+-	if (par->mode == MODE_SYS_ITIMER) {
+-		itimer.it_value.tv_sec = 0;
+-		itimer.it_value.tv_usec = 0;
+-		itimer.it_interval.tv_sec = 0;
+-		itimer.it_interval.tv_usec = 0;
+-		setitimer(ITIMER_REAL, &itimer, NULL);
+-	}
+-
+ 	/* close msr file */
+ 	if (smi)
+ 		close(par->msr_fd);
+@@ -1143,7 +1096,8 @@ static void process_options(int argc, ch
+ 		case OPT_VERBOSE: verbose = 1; break;
+ 		case 'x':
+ 		case OPT_POSIX_TIMERS:
+-			use_nanosleep = MODE_CYCLIC; break;
++			fatal("--posix_timers is not available on your libc\n");
++			break;
+ 		case '?':
+ 		case OPT_HELP:
+ 			display_help(0); break;
+@@ -1176,13 +1130,6 @@ static void process_options(int argc, ch
+ 		}
+ 	}
+ 
+-	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) {
+ 		numa = numa_initialize();
+@@ -1876,7 +1823,6 @@ int main(int argc, char **argv)
+ 
+ 	}
+ 
+-
+ 	mode = use_nanosleep + use_system;
+ 
+ 	sigemptyset(&sigset);
+@@ -1931,6 +1877,7 @@ int main(int argc, char **argv)
+ 			void *currstk;
+ 			size_t stksize;
+ 			int node_cpu = cpu;
++			int err;
+ 
+ 			if (node_cpu == -1)
+ 				node_cpu = cpu_for_thread_ua(i, max_cpus);
+@@ -1939,11 +1886,12 @@ int main(int argc, char **argv)
+ 			node = rt_numa_numa_node_of_cpu(node_cpu);
+ 
+ 			/* get the stack size set for this thread */
+-			if (pthread_attr_getstack(&attr, &currstk, &stksize))
++			err = pthread_attr_getstack(&attr, &currstk, &stksize);
++			if (err != EINVAL)
+ 				fatal("failed to get stack size for thread %d\n", i);
+ 
+ 			/* if the stack size is zero, set a default */
+-			if (stksize == 0)
++			if (err == EINVAL || stksize == 0)
+ 				stksize = PTHREAD_STACK_MIN * 2;
+ 
+ 			/*  allocate memory for a stack on appropriate node */
+--- a/src/hackbench/hackbench.c
++++ b/src/hackbench/hackbench.c
+@@ -25,7 +25,7 @@
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+ #include <sys/time.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <limits.h>
+@@ -34,6 +34,8 @@
+ #include <setjmp.h>
+ #include <sched.h>
+ 
++#include "musl.h"
++
+ static unsigned int datasize = 100;
+ static unsigned int loops = 100;
+ static unsigned int num_groups = 10;
+--- /dev/null
++++ b/src/include/musl.h
+@@ -0,0 +1,28 @@
++/*
++ * Copyright (C) 2020 Kurt Kanzenbach <kurt@kmk-computers.de>
++ * Time-stamp: <2020-04-04 10:54:01 kurt>
++ */
++
++#ifndef _MUSL_H_
++#define _MUSL_H_
++
++#include <unistd.h>
++#include <sys/syscall.h>
++
++/*
++ * Musl someshow defines sched_* to ENOSYS which is not correct ...
++ * See commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)")
++ *
++ * Workaround: define them to syscall(...)
++ */
++
++#define sched_getparam(pid, param)		\
++	syscall(SYS_sched_getparam, pid, param)
++#define sched_setparam(pid, param)		\
++	syscall(SYS_sched_setparam, pid, param)
++#define sched_getscheduler(pid)			\
++	syscall(SYS_sched_getscheduler, pid)
++#define sched_setscheduler(pid, policy, param)			\
++	syscall(SYS_sched_setscheduler, pid, policy, param)
++
++#endif /* _MUSL_H_ */
+--- a/src/lib/rt-utils.c
++++ b/src/lib/rt-utils.c
+@@ -24,6 +24,7 @@
+ #include <time.h>
+ #include <sys/time.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"
+--- a/src/pi_tests/tst-mutexpi10.c
++++ b/src/pi_tests/tst-mutexpi10.c
+@@ -35,6 +35,8 @@
+ #include <string.h>
+ #include <signal.h>
+ 
++#include "musl.h"
++
+ /* test timeout */
+ #define TIMEOUT 2
+ 
+--- a/src/pmqtest/pmqtest.c
++++ b/src/pmqtest/pmqtest.c
+@@ -24,6 +24,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/ptsematest/ptsematest.c
++++ b/src/ptsematest/ptsematest.c
+@@ -22,6 +22,7 @@
+ #include <pthread.h>
+ #include <inttypes.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-get_cpu.h"
+ #include "rt-error.h"
+--- a/src/rt-migrate-test/rt-migrate-test.c
++++ b/src/rt-migrate-test/rt-migrate-test.c
+@@ -27,6 +27,7 @@
+ 
+ #include <linux/unistd.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ 
+ int nr_tasks;
+--- a/src/sched_deadline/cyclicdeadline.c
++++ b/src/sched_deadline/cyclicdeadline.c
+@@ -30,6 +30,7 @@
+ #include <linux/unistd.h>
+ #include <linux/magic.h>
+ 
++#include "musl.h"
+ #include "rt-utils.h"
+ #include "rt-sched.h"
+ #include "rt-error.h"

diff --git a/dev-util/rt-tests/rt-tests-2.7.ebuild b/dev-util/rt-tests/rt-tests-2.7.ebuild
new file mode 100644
index 000000000000..02ec76298866
--- /dev/null
+++ b/dev-util/rt-tests/rt-tests-2.7.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit python-single-r1 toolchain-funcs
+
+DESCRIPTION="A collection of latency testing tools for the linux(-rt) kernel"
+HOMEPAGE="https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/"
+SRC_URI="
+	https://kernel.org/pub/linux/utils/rt-tests/${P}.tar.xz
+	https://kernel.org/pub/linux/utils/rt-tests/older/${P}.tar.xz"
+
+LICENSE="GPL-2 GPL-2+ LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	sys-process/numactl"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	default
+	use elibc_musl && eapply "${FILESDIR}/${P}-musl.patch"
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" AR="$(tc-getAR)"
+}
+
+src_install() {
+	emake CC="$(tc-getCC)" prefix=/usr DESTDIR="${ED}" install
+	python_fix_shebang "${ED}"
+	python_optimize
+}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-23  9:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-04  6:26 [gentoo-commits] repo/gentoo:master commit in: dev-util/rt-tests/files/, dev-util/rt-tests/ Joonas Niilola
  -- strict thread matches above, loose matches on Subject: below --
2024-05-23  9:17 Florian Schmaus
2023-12-27  7:54 Viorel Munteanu
2023-12-27  7:54 Viorel Munteanu
2023-02-05  8:30 Joonas Niilola
2023-02-05  8:30 Joonas Niilola
2022-07-15  8:38 Joonas Niilola
2022-01-05 19:19 Florian Schmaus
2021-07-14 14:32 Joonas Niilola
2020-12-27  3:37 Sam James
2020-10-07  3:44 Sam James
2020-04-05  7:18 Joonas Niilola
2020-03-03 14:54 Joonas Niilola
2020-01-23  9:53 Joonas Niilola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox