* [PATCH 0/8] Some miscellanous fixes
@ 2021-08-27 22:02 John Kacur
2021-08-27 22:02 ` [PATCH 1/8] rt-tests: deadline_test: Move va_start forward John Kacur
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Just a few miscellanous fixes here, nothing big.
Daniel Wagner (1):
rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
John Kacur (7):
rt-tests: deadline_test: Move va_start forward
rt-tests: deadline_test: Remove deadcode
rt-tests: ptsematest: Remove deadcode
rt-tests: pi_stress: Don't call free on alloca
rt-tests: pip_stress: Add missing paramater in error message
rt-tests: pi_stress: Add missing parameter and fix types
rt-tests: deadline_test: Exit with message if threads less than 1
src/lib/rt-numa.c | 6 ++----
src/pi_tests/pi_stress.c | 12 ++++--------
src/pi_tests/pip_stress.c | 2 +-
src/ptsematest/ptsematest.c | 6 ------
src/sched_deadline/deadline_test.c | 13 +++++++------
5 files changed, 14 insertions(+), 25 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8] rt-tests: deadline_test: Move va_start forward
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 2/8] rt-tests: deadline_test: Remove deadcode John Kacur
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
If open_cpuset fails then we return without calling va_end
Fixing this by moving the call to va_start after that.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index a48c231c1281..e89654d976f2 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -728,12 +728,12 @@ static const char *make_cpuset(const char *name, const char *cpus,
int *pids;
int i;
- va_start(ap, flags);
-
fd = open_cpuset(path, "tasks");
if (fd < 0)
return "open tasks";
+ va_start(ap, flags);
+
ret = 0;
pids = va_arg(ap, int *);
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/8] rt-tests: deadline_test: Remove deadcode
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
2021-08-27 22:02 ` [PATCH 1/8] rt-tests: deadline_test: Move va_start forward John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 3/8] rt-tests: ptsematest: " John Kacur
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Remove deadcode that was probably accidently left in during development.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index e89654d976f2..1763c71486a9 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -873,10 +873,6 @@ static void destroy_cpuset(const char *name, int print)
goto again;
fprintf(stderr, "Failed to remove %s\n", path);
perror("rmdir");
- if (retry++ < 5) {
- fprintf(stderr, "Trying again\n");
- goto again;
- }
}
}
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/8] rt-tests: ptsematest: Remove deadcode
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
2021-08-27 22:02 ` [PATCH 1/8] rt-tests: deadline_test: Move va_start forward John Kacur
2021-08-27 22:02 ` [PATCH 2/8] rt-tests: deadline_test: Remove deadcode John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 4/8] rt-tests: pi_stress: Don't call free on alloca John Kacur
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Remove deadcode from ptsematest.c
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/ptsematest/ptsematest.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index 821e58428e6d..e000c3017081 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -58,7 +58,6 @@ struct params {
void *semathread(void *param)
{
int mustgetcpu = 0;
- int first = 1;
struct params *par = param;
cpu_set_t mask;
int policy = SCHED_FIFO;
@@ -92,11 +91,6 @@ void *semathread(void *param)
if (mustgetcpu)
par->cpu = get_cpu();
} else {
- /* Receiver */
- if (!first) {
- pthread_mutex_lock(&syncmutex[par->num]);
- first = 1;
- }
pthread_mutex_lock(&testmutex[par->num]);
/* ... Got the lock: End of latency measurement */
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/8] rt-tests: pi_stress: Don't call free on alloca
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
` (2 preceding siblings ...)
2021-08-27 22:02 ` [PATCH 3/8] rt-tests: ptsematest: " John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 5/8] rt-tests: pip_stress: Add missing paramater in error message John Kacur
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
strdupa uses alloca to allocate the buffer
free should not be used on space allocated with alloca,
so remove these.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pi_tests/pi_stress.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 53c6af15afac..3888198f395b 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -1259,10 +1259,8 @@ int process_sched_line(const char *arg)
k = strsep(&buf, del);
}
- if (!id) {
- free(buf);
+ if (!id)
return FAILURE;
- }
/* We do not validate the options, instead we pass all garbage
* to the kernel and see what's happening */
@@ -1280,7 +1278,6 @@ int process_sched_line(const char *arg)
retval = FAILURE;
}
- free(buf);
return retval;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/8] rt-tests: pip_stress: Add missing paramater in error message
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
` (3 preceding siblings ...)
2021-08-27 22:02 ` [PATCH 4/8] rt-tests: pi_stress: Don't call free on alloca John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 6/8] rt-tests: pi_stress: Add missing parameter and fix types John Kacur
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Add missing string __func__ in error message
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pi_tests/pip_stress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 8b91578f9ab8..c6d2bae05035 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -254,7 +254,7 @@ long process_shared_mutex_available(void)
res = sysconf(_SC_THREAD_PROCESS_SHARED);
if (res == -1) {
int err = errno; /* save the error number */
- err_msg("%s: sysconf(_SC_THREAD_PROCESS_SHARED): ");
+ err_msg("%s: sysconf(_SC_THREAD_PROCESS_SHARED): ", __func__);
err_exit(err, NULL);
}
#else
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/8] rt-tests: pi_stress: Add missing parameter and fix types
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
` (4 preceding siblings ...)
2021-08-27 22:02 ` [PATCH 5/8] rt-tests: pip_stress: Add missing paramater in error message John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 7/8] rt-tests: deadline_test: Exit with message if threads less than 1 John Kacur
2021-08-27 22:02 ` [PATCH 8/8] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() John Kacur
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Add missing parameter in message and correct type.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pi_tests/pi_stress.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 3888198f395b..9f4ffa49e926 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -668,7 +668,7 @@ void *low_priority(void *arg)
}
/* initial state */
- pi_debug("low_priority[%d]: entering start wait (%d)\n", p->id,
+ pi_debug("low_priority[%d]: entering start wait (%ld)\n", p->id,
count++);
status = pthread_barrier_wait(&p->start_barrier);
if (status && status != PTHREAD_BARRIER_SERIAL_THREAD) {
@@ -796,7 +796,7 @@ void *med_priority(void *arg)
}
/* start state */
- pi_debug("med_priority[%d]: entering start state (%d)\n", p->id,
+ pi_debug("med_priority[%d]: entering start state (%ld)\n", p->id,
count++);
status = pthread_barrier_wait(&p->start_barrier);
if (status && status != PTHREAD_BARRIER_SERIAL_THREAD) {
@@ -949,8 +949,7 @@ void *high_priority(void *arg)
status = pthread_barrier_wait(&p->finish_barrier);
if (status && status != PTHREAD_BARRIER_SERIAL_THREAD) {
pi_error
- ("high_priority[%d]: pthread_barrier_wait(finish): %x",
- status);
+ ("high_priority[%d]: pthread_barrier_wait(finish): %x", p->id, status);
return NULL;
}
/* update the group stats */
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/8] rt-tests: deadline_test: Exit with message if threads less than 1
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
` (5 preceding siblings ...)
2021-08-27 22:02 ` [PATCH 6/8] rt-tests: pi_stress: Add missing parameter and fix types John Kacur
@ 2021-08-27 22:02 ` John Kacur
2021-08-27 22:02 ` [PATCH 8/8] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() John Kacur
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
If the user tries to run deadline_test with threads less than 1 (zero
for example), then exit with an error message.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index 1763c71486a9..53abd4d2ca6b 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -1817,6 +1817,11 @@ int main(int argc, char **argv)
exit(-1);
}
+ if (nr_threads < 1) {
+ fprintf(stderr, "The number of threads must be at least 1\n");
+ exit(-1);
+ }
+
if (setcpu) {
nr_cpus = calc_nr_cpus(setcpu, &setcpu_buf);
if (nr_cpus < 0) {
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 8/8] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
` (6 preceding siblings ...)
2021-08-27 22:02 ` [PATCH 7/8] rt-tests: deadline_test: Exit with message if threads less than 1 John Kacur
@ 2021-08-27 22:02 ` John Kacur
7 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2021-08-27 22:02 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, Daniel Wagner, John Kacur
From: Daniel Wagner <dwagner@suse.de>
pthread_getaffinity_np() prevents static builds as glibc does not
expose it for this configuration. Instead use sched_getaffinity()
directly as pthread_getaffinity_np() is just a fancy glibc wrapper
around sched_getaffinity().
Static builds helps in situation where the rootfs is minimal
and does for example not ship libnuma.
The pthread_getaffinity_np call was introduced by
commit f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified
[NUM]")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
- Some minor fixes to the description
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/lib/rt-numa.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index babcc634d57e..bb0121a65eca 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -68,15 +68,13 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
int cpu_for_thread_ua(int thread_num, int max_cpus)
{
int res, num_cpus, i, m, cpu;
- pthread_t thread;
cpu_set_t cpuset;
- thread = pthread_self();
CPU_ZERO(&cpuset);
- res = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
+ res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset);
if (res != 0)
- fatal("pthread_getaffinity_np failed: %s\n", strerror(res));
+ fatal("sched_getaffinity failed: %s\n", strerror(res));
num_cpus = CPU_COUNT(&cpuset);
m = thread_num % num_cpus;
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-27 22:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 22:02 [PATCH 0/8] Some miscellanous fixes John Kacur
2021-08-27 22:02 ` [PATCH 1/8] rt-tests: deadline_test: Move va_start forward John Kacur
2021-08-27 22:02 ` [PATCH 2/8] rt-tests: deadline_test: Remove deadcode John Kacur
2021-08-27 22:02 ` [PATCH 3/8] rt-tests: ptsematest: " John Kacur
2021-08-27 22:02 ` [PATCH 4/8] rt-tests: pi_stress: Don't call free on alloca John Kacur
2021-08-27 22:02 ` [PATCH 5/8] rt-tests: pip_stress: Add missing paramater in error message John Kacur
2021-08-27 22:02 ` [PATCH 6/8] rt-tests: pi_stress: Add missing parameter and fix types John Kacur
2021-08-27 22:02 ` [PATCH 7/8] rt-tests: deadline_test: Exit with message if threads less than 1 John Kacur
2021-08-27 22:02 ` [PATCH 8/8] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() John Kacur
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.