Compare commits
No commits in common. "rawhide" and "f35" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,4 @@
|
||||
*.swp
|
||||
/rt-tests-1.9.tar.xz
|
||||
/rt-tests-2.2.tar.xz
|
||||
/rt-tests-2.3.tar.xz
|
||||
/rt-tests-2.4.tar.xz
|
||||
/rt-tests-2.5.tar.xz
|
||||
|
116
cyclictest-Fix-threads-being-affined-even-when-a-not-set.patch
Normal file
116
cyclictest-Fix-threads-being-affined-even-when-a-not-set.patch
Normal file
@ -0,0 +1,116 @@
|
||||
From 2d910eecf10cd806e22abeb1d96189f87ef74d91 Mon Sep 17 00:00:00 2001
|
||||
From: John Stultz <jstultz@google.com>
|
||||
Date: Thu, 28 Jul 2022 20:22:36 +0000
|
||||
Subject: [PATCH] cyclictest: Fix threads being affined even when -a isn't set
|
||||
|
||||
Using cyclictest without specifying affinity via -a, I was
|
||||
noticing a strange issue where the rt threads where not
|
||||
migrating when being blocked.
|
||||
|
||||
After lots of debugging in the kernel, I found its actually an
|
||||
issue with cyclictest.
|
||||
|
||||
When using -t there is no behavioral difference between specifying
|
||||
-a or not specifying -a.
|
||||
|
||||
This can be confirmed by adding printf messages around the
|
||||
pthread_setaffinity_np() call in the threadtest function.
|
||||
|
||||
Currently:
|
||||
|
||||
root@localhost:~/rt-tests# ./cyclictest -t -a -q -D1
|
||||
Affining thread 0 to cpu: 0
|
||||
Affining thread 1 to cpu: 1
|
||||
Affining thread 2 to cpu: 2
|
||||
Affining thread 3 to cpu: 3
|
||||
Affining thread 4 to cpu: 4
|
||||
Affining thread 5 to cpu: 5
|
||||
Affining thread 7 to cpu: 7
|
||||
Affining thread 6 to cpu: 6
|
||||
T: 0 (15034) P: 0 I:1000 C: 1000 Min: 82 Act: 184 Avg: 180 Max: 705
|
||||
...
|
||||
|
||||
root@localhost:~/rt-tests# ./cyclictest -t -q -D1
|
||||
Affining thread 0 to cpu: 0
|
||||
Affining thread 1 to cpu: 1
|
||||
Affining thread 2 to cpu: 2
|
||||
Affining thread 3 to cpu: 3
|
||||
Affining thread 4 to cpu: 4
|
||||
Affining thread 5 to cpu: 5
|
||||
Affining thread 6 to cpu: 6
|
||||
Affining thread 7 to cpu: 7
|
||||
T: 0 (15044) P: 0 I:1000 C: 1000 Min: 74 Act: 144 Avg: 162 Max: 860
|
||||
..
|
||||
|
||||
This issue seems to come from the logic in process_options():
|
||||
/* if smp wasn't requested, test for numa automatically */
|
||||
if (!smp) {
|
||||
numa = numa_initialize();
|
||||
if (setaffinity == AFFINITY_UNSPECIFIED)
|
||||
setaffinity = AFFINITY_USEALL;
|
||||
}
|
||||
|
||||
Here, by setting setaffinity = AFFINITY_USEALL, we effectively
|
||||
pin each thread to its respective cpu, same as the "-a" option.
|
||||
|
||||
This was most recently introduced in commit bdb8350f1b0b
|
||||
("Revert "cyclictest: Use affinity_mask for steering
|
||||
thread placement"").
|
||||
|
||||
This seems erronious to me, so I wanted to share this patch
|
||||
which removes the overriding AFFINITY_UNSPECIFIED with
|
||||
AFFINITY_USEALL by default. Also, some additional tweaks to
|
||||
preserve the existing numa allocation affinity.
|
||||
|
||||
With this patch, we no longer call pthread_setaffinity_np() in the
|
||||
"./cyclictest -t -q -D1" case.
|
||||
|
||||
Cc: John Kacur <jkacur@redhat.com>
|
||||
Cc: Connor O'Brien <connoro@google.com>
|
||||
Cc: Qais Yousef <qais.yousef@arm.com>
|
||||
Signed-off-by: John Stultz <jstultz@google.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
src/cyclictest/cyclictest.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
|
||||
index decea786268a..82759d1cf67b 100644
|
||||
--- a/src/cyclictest/cyclictest.c
|
||||
+++ b/src/cyclictest/cyclictest.c
|
||||
@@ -1270,8 +1270,6 @@ static void process_options(int argc, char *argv[], int max_cpus)
|
||||
/* if smp wasn't requested, test for numa automatically */
|
||||
if (!smp) {
|
||||
numa = numa_initialize();
|
||||
- if (setaffinity == AFFINITY_UNSPECIFIED)
|
||||
- setaffinity = AFFINITY_USEALL;
|
||||
}
|
||||
|
||||
if (option_affinity) {
|
||||
@@ -2043,9 +2041,13 @@ int main(int argc, char **argv)
|
||||
void *stack;
|
||||
void *currstk;
|
||||
size_t stksize;
|
||||
+ int node_cpu = cpu;
|
||||
+
|
||||
+ if (node_cpu == -1)
|
||||
+ node_cpu = cpu_for_thread_ua(i, max_cpus);
|
||||
|
||||
/* find the memory node associated with the cpu i */
|
||||
- node = rt_numa_numa_node_of_cpu(cpu);
|
||||
+ node = rt_numa_numa_node_of_cpu(node_cpu);
|
||||
|
||||
/* get the stack size set for this thread */
|
||||
if (pthread_attr_getstack(&attr, &currstk, &stksize))
|
||||
@@ -2056,7 +2058,7 @@ int main(int argc, char **argv)
|
||||
stksize = PTHREAD_STACK_MIN * 2;
|
||||
|
||||
/* allocate memory for a stack on appropriate node */
|
||||
- stack = rt_numa_numa_alloc_onnode(stksize, node, cpu);
|
||||
+ stack = rt_numa_numa_alloc_onnode(stksize, node, node_cpu);
|
||||
|
||||
/* touch the stack pages to pre-fault them in */
|
||||
memset(stack, 0, stksize);
|
||||
--
|
||||
2.37.2
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: realtime-tests
|
||||
Summary: Programs that test various rt-features
|
||||
Version: 2.5
|
||||
Version: 2.4
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2
|
||||
URL: https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
|
||||
@ -15,9 +15,7 @@ Requires: bash
|
||||
Requires: bc
|
||||
|
||||
#Patches
|
||||
Patch1: rt-tests-deadline_test-Fix-spelling-to-single-in-com.patch
|
||||
Patch2: rt-tests-hwlatdetect-Add-field-cpu-to-samples-output.patch
|
||||
Patch3: rt-tests-Makefile-Use-sysconfig-instead-of-distutils.patch
|
||||
Patch1: cyclictest-Fix-threads-being-affined-even-when-a-not-set.patch
|
||||
|
||||
%description
|
||||
realtime-tests is a set of programs that test and measure various components of
|
||||
@ -76,13 +74,6 @@ latency. It also tests the functioning of priority-inheritance mutexes.
|
||||
%{_mandir}/man8/determine_maximum_mpps.8.*
|
||||
|
||||
%changelog
|
||||
* Tue Feb 14 2023 John Kacur <jkacur@redhat.com> - 2.5-1
|
||||
- Update to latest upstream
|
||||
- Remove patch included in the update, and add three more
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Thu Aug 18 2022 John Kacur <jkacur@redhat.com> - 2.4-1
|
||||
- Update to latest version upstream
|
||||
- Include upstream patch to fix affinity being set even when -a not set
|
||||
|
@ -1,55 +0,0 @@
|
||||
From eb18c75481745cc482b9d968811c626cff54d00f Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Wed, 15 Feb 2023 17:10:37 -0500
|
||||
Subject: [PATCH 3/3] rt-tests: Makefile: Use sysconfig instead of distutils
|
||||
for PYLIB
|
||||
|
||||
Use sysconfig instead of distutils for PYLIB
|
||||
Version 2 takes into consideration that different versions of python
|
||||
produce different results.
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
get_pylib.py | 16 ++++++++++++++++
|
||||
2 files changed, 17 insertions(+), 1 deletion(-)
|
||||
create mode 100755 get_pylib.py
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 4df61ece123b..32a9f41198a4 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -34,7 +34,7 @@ CFLAGS ?= -Wall -Wno-nonnull -Wextra
|
||||
CPPFLAGS += -D_GNU_SOURCE -Isrc/include
|
||||
LDFLAGS ?=
|
||||
|
||||
-PYLIB ?= $(shell python3 -c 'import distutils.sysconfig; print (distutils.sysconfig.get_python_lib())')
|
||||
+PYLIB ?= $(shell python3 -m get_pylib)
|
||||
|
||||
# Check for errors, such as python3 not available
|
||||
ifeq (${PYLIB},)
|
||||
diff --git a/get_pylib.py b/get_pylib.py
|
||||
new file mode 100755
|
||||
index 000000000000..56253d589fe4
|
||||
--- /dev/null
|
||||
+++ b/get_pylib.py
|
||||
@@ -0,0 +1,16 @@
|
||||
+#!/usr/bin/python3
|
||||
+
|
||||
+# This file is used during the make process
|
||||
+
|
||||
+import sysconfig
|
||||
+
|
||||
+# Older versions of python don't have this scheme
|
||||
+# but produce the answer we expect with 'posix_prefix'
|
||||
+# Newer versions of python insert 'local' in the path unless we use rpm_prefix
|
||||
+SCHEME = 'rpm_prefix'
|
||||
+
|
||||
+if not SCHEME in sysconfig.get_scheme_names():
|
||||
+ SCHEME = 'posix_prefix'
|
||||
+
|
||||
+PYLIB = sysconfig.get_path('purelib', SCHEME)
|
||||
+print(PYLIB)
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 37b70ea17d5479505cebed409087c6cd28c1a485 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Fri, 10 Feb 2023 14:57:38 -0500
|
||||
Subject: [PATCH 1/3] rt-tests: deadline_test: Fix spelling to "single" in
|
||||
comment
|
||||
|
||||
Fix the spelling in the comments before bind_cpu()
|
||||
from "sigle" to "single".
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
src/sched_deadline/deadline_test.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
|
||||
index 731073e85180..cd8ef01f7d68 100644
|
||||
--- a/src/sched_deadline/deadline_test.c
|
||||
+++ b/src/sched_deadline/deadline_test.c
|
||||
@@ -931,7 +931,7 @@ static void teardown(void)
|
||||
* bind_cpu - Set the affinity of a thread to a specific CPU.
|
||||
* @cpu: The CPU to bind to.
|
||||
*
|
||||
- * Sets the current thread to have an affinity of a sigle CPU.
|
||||
+ * Sets the current thread to have an affinity of a single CPU.
|
||||
* Does not work on SCHED_DEADLINE tasks.
|
||||
*/
|
||||
static void bind_cpu(int cpu)
|
||||
--
|
||||
2.39.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 96e78093832288b705c507b1ee443aeffe126bba Mon Sep 17 00:00:00 2001
|
||||
From: Costa Shulyupin <costa.shul@redhat.com>
|
||||
Date: Mon, 13 Feb 2023 19:11:36 +0200
|
||||
Subject: [PATCH 2/3] rt-tests: hwlatdetect: Add field cpu to samples output
|
||||
|
||||
Information about CPU index is valuable for debugging
|
||||
latency issues
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
src/hwlatdetect/hwlatdetect.py | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
|
||||
index 68df58f7e2d0..dc28f38b751a 100755
|
||||
--- a/src/hwlatdetect/hwlatdetect.py
|
||||
+++ b/src/hwlatdetect/hwlatdetect.py
|
||||
@@ -237,10 +237,11 @@ class Tracer(Detector):
|
||||
|
||||
class Sample:
|
||||
'private class for tracer sample data'
|
||||
- __slots__ = 'timestamp', 'inner', 'outer'
|
||||
+ __slots__ = 'cpu', 'timestamp', 'inner', 'outer'
|
||||
|
||||
def __init__(self, line):
|
||||
fields = line.split()
|
||||
+ self.cpu = int(fields[1][1:-1])
|
||||
i, o = fields[6].split('/')
|
||||
ts = fields[7][3:]
|
||||
self.timestamp = str(ts)
|
||||
@@ -248,7 +249,7 @@ class Tracer(Detector):
|
||||
self.outer = int(o)
|
||||
|
||||
def __str__(self):
|
||||
- return f"ts: {self.timestamp}, inner:{self.inner}, outer:{self.outer}"
|
||||
+ return f"ts: {self.timestamp}, inner:{self.inner}, outer:{self.outer}, cpu:{self.cpu}"
|
||||
|
||||
def display(self):
|
||||
""" convert object to string and print """
|
||||
--
|
||||
2.39.1
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (rt-tests-2.5.tar.xz) = 4341716aa1a307aeb9f11e922da814ff6f1e16f7a4b9ba05bcc8a3972f411f4b4f8212ffe58bdaa025e164d1ddcfcc199fdb2b53bfe051d58cfd898a751dcc25
|
||||
SHA512 (rt-tests-2.4.tar.xz) = ef72a55ed85c4d6717cef4573d684ea87f6e73f9189b2a2b8e9b69eaf6ea59933522769c9ba9c131ef9d0546645152e65f072427c53fcc0e386bd297fac3a6e1
|
||||
|
Loading…
Reference in New Issue
Block a user