linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rt-tests v4 00/16] rt-numa.h cleanups
@ 2021-02-10 13:34 Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly Daniel Wagner
                   ` (15 more replies)
  0 siblings, 16 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

This series cleans up the rt-numa.h header.

As we have a hard dependency on libnuma we can simplify the code in
cyclictest. This allows remove all the small helpers in rt_numa.h. And
with this we can remove the header and reduce the confusion with
rt-numa.h

While at it, I simplified the --smp vs --affinity vs --threads
logic. There is no need for additional variables to keep state. With
this we also make --affinity to behave as with the rest of
rt-tests. That is a plan -a will be the same as with -S. There is no
need for -S anymore but I think we should leave it in place for
backwards compatibility. I suspect, there must be a lot of muscle
memory out there :)

Since signaltest has the same code as cyclictest, cleanup this tool as
well.

With all those cleanups in cyclictest and signaltest, rt-numa.h
contains only a three functions. The final part of the series is to
remove unnecessary function arguments (max_cpus). This also fixes the
theoretical problem that a sparse cpumask would not be handled
correctly.

v4:
 - build fix becaue of error.c -> rt-error.c

v3:
 - added error handling for numa_on_node() return value
 - added 'Rename error.h to rt-error.h' patch
 - rebased, dropped applied patches
 - fixed SoBs and stearing vs sterring spelling error

v2:
  - added more cleanup patches

Daniel Wagner (16):
  cyclictest: Use numa API directly
  cyclictest: Mimic --smp behavior with --affinity
  cyclictest: Simplify --smp vs --affinity vs --threads argument logic
  signaltest: Use affinity_mask for steering thread placement
  signaltest: Simplify --smp vs --affinity vs --threads argument logic
  rt-numa: Remove unused definitions and numa_initialize()
  rt-numa: Add generic cpu_for_thread() helper
  rt-numa: Use mask size for iterator limit
  rt-numa: Remove max_cpus argument from parse_cpusmask
  signaltest: Remove unused max_cpus argument from process_options
  cyclictest: Remove unused max_cpus argument from process_options
  rt-numa: Use CPU_SETSIZE as upper loop limit
  rt-numa: Remove used max_cpus argument from cpu_for_thread()
  cyclictest: Remove max cpus used verbose information
  cyclictest: Remove unecessary local variable
  rt-tests: Rename error.h to rt-error.h

 Makefile                            |   2 +-
 src/cyclictest/cyclictest.c         | 111 ++++++++++------------------
 src/cyclictest/rt_numa.h            |  96 ------------------------
 src/include/pip_stress.h            |   5 +-
 src/include/{error.h => rt-error.h} |   0
 src/include/rt-numa.h               |  13 +---
 src/lib/{error.c => rt-error.c}     |   2 +-
 src/lib/rt-numa.c                   |  42 +++++------
 src/lib/rt-utils.c                  |   3 +-
 src/oslat/oslat.c                   |   5 +-
 src/pi_tests/pi_stress.c            |   3 +-
 src/pmqtest/pmqtest.c               |   6 +-
 src/ptsematest/ptsematest.c         |   6 +-
 src/sched_deadline/cyclicdeadline.c |   6 +-
 src/signaltest/signaltest.c         |  76 +++++--------------
 src/sigwaittest/sigwaittest.c       |   2 +-
 src/svsematest/svsematest.c         |   3 +-
 17 files changed, 99 insertions(+), 282 deletions(-)
 delete mode 100644 src/cyclictest/rt_numa.h
 rename src/include/{error.h => rt-error.h} (100%)
 rename src/lib/{error.c => rt-error.c} (98%)

-- 
2.30.0


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

* [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-17  3:49   ` John Kacur
  2021-02-10 13:34 ` [PATCH rt-tests v4 02/16] cyclictest: Mimic --smp behavior with --affinity Daniel Wagner
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

There is no need for small libnuma wrappers functions as we always
use libnuma. Remove them and get rid of rt_numa.h, so there is
no confusion with rt-numa.h anymore.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 43 +++++++++--------
 src/cyclictest/rt_numa.h    | 96 -------------------------------------
 2 files changed, 24 insertions(+), 115 deletions(-)
 delete mode 100644 src/cyclictest/rt_numa.h

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 99846e78526f..6009ff2a83bc 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -33,10 +33,10 @@
 #include <sys/utsname.h>
 #include <sys/mman.h>
 #include <sys/syscall.h>
-#include "rt_numa.h"
 
 #include "rt-utils.h"
 #include "rt-numa.h"
+#include "error.h"
 
 #include <bionic.h>
 
@@ -514,9 +514,9 @@ static void *timerthread(void *param)
 
 	memset(&stop, 0, sizeof(stop));
 
-	/* if we're running in numa mode, set our memory node */
-	if (par->node != -1)
-		rt_numa_set_numa_run_on_node(par->node, par->cpu);
+	if (numa_run_on_node(par->node))
+		warn("Could not set NUMA node %d for thread %d: %s\n",
+				par->node, par->cpu, strerror(errno));
 
 	if (par->cpu != -1) {
 		CPU_ZERO(&mask);
@@ -1251,7 +1251,7 @@ static void process_options(int argc, char *argv[], int max_cpus)
 	}
 	if (error) {
 		if (affinity_mask)
-			rt_bitmask_free(affinity_mask);
+			numa_bitmask_free(affinity_mask);
 		display_help(1);
 	}
 }
@@ -1907,7 +1907,9 @@ int main(int argc, char **argv)
 			printf("Thread %d using cpu %d.\n", i, cpu);
 
 		/* find the memory node associated with the cpu i */
-		node = rt_numa_numa_node_of_cpu(cpu);
+		node = numa_node_of_cpu(cpu);
+		if (node == -1)
+			fatal("Invalid NUMA node selected via affinity mask\n");
 
 		/* get the stack size set for this thread */
 		if (pthread_attr_getstack(&attr, &currstk, &stksize))
@@ -1918,7 +1920,10 @@ 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 = numa_alloc_onnode(stksize, node);
+		if (!stack)
+			fatal("failed to allocate %d bytes on node %d for cpu %d\n",
+				stksize, node, cpu);
 
 		/* touch the stack pages to pre-fault them in */
 		memset(stack, 0, stksize);
@@ -1929,13 +1934,13 @@ int main(int argc, char **argv)
 				i, stack+stksize);
 
 		/* allocate the thread's parameter block  */
-		parameters[i] = par = threadalloc(sizeof(struct thread_param), node);
+		parameters[i] = par = numa_alloc_onnode(sizeof(struct thread_param), node);
 		if (par == NULL)
 			fatal("error allocating thread_param struct for thread %d\n", i);
 		memset(par, 0, sizeof(struct thread_param));
 
 		/* allocate the thread's statistics block */
-		statistics[i] = stat = threadalloc(sizeof(struct thread_stat), node);
+		statistics[i] = stat = numa_alloc_onnode(sizeof(struct thread_stat), node);
 		if (stat == NULL)
 			fatal("error allocating thread status struct for thread %d\n", i);
 		memset(stat, 0, sizeof(struct thread_stat));
@@ -1944,8 +1949,8 @@ int main(int argc, char **argv)
 		if (histogram) {
 			int bufsize = histogram * sizeof(long);
 
-			stat->hist_array = threadalloc(bufsize, node);
-			stat->outliers = threadalloc(bufsize, node);
+			stat->hist_array = numa_alloc_onnode(bufsize, node);
+			stat->outliers = numa_alloc_onnode(bufsize, node);
 			if (stat->hist_array == NULL || stat->outliers == NULL)
 				fatal("failed to allocate histogram of size %d on node %d\n",
 				      histogram, i);
@@ -1955,14 +1960,14 @@ int main(int argc, char **argv)
 
 		if (verbose) {
 			int bufsize = VALBUF_SIZE * sizeof(long);
-			stat->values = threadalloc(bufsize, node);
+			stat->values = numa_alloc_onnode(bufsize, node);
 			if (!stat->values)
 				goto outall;
 			memset(stat->values, 0, bufsize);
 			par->bufmsk = VALBUF_SIZE - 1;
 			if (smi) {
 				int bufsize = VALBUF_SIZE * sizeof(long);
-				stat->smis = threadalloc(bufsize, node);
+				stat->smis = numa_alloc_onnode(bufsize, node);
 				if (!stat->smis)
 					goto outall;
 				memset(stat->smis, 0, bufsize);
@@ -2077,7 +2082,7 @@ int main(int argc, char **argv)
 				print_stat(stdout, parameters[i], i, 0, 0);
 		}
 		if (statistics[i]->values)
-			threadfree(statistics[i]->values, VALBUF_SIZE*sizeof(long), parameters[i]->node);
+			numa_free(statistics[i]->values, VALBUF_SIZE*sizeof(long));
 	}
 
 	if (trigger)
@@ -2086,8 +2091,8 @@ int main(int argc, char **argv)
 	if (histogram) {
 		print_hist(parameters, num_threads);
 		for (i = 0; i < num_threads; i++) {
-			threadfree(statistics[i]->hist_array, histogram*sizeof(long), parameters[i]->node);
-			threadfree(statistics[i]->outliers, histogram*sizeof(long), parameters[i]->node);
+			numa_free(statistics[i]->hist_array, histogram*sizeof(long));
+			numa_free(statistics[i]->outliers, histogram*sizeof(long));
 		}
 	}
 
@@ -2103,14 +2108,14 @@ int main(int argc, char **argv)
 	for (i=0; i < num_threads; i++) {
 		if (!statistics[i])
 			continue;
-		threadfree(statistics[i], sizeof(struct thread_stat), parameters[i]->node);
+		numa_free(statistics[i], sizeof(struct thread_stat));
 	}
 
  outpar:
 	for (i = 0; i < num_threads; i++) {
 		if (!parameters[i])
 			continue;
-		threadfree(parameters[i], sizeof(struct thread_param), parameters[i]->node);
+		numa_free(parameters[i], sizeof(struct thread_param));
 	}
  out:
 	/* close any tracer file descriptors */
@@ -2125,7 +2130,7 @@ int main(int argc, char **argv)
 		close(latency_target_fd);
 
 	if (affinity_mask)
-		rt_bitmask_free(affinity_mask);
+		numa_bitmask_free(affinity_mask);
 
 	/* Remove running status shared memory file if it exists */
 	if (rstat_fd >= 0)
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
deleted file mode 100644
index 8d02f419ed6d..000000000000
--- a/src/cyclictest/rt_numa.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * A numa library for cyclictest.
- *
- * (C) 2010 John Kacur <jkacur@redhat.com>
- * (C) 2010 Clark Williams <williams@redhat.com>
- *
- */
-
-#ifndef _RT_NUMA_H
-#define _RT_NUMA_H
-
-#include "rt-utils.h"
-#include "error.h"
-
-#include <numa.h>
-
-static void *
-threadalloc(size_t size, int node)
-{
-	if (node == -1)
-		return malloc(size);
-	return numa_alloc_onnode(size, node);
-}
-
-static void
-threadfree(void *ptr, size_t size, int node)
-{
-	if (node == -1)
-		free(ptr);
-	else
-		numa_free(ptr, size);
-}
-
-static void rt_numa_set_numa_run_on_node(int node, int cpu)
-{
-	int res;
-	res = numa_run_on_node(node);
-	if (res)
-		warn("Could not set NUMA node %d for thread %d: %s\n",
-				node, cpu, strerror(errno));
-	return;
-}
-
-static void *rt_numa_numa_alloc_onnode(size_t size, int node, int cpu)
-{
-	void *stack;
-	stack = numa_alloc_onnode(size, node);
-	if (stack == NULL)
-		fatal("failed to allocate %d bytes on node %d for cpu %d\n",
-				size, node, cpu);
-	return stack;
-}
-
-/*
- * Use new bit mask CPU affinity behavior
- */
-static int rt_numa_numa_node_of_cpu(int cpu)
-{
-	int node;
-	node = numa_node_of_cpu(cpu);
-	if (node == -1)
-		fatal("invalid cpu passed to numa_node_of_cpu(%d)\n", cpu);
-	return node;
-}
-
-static inline unsigned int rt_numa_bitmask_isbitset( const struct bitmask *mask,
-	unsigned long i)
-{
-	return numa_bitmask_isbitset(mask,i);
-}
-
-static inline struct bitmask* rt_numa_parse_cpustring(const char* s,
-	int max_cpus)
-{
-	return numa_parse_cpustring_all(s);
-}
-
-static inline void rt_bitmask_free(struct bitmask *mask)
-{
-	numa_bitmask_free(mask);
-}
-
-/** Returns number of bits set in mask. */
-static inline unsigned int rt_numa_bitmask_count(const struct bitmask *mask)
-{
-	unsigned int num_bits = 0, i;
-	for (i = 0; i < mask->size; i++) {
-		if (rt_numa_bitmask_isbitset(mask, i))
-			num_bits++;
-	}
-	/* Could stash this instead of recomputing every time. */
-	return num_bits;
-}
-
-#endif	/* _RT_NUMA_H */
-- 
2.30.0


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

* [PATCH rt-tests v4 02/16] cyclictest: Mimic --smp behavior with --affinity
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-17  3:49   ` John Kacur
  2021-02-10 13:34 ` [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Let --affinity without an argument behave in the same way as
--smp. Run a thread on each CPU. This makes cyclictest behave as the
rest of the rt-tests when --affinity is used.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 6009ff2a83bc..4c02f067fbad 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1019,6 +1019,8 @@ static void process_options(int argc, char *argv[], int max_cpus)
 				    argv[optind][0] == '0' ||
 				    argv[optind][0] == '!')) {
 				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
+			} else {
+				num_threads = -1;
 			}
 			break;
 		case 'A':
-- 
2.30.0


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

* [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 02/16] cyclictest: Mimic --smp behavior with --affinity Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-15  4:06   ` Punit Agrawal
  2021-02-10 13:34 ` [PATCH rt-tests v4 04/16] signaltest: Use affinity_mask for steering thread placement Daniel Wagner
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow each command line only to update one variable and do the final
decission at the end of the parsing step. With this the order
of the command line is not important.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 34 ++++++++--------------------------
 1 file changed, 8 insertions(+), 26 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 4c02f067fbad..b5cca3ae166b 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -880,14 +880,13 @@ static int timermode = TIMER_ABSTIME;
 static int use_system;
 static int priority;
 static int policy = SCHED_OTHER;	/* default policy if not specified */
-static int num_threads = 1;
+static int num_threads = -1;
 static int max_cycles;
 static int clocksel = 0;
 static int quiet;
 static int interval = DEFAULT_INTERVAL;
 static int distance = -1;
 static struct bitmask *affinity_mask = NULL;
-static int smp = 0;
 
 static int clocksources[] = {
 	CLOCK_MONOTONIC,
@@ -953,7 +952,7 @@ enum option_values {
 static void process_options(int argc, char *argv[], int max_cpus)
 {
 	int error = 0;
-	int option_affinity = 0;
+	int smp = 0;
 
 	for (;;) {
 		int option_index = 0;
@@ -1008,10 +1007,6 @@ static void process_options(int argc, char *argv[], int max_cpus)
 		switch (c) {
 		case 'a':
 		case OPT_AFFINITY:
-			option_affinity = 1;
-			/* smp sets AFFINITY_USEALL in OPT_SMP */
-			if (smp)
-				break;
 			if (optarg) {
 				parse_cpumask(optarg, max_cpus, &affinity_mask);
 			} else if (optind < argc &&
@@ -1019,8 +1014,6 @@ static void process_options(int argc, char *argv[], int max_cpus)
 				    argv[optind][0] == '0' ||
 				    argv[optind][0] == '!')) {
 				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
-			} else {
-				num_threads = -1;
 			}
 			break;
 		case 'A':
@@ -1108,22 +1101,14 @@ static void process_options(int argc, char *argv[], int max_cpus)
 		case OPT_SYSTEM:
 			use_system = MODE_SYS_OFFSET; break;
 		case 'S':
-		case OPT_SMP: /* SMP testing */
-			smp = 1;
-			num_threads = -1; /* update after parsing */
-			break;
+		case OPT_SMP:
+			smp = 1; break;
 		case 't':
 		case OPT_THREADS:
-			if (smp) {
-				warn("-t ignored due to smp mode\n");
-				break;
-			}
 			if (optarg != NULL)
 				num_threads = atoi(optarg);
 			else if (optind < argc && atoi(argv[optind]))
 				num_threads = atoi(argv[optind]);
-			else
-				num_threads = -1; /* update after parsing */
 			break;
 		case OPT_TRIGGER:
 			trigger = atoi(optarg);
@@ -1179,13 +1164,10 @@ static void process_options(int argc, char *argv[], int max_cpus)
 		use_nanosleep = MODE_CLOCK_NANOSLEEP;
 	}
 
-	if (option_affinity && smp) {
-		warn("-a ignored due to smp mode\n");
-		if (affinity_mask) {
-			numa_bitmask_free(affinity_mask);
-			affinity_mask = NULL;
-		}
-	}
+	if (smp && num_threads != -1)
+		warn("--threads overwrites smp mode\n");
+	if (smp && affinity_mask)
+		warn("--affinity overwrites smp mode\n");
 
 	if (smi) {
 		if (affinity_mask)
-- 
2.30.0


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

* [PATCH rt-tests v4 04/16] signaltest: Use affinity_mask for steering thread placement
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (2 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 05/16] signaltest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

We don't need an extra variable to track the state if a bitmask is
available or not. Check directly if the mask is usable.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/signaltest/signaltest.c | 44 ++++++++-----------------------------
 1 file changed, 9 insertions(+), 35 deletions(-)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index b3a82f8c4f65..e19fc9a740a9 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -205,15 +205,13 @@ static int verbose;
 static int quiet;
 static int lockall;
 static struct bitmask *affinity_mask = NULL;
-static int smp = 0;
-static int setaffinity = AFFINITY_UNSPECIFIED;
 
 /* Process commandline options */
 static void process_options(int argc, char *argv[], unsigned int max_cpus)
 {
-	int option_affinity = 0;
 	int error = 0;
 	int numa = 0;
+	int smp = 0;
 
 	for (;;) {
 		int option_index = 0;
@@ -238,26 +236,19 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 			break;
 		switch (c) {
 		case 'a':
-			option_affinity = 1;
 			/* smp sets AFFINITY_USEALL in OPT_SMP */
 			if (smp)
 				break;
 			numa = 1;
 			if (optarg) {
 				parse_cpumask(optarg, max_cpus, &affinity_mask);
-				setaffinity = AFFINITY_SPECIFIED;
 			} else if (optind < argc &&
 				   (atoi(argv[optind]) ||
 				    argv[optind][0] == '0' ||
 				    argv[optind][0] == '!')) {
 				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
-				setaffinity = AFFINITY_SPECIFIED;
-			} else {
-				setaffinity = AFFINITY_USEALL;
 			}
 
-			if (setaffinity == AFFINITY_SPECIFIED && !affinity_mask)
-				display_help(1);
 			if (verbose)
 				printf("Using %u cpus.\n",
 					numa_bitmask_weight(affinity_mask));
@@ -275,7 +266,6 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 				fatal("numa and smp options are mutually exclusive\n");
 			smp = 1;
 			num_threads = -1; /* update after parsing */
-			setaffinity = AFFINITY_USEALL;
 			break;
 		case 't': num_threads = atoi(optarg); break;
 		case 'v': verbose = 1; break;
@@ -294,16 +284,8 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 	if (num_threads < 2)
 		error = 1;
 
-	/* if smp wasn't requested, test for numa automatically */
-	if (!smp) {
-		if (setaffinity == AFFINITY_UNSPECIFIED)
-			setaffinity = AFFINITY_USEALL;
-	}
-
-	if (option_affinity) {
-		if (smp)
-			warn("-a ignored due to smp mode\n");
-	}
+	if (smp && affinity_mask)
+		warn("-a ignored due to smp mode\n");
 
 	if (error) {
 		if (affinity_mask)
@@ -365,7 +347,7 @@ int main(int argc, char **argv)
 		}
 
 	/* Restrict the main pid to the affinity specified by the user */
-	if (affinity_mask != NULL) {
+	if (affinity_mask) {
 		int res;
 
 		errno = 0;
@@ -400,21 +382,13 @@ int main(int argc, char **argv)
 			par[i].bufmsk = VALBUF_SIZE - 1;
 		}
 
-		switch (setaffinity) {
-		case AFFINITY_UNSPECIFIED:
-			cpu = -1;
-			break;
-		case AFFINITY_SPECIFIED:
+		if (affinity_mask)
 			cpu = cpu_for_thread_sp(i, max_cpus, affinity_mask);
-			if (verbose)
-				printf("Thread %d using cpu %d.\n", i, cpu);
-			break;
-		case AFFINITY_USEALL:
+		else
 			cpu = cpu_for_thread_ua(i, max_cpus);
-			break;
-		default:
-			cpu = -1;
-		}
+
+		if (verbose)
+			printf("Thread %d using cpu %d.\n", i, cpu);
 
 		par[i].id = i;
 		par[i].prio = priority;
-- 
2.30.0


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

* [PATCH rt-tests v4 05/16] signaltest: Simplify --smp vs --affinity vs --threads argument logic
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (3 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 04/16] signaltest: Use affinity_mask for steering thread placement Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 06/16] rt-numa: Remove unused definitions and numa_initialize() Daniel Wagner
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow each command line only to update one variable and do the final
decission at the end of the parsing step. With this the order
of the command line is not important.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/signaltest/signaltest.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index e19fc9a740a9..61420fa13347 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -210,7 +210,6 @@ static struct bitmask *affinity_mask = NULL;
 static void process_options(int argc, char *argv[], unsigned int max_cpus)
 {
 	int error = 0;
-	int numa = 0;
 	int smp = 0;
 
 	for (;;) {
@@ -236,10 +235,6 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 			break;
 		switch (c) {
 		case 'a':
-			/* smp sets AFFINITY_USEALL in OPT_SMP */
-			if (smp)
-				break;
-			numa = 1;
 			if (optarg) {
 				parse_cpumask(optarg, max_cpus, &affinity_mask);
 			} else if (optind < argc &&
@@ -261,12 +256,7 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 		case 'm': lockall = 1; break;
 		case 'p': priority = atoi(optarg); break;
 		case 'q': quiet = 1; break;
-		case 'S':
-			if (numa)
-				fatal("numa and smp options are mutually exclusive\n");
-			smp = 1;
-			num_threads = -1; /* update after parsing */
-			break;
+		case 'S': smp = 1; break;
 		case 't': num_threads = atoi(optarg); break;
 		case 'v': verbose = 1; break;
 		}
@@ -278,15 +268,16 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 	if (priority < 0 || priority > 99)
 		error = 1;
 
-	if (num_threads == -1)
-		num_threads = get_available_cpus(affinity_mask);
+	if (smp) {
+		if (affinity_mask)
+			warn("--affinity overwrites smp mode\n");
+		else
+			num_threads = get_available_cpus(affinity_mask);
+	}
 
 	if (num_threads < 2)
 		error = 1;
 
-	if (smp && affinity_mask)
-		warn("-a ignored due to smp mode\n");
-
 	if (error) {
 		if (affinity_mask)
 			numa_bitmask_free(affinity_mask);
-- 
2.30.0


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

* [PATCH rt-tests v4 06/16] rt-numa: Remove unused definitions and numa_initialize()
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (4 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 05/16] signaltest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 07/16] rt-numa: Add generic cpu_for_thread() helper Daniel Wagner
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

There is no user left of the AFFINITY_* enum. Remove them.

Also there is no need for numa_initialize() to prodect from being
called several times. We can safely initialize libnuma at the begin of
each program.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c |  2 +-
 src/include/rt-numa.h       |  8 --------
 src/lib/rt-numa.c           | 15 ---------------
 src/signaltest/signaltest.c |  2 +-
 4 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index b5cca3ae166b..3c6773c1dbb5 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1705,7 +1705,7 @@ int main(int argc, char **argv)
 	void *currstk;
 	size_t stksize;
 
-	if (numa_initialize())
+	if (numa_available() == -1)
 		fatal("Couldn't initialize libnuma");
 
 	process_options(argc, argv, max_cpus);
diff --git a/src/include/rt-numa.h b/src/include/rt-numa.h
index ca86a45dab3a..54f5c3a240e9 100644
--- a/src/include/rt-numa.h
+++ b/src/include/rt-numa.h
@@ -4,14 +4,6 @@
 
 #include <numa.h>
 
-enum {
-	AFFINITY_UNSPECIFIED,
-	AFFINITY_SPECIFIED,
-	AFFINITY_USEALL
-};
-
-int numa_initialize(void);
-
 int get_available_cpus(struct bitmask *cpumask);
 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);
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index 33fddba4358e..fa83eae61084 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -13,21 +13,6 @@
 #include "error.h"
 #include "rt-numa.h"
 
-/* numa_available() must be called before any other calls to the numa library */
-int numa_initialize(void)
-{
-	static int is_initialized;
-
-	if (is_initialized == 1)
-		return 0;
-
-	if (numa_available() == -1)
-		return -1;
-
-	is_initialized = 1;
-	return 0;
-}
-
 int get_available_cpus(struct bitmask *cpumask)
 {
 	if (cpumask)
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 61420fa13347..41ebb2c87a2f 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -322,7 +322,7 @@ int main(int argc, char **argv)
 	int status, cpu;
 	int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 
-	if (numa_initialize())
+	if (numa_available() == -1)
 		fatal("Couldn't initialize libnuma");
 
 	process_options(argc, argv, max_cpus);
-- 
2.30.0


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

* [PATCH rt-tests v4 07/16] rt-numa: Add generic cpu_for_thread() helper
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (5 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 06/16] rt-numa: Remove unused definitions and numa_initialize() Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 08/16] rt-numa: Use mask size for iterator limit Daniel Wagner
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Add an simpler wrapper which calls the right implementation depending
on if the cpumask is valid or not.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c |  6 +-----
 src/include/rt-numa.h       |  3 +--
 src/lib/rt-numa.c           | 13 ++++++++++---
 src/signaltest/signaltest.c |  6 +-----
 4 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 3c6773c1dbb5..4e30abbe6035 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1882,11 +1882,7 @@ int main(int argc, char **argv)
 		if (status != 0)
 			fatal("error from pthread_attr_init for thread %d: %s\n", i, strerror(status));
 
-		if (affinity_mask)
-			cpu = cpu_for_thread_sp(i, max_cpus, affinity_mask);
-		else
-			cpu = cpu_for_thread_ua(i, max_cpus);
-
+		cpu = cpu_for_thread(i, max_cpus, affinity_mask);
 		if (verbose)
 			printf("Thread %d using cpu %d.\n", i, cpu);
 
diff --git a/src/include/rt-numa.h b/src/include/rt-numa.h
index 54f5c3a240e9..189da3a804e1 100644
--- a/src/include/rt-numa.h
+++ b/src/include/rt-numa.h
@@ -5,8 +5,7 @@
 #include <numa.h>
 
 int get_available_cpus(struct bitmask *cpumask);
-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 cpu_for_thread(int thread_num, int max_cpus, struct bitmask *cpumask);
 
 int parse_cpumask(char *str, int max_cpus, struct bitmask **cpumask);
 
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index fa83eae61084..7e99eab60681 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -21,7 +21,7 @@ int get_available_cpus(struct bitmask *cpumask)
 	return numa_num_task_cpus();
 }
 
-int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
+static int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
 {
 	unsigned int m, cpu, i, num_cpus;
 
@@ -44,8 +44,7 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
 	return 0;
 }
 
-/* cpu_for_thread AFFINITY_USEALL */
-int cpu_for_thread_ua(int thread_num, int max_cpus)
+static int cpu_for_thread_ua(int thread_num, int max_cpus)
 {
 	int res, num_cpus, i, m, cpu;
 	pthread_t thread;
@@ -73,6 +72,14 @@ int cpu_for_thread_ua(int thread_num, int max_cpus)
 	return 0;
 }
 
+int cpu_for_thread(int thread_num, int max_cpus, struct bitmask *cpumask)
+{
+	if (cpumask)
+		return cpu_for_thread_sp(thread_num, max_cpus, cpumask);
+	else
+		return cpu_for_thread_ua(thread_num, max_cpus);
+}
+
 /*
  * After this function is called, affinity_mask is the intersection of
  * the user supplied affinity mask and the affinity mask from the run
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 41ebb2c87a2f..2ea5e6b58946 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -373,11 +373,7 @@ int main(int argc, char **argv)
 			par[i].bufmsk = VALBUF_SIZE - 1;
 		}
 
-		if (affinity_mask)
-			cpu = cpu_for_thread_sp(i, max_cpus, affinity_mask);
-		else
-			cpu = cpu_for_thread_ua(i, max_cpus);
-
+		cpu = cpu_for_thread(i, max_cpus, affinity_mask);
 		if (verbose)
 			printf("Thread %d using cpu %d.\n", i, cpu);
 
-- 
2.30.0


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

* [PATCH rt-tests v4 08/16] rt-numa: Use mask size for iterator limit
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (6 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 07/16] rt-numa: Add generic cpu_for_thread() helper Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 09/16] rt-numa: Remove max_cpus argument from parse_cpusmask Daniel Wagner
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

The bitmask structure knows its size use, thus use it as upper limit
in the loop.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/lib/rt-numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index 7e99eab60681..b1bbb8c8052c 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -33,7 +33,7 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpuma
 	m = thread_num % num_cpus;
 
 	/* there are num_cpus bits set, we want position of m'th one */
-	for (i = 0, cpu = 0; i < max_cpus; i++) {
+	for (i = 0, cpu = 0; i < cpumask->size; i++) {
 		if (numa_bitmask_isbitset(cpumask, i)) {
 			if (cpu == m)
 				return i;
@@ -97,7 +97,7 @@ static void use_current_cpuset(int max_cpus, struct bitmask *cpumask)
 	 * Clear bits that are not set in both the cpuset from the
 	 * environment, and in the user specified affinity.
 	 */
-	for (i = 0; i < max_cpus; i++) {
+	for (i = 0; i < cpumask->size; i++) {
 		if ((!numa_bitmask_isbitset(cpumask, i)) ||
 		    (!numa_bitmask_isbitset(curmask, i)))
 			numa_bitmask_clearbit(cpumask, i);
-- 
2.30.0


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

* [PATCH rt-tests v4 09/16] rt-numa: Remove max_cpus argument from parse_cpusmask
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (7 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 08/16] rt-numa: Use mask size for iterator limit Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 10/16] signaltest: Remove unused max_cpus argument from process_options Daniel Wagner
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Remove usused max_cpus argument from parse_cpumask().

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 4 ++--
 src/include/rt-numa.h       | 2 +-
 src/lib/rt-numa.c           | 6 +++---
 src/oslat/oslat.c           | 3 +--
 src/signaltest/signaltest.c | 4 ++--
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 4e30abbe6035..acd456bd4c4d 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1008,12 +1008,12 @@ static void process_options(int argc, char *argv[], int max_cpus)
 		case 'a':
 		case OPT_AFFINITY:
 			if (optarg) {
-				parse_cpumask(optarg, max_cpus, &affinity_mask);
+				parse_cpumask(optarg, &affinity_mask);
 			} else if (optind < argc &&
 				   (atoi(argv[optind]) ||
 				    argv[optind][0] == '0' ||
 				    argv[optind][0] == '!')) {
-				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
+				parse_cpumask(argv[optind], &affinity_mask);
 			}
 			break;
 		case 'A':
diff --git a/src/include/rt-numa.h b/src/include/rt-numa.h
index 189da3a804e1..446ce54a6ba2 100644
--- a/src/include/rt-numa.h
+++ b/src/include/rt-numa.h
@@ -7,6 +7,6 @@
 int get_available_cpus(struct bitmask *cpumask);
 int cpu_for_thread(int thread_num, int max_cpus, struct bitmask *cpumask);
 
-int parse_cpumask(char *str, int max_cpus, struct bitmask **cpumask);
+int parse_cpumask(char *str, struct bitmask **cpumask);
 
 #endif
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index b1bbb8c8052c..3a8441d5151c 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -85,7 +85,7 @@ int cpu_for_thread(int thread_num, int max_cpus, struct bitmask *cpumask)
  * the user supplied affinity mask and the affinity mask from the run
  * time environment
  */
-static void use_current_cpuset(int max_cpus, struct bitmask *cpumask)
+static void use_current_cpuset(struct bitmask *cpumask)
 {
 	struct bitmask *curmask;
 	int i;
@@ -106,7 +106,7 @@ static void use_current_cpuset(int max_cpus, struct bitmask *cpumask)
 	numa_bitmask_free(curmask);
 }
 
-int parse_cpumask(char *str, int max_cpus, struct bitmask **cpumask)
+int parse_cpumask(char *str, struct bitmask **cpumask)
 {
 	struct bitmask *mask;
 
@@ -120,7 +120,7 @@ int parse_cpumask(char *str, int max_cpus, struct bitmask **cpumask)
 		return 0;
 	}
 
-	use_current_cpuset(max_cpus, mask);
+	use_current_cpuset(mask);
 	*cpumask = mask;
 
 	return 0;
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 5b7e0d5b5d5c..0811079d9f04 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -716,7 +716,6 @@ int main(int argc, char *argv[])
 	struct thread *threads;
 	int i, n_cores;
 	struct bitmask *cpu_set = NULL;
-	int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 
 #ifdef FRC_MISSING
 	printf("This architecture is not yet supported. "
@@ -743,7 +742,7 @@ int main(int argc, char *argv[])
 
 	if (!g.cpu_list)
 		g.cpu_list = strdup("all");
-	if (parse_cpumask(g.cpu_list, max_cpus, &cpu_set))
+	if (parse_cpumask(g.cpu_list, &cpu_set))
 		exit(1);
 	n_cores = numa_bitmask_weight(cpu_set);
 
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 2ea5e6b58946..0d189483753d 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -236,12 +236,12 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 		switch (c) {
 		case 'a':
 			if (optarg) {
-				parse_cpumask(optarg, max_cpus, &affinity_mask);
+				parse_cpumask(optarg, &affinity_mask);
 			} else if (optind < argc &&
 				   (atoi(argv[optind]) ||
 				    argv[optind][0] == '0' ||
 				    argv[optind][0] == '!')) {
-				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
+				parse_cpumask(argv[optind], &affinity_mask);
 			}
 
 			if (verbose)
-- 
2.30.0


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

* [PATCH rt-tests v4 10/16] signaltest: Remove unused max_cpus argument from process_options
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (8 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 09/16] rt-numa: Remove max_cpus argument from parse_cpusmask Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 11/16] cyclictest: " Daniel Wagner
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

There is no use of this argument. Remove it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/signaltest/signaltest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 0d189483753d..3ca26fb373bb 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -207,7 +207,7 @@ static int lockall;
 static struct bitmask *affinity_mask = NULL;
 
 /* Process commandline options */
-static void process_options(int argc, char *argv[], unsigned int max_cpus)
+static void process_options(int argc, char *argv[])
 {
 	int error = 0;
 	int smp = 0;
@@ -325,7 +325,7 @@ int main(int argc, char **argv)
 	if (numa_available() == -1)
 		fatal("Couldn't initialize libnuma");
 
-	process_options(argc, argv, max_cpus);
+	process_options(argc, argv);
 
 	if (check_privs())
 		exit(1);
-- 
2.30.0


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

* [PATCH rt-tests v4 11/16] cyclictest: Remove unused max_cpus argument from process_options
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (9 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 10/16] signaltest: Remove unused max_cpus argument from process_options Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 12/16] rt-numa: Use CPU_SETSIZE as upper loop limit Daniel Wagner
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

There is no use of this argument. Remove it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index acd456bd4c4d..366b2aaaa9f8 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -949,7 +949,7 @@ enum option_values {
 };
 
 /* Process commandline options */
-static void process_options(int argc, char *argv[], int max_cpus)
+static void process_options(int argc, char *argv[])
 {
 	int error = 0;
 	int smp = 0;
@@ -1708,7 +1708,7 @@ int main(int argc, char **argv)
 	if (numa_available() == -1)
 		fatal("Couldn't initialize libnuma");
 
-	process_options(argc, argv, max_cpus);
+	process_options(argc, argv);
 
 	if (check_privs())
 		exit(EXIT_FAILURE);
-- 
2.30.0


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

* [PATCH rt-tests v4 12/16] rt-numa: Use CPU_SETSIZE as upper loop limit
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (10 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 11/16] cyclictest: " Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 13/16] rt-numa: Remove used max_cpus argument from cpu_for_thread() Daniel Wagner
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

The cpeset might not be dense, so user the CPU_SETSIZE as upper limit.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/lib/rt-numa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index 3a8441d5151c..45d4f1193d5f 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -60,7 +60,7 @@ static int cpu_for_thread_ua(int thread_num, int max_cpus)
 	num_cpus = CPU_COUNT(&cpuset);
 	m = thread_num % num_cpus;
 
-	for (i = 0, cpu = 0; i < max_cpus; i++) {
+	for (i = 0, cpu = 0; i < CPU_SETSIZE; i++) {
 		if (CPU_ISSET(i, &cpuset)) {
 			if (cpu == m)
 				return i;
-- 
2.30.0


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

* [PATCH rt-tests v4 13/16] rt-numa: Remove used max_cpus argument from cpu_for_thread()
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (11 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 12/16] rt-numa: Use CPU_SETSIZE as upper loop limit Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 14/16] cyclictest: Remove max cpus used verbose information Daniel Wagner
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

There is no need to pass in the max_cpus anymore. Thus remove the
argument.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c |  2 +-
 src/include/rt-numa.h       |  2 +-
 src/lib/rt-numa.c           | 10 +++++-----
 src/signaltest/signaltest.c |  3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 366b2aaaa9f8..7a0501031857 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1882,7 +1882,7 @@ int main(int argc, char **argv)
 		if (status != 0)
 			fatal("error from pthread_attr_init for thread %d: %s\n", i, strerror(status));
 
-		cpu = cpu_for_thread(i, max_cpus, affinity_mask);
+		cpu = cpu_for_thread(i, affinity_mask);
 		if (verbose)
 			printf("Thread %d using cpu %d.\n", i, cpu);
 
diff --git a/src/include/rt-numa.h b/src/include/rt-numa.h
index 446ce54a6ba2..405e57869735 100644
--- a/src/include/rt-numa.h
+++ b/src/include/rt-numa.h
@@ -5,7 +5,7 @@
 #include <numa.h>
 
 int get_available_cpus(struct bitmask *cpumask);
-int cpu_for_thread(int thread_num, int max_cpus, struct bitmask *cpumask);
+int cpu_for_thread(int thread_num, struct bitmask *cpumask);
 
 int parse_cpumask(char *str, struct bitmask **cpumask);
 
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index 45d4f1193d5f..04f2e9adb4b1 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -21,7 +21,7 @@ int get_available_cpus(struct bitmask *cpumask)
 	return numa_num_task_cpus();
 }
 
-static int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
+static int cpu_for_thread_sp(int thread_num, struct bitmask *cpumask)
 {
 	unsigned int m, cpu, i, num_cpus;
 
@@ -44,7 +44,7 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpuma
 	return 0;
 }
 
-static int cpu_for_thread_ua(int thread_num, int max_cpus)
+static int cpu_for_thread_ua(int thread_num)
 {
 	int res, num_cpus, i, m, cpu;
 	pthread_t thread;
@@ -72,12 +72,12 @@ static int cpu_for_thread_ua(int thread_num, int max_cpus)
 	return 0;
 }
 
-int cpu_for_thread(int thread_num, int max_cpus, struct bitmask *cpumask)
+int cpu_for_thread(int thread_num, struct bitmask *cpumask)
 {
 	if (cpumask)
-		return cpu_for_thread_sp(thread_num, max_cpus, cpumask);
+		return cpu_for_thread_sp(thread_num, cpumask);
 	else
-		return cpu_for_thread_ua(thread_num, max_cpus);
+		return cpu_for_thread_ua(thread_num);
 }
 
 /*
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 3ca26fb373bb..5427db7f8d85 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -320,7 +320,6 @@ int main(int argc, char **argv)
 	struct thread_stat *stat;
 	int i, ret = -1;
 	int status, cpu;
-	int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 
 	if (numa_available() == -1)
 		fatal("Couldn't initialize libnuma");
@@ -373,7 +372,7 @@ int main(int argc, char **argv)
 			par[i].bufmsk = VALBUF_SIZE - 1;
 		}
 
-		cpu = cpu_for_thread(i, max_cpus, affinity_mask);
+		cpu = cpu_for_thread(i, affinity_mask);
 		if (verbose)
 			printf("Thread %d using cpu %d.\n", i, cpu);
 
-- 
2.30.0


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

* [PATCH rt-tests v4 14/16] cyclictest: Remove max cpus used verbose information
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (12 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 13/16] rt-numa: Remove used max_cpus argument from cpu_for_thread() Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 15/16] cyclictest: Remove unecessary local variable Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 16/16] rt-tests: Rename error.h to rt-error.h Daniel Wagner
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Since we always print the thread placement in verbose mode now, there
is no need to print the max_cpus anymore. With the last of max_cpus
gone, we can also remove the sysconf() call.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 7a0501031857..8356786a80bb 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1697,8 +1697,6 @@ int main(int argc, char **argv)
 	int signum = SIGALRM;
 	int mode;
 	int cpu;
-	int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
-	int online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 	int i, ret = -1;
 	int status;
 	void *stack;
@@ -1713,11 +1711,6 @@ int main(int argc, char **argv)
 	if (check_privs())
 		exit(EXIT_FAILURE);
 
-	if (verbose) {
-		printf("Max CPUs = %d\n", max_cpus);
-		printf("Online CPUs = %d\n", online_cpus);
-	}
-
 	/* Restrict the main pid to the affinity specified by the user */
 	if (affinity_mask) {
 		int res;
@@ -1726,10 +1719,6 @@ int main(int argc, char **argv)
 		res = numa_sched_setaffinity(getpid(), affinity_mask);
 		if (res != 0)
 			warn("Couldn't setaffinity in main thread: %s\n", strerror(errno));
-
-		if (verbose)
-			printf("Using %u cpus.\n",
-				numa_bitmask_weight(affinity_mask));
 	}
 
 	if (trigger) {
-- 
2.30.0


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

* [PATCH rt-tests v4 15/16] cyclictest: Remove unecessary local variable
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (13 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 14/16] cyclictest: Remove max cpus used verbose information Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-10 13:34 ` [PATCH rt-tests v4 16/16] rt-tests: Rename error.h to rt-error.h Daniel Wagner
  15 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

The return value is not used, thus we can avoid the unussed local
variable.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 8356786a80bb..f912bcf82def 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1713,18 +1713,13 @@ int main(int argc, char **argv)
 
 	/* Restrict the main pid to the affinity specified by the user */
 	if (affinity_mask) {
-		int res;
-
 		errno = 0;
-		res = numa_sched_setaffinity(getpid(), affinity_mask);
-		if (res != 0)
+		if (numa_sched_setaffinity(getpid(), affinity_mask) != 0)
 			warn("Couldn't setaffinity in main thread: %s\n", strerror(errno));
 	}
 
 	if (trigger) {
-		int retval;
-		retval = trigger_init();
-		if (retval != 0) {
+		if (trigger_init() != 0) {
 			fprintf(stderr, "trigger_init() failed\n");
 			exit(EXIT_FAILURE);
 		}
-- 
2.30.0


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

* [PATCH rt-tests v4 16/16] rt-tests: Rename error.h to rt-error.h
  2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
                   ` (14 preceding siblings ...)
  2021-02-10 13:34 ` [PATCH rt-tests v4 15/16] cyclictest: Remove unecessary local variable Daniel Wagner
@ 2021-02-10 13:34 ` Daniel Wagner
  2021-02-17  3:50   ` John Kacur
  15 siblings, 1 reply; 22+ messages in thread
From: Daniel Wagner @ 2021-02-10 13:34 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Avoid confusion with the system header called error.h.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 Makefile                            | 2 +-
 src/cyclictest/cyclictest.c         | 2 +-
 src/include/pip_stress.h            | 5 +++--
 src/include/{error.h => rt-error.h} | 0
 src/lib/{error.c => rt-error.c}     | 2 +-
 src/lib/rt-numa.c                   | 2 +-
 src/lib/rt-utils.c                  | 3 ++-
 src/oslat/oslat.c                   | 2 +-
 src/pi_tests/pi_stress.c            | 3 +--
 src/pmqtest/pmqtest.c               | 6 +++---
 src/ptsematest/ptsematest.c         | 6 +++---
 src/sched_deadline/cyclicdeadline.c | 6 +++---
 src/signaltest/signaltest.c         | 2 +-
 src/sigwaittest/sigwaittest.c       | 2 +-
 src/svsematest/svsematest.c         | 3 ++-
 15 files changed, 24 insertions(+), 22 deletions(-)
 rename src/include/{error.h => rt-error.h} (100%)
 rename src/lib/{error.c => rt-error.c} (98%)

diff --git a/Makefile b/Makefile
index 636f1914a777..b17ac0957adc 100644
--- a/Makefile
+++ b/Makefile
@@ -177,7 +177,7 @@ oslat: $(OBJDIR)/oslat.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
 %.8.bz2: %.8
 	bzip2 -c $< > $@
 
-LIBOBJS =$(addprefix $(OBJDIR)/,error.o rt-get_cpu.o rt-sched.o rt-utils.o)
+LIBOBJS =$(addprefix $(OBJDIR)/,rt-error.o rt-get_cpu.o rt-sched.o rt-utils.o)
 $(OBJDIR)/librttest.a: $(LIBOBJS)
 	$(AR) rcs $@ $^
 
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index f912bcf82def..c4b2369bee6b 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -36,7 +36,7 @@
 
 #include "rt-utils.h"
 #include "rt-numa.h"
-#include "error.h"
+#include "rt-error.h"
 
 #include <bionic.h>
 
diff --git a/src/include/pip_stress.h b/src/include/pip_stress.h
index ee8b545ab117..f03aaf397897 100644
--- a/src/include/pip_stress.h
+++ b/src/include/pip_stress.h
@@ -14,8 +14,9 @@
 #include <sys/wait.h>
 #include <signal.h>
 #include <sched.h>
-#include <rt-utils.h>
-#include "error.h"
+
+#include "rt-utils.h"
+#include "rt-error.h"
 
 void low(pid_t pid);	/* low priority process */
 void medium(void);	/* medium priority process */
diff --git a/src/include/error.h b/src/include/rt-error.h
similarity index 100%
rename from src/include/error.h
rename to src/include/rt-error.h
diff --git a/src/lib/error.c b/src/lib/rt-error.c
similarity index 98%
rename from src/lib/error.c
rename to src/lib/rt-error.c
index 4434a842da17..616f70b044e0 100644
--- a/src/lib/error.c
+++ b/src/lib/rt-error.c
@@ -5,7 +5,7 @@
  * error routines, similar to those found in
  * Advanced Programming in the UNIX Environment 2nd ed.
  */
-#include "error.h"
+#include "rt-error.h"
 
 /* Print an error message, plus a message for err and exit with error err */
 void err_exit(int err, char *fmt, ...)
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index 04f2e9adb4b1..4a0865715141 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -10,7 +10,7 @@
 #include <sched.h>
 #include <pthread.h>
 
-#include "error.h"
+#include "rt-error.h"
 #include "rt-numa.h"
 
 int get_available_cpus(struct bitmask *cpumask)
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index 2d68d62cd875..321a11b1172d 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -20,9 +20,10 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <sys/syscall.h> /* For SYS_gettid definitions */
+
 #include "rt-utils.h"
 #include "rt-sched.h"
-#include "error.h"
+#include "rt-error.h"
 
 #define  TRACEBUFSIZ  1024
 
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 0811079d9f04..9e6f70600830 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -43,7 +43,7 @@
 
 #include "rt-utils.h"
 #include "rt-numa.h"
-#include "error.h"
+#include "rt-error.h"
 
 #ifdef __GNUC__
 # define atomic_inc(ptr)   __sync_add_and_fetch((ptr), 1)
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 538d12c975aa..49f89b7b0136 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -47,8 +47,7 @@
 
 #include "rt-sched.h"
 #include "rt-utils.h"
-
-#include "error.h"
+#include "rt-error.h"
 
 /* test timeout */
 #define TIMEOUT 2
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index 5f7a24d55db6..349b47741003 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -21,11 +21,11 @@
 #include <linux/unistd.h>
 #include <utmpx.h>
 #include <mqueue.h>
+#include <pthread.h>
+
 #include "rt-utils.h"
 #include "rt-get_cpu.h"
-#include "error.h"
-
-#include <pthread.h>
+#include "rt-error.h"
 
 #define SYNCMQ_NAME "/syncmsg%d"
 #define TESTMQ_NAME "/testmsg%d"
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index f8f075591f4b..7d4ca97773d6 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -19,11 +19,11 @@
 #include <sys/mman.h>
 #include <linux/unistd.h>
 #include <utmpx.h>
+#include <pthread.h>
+
 #include "rt-utils.h"
 #include "rt-get_cpu.h"
-#include "error.h"
-
-#include <pthread.h>
+#include "rt-error.h"
 
 enum {
 	AFFINITY_UNSPECIFIED,
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 6dcfd6074085..71cde5781499 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -30,9 +30,9 @@
 #include <linux/unistd.h>
 #include <linux/magic.h>
 
-#include <rt-utils.h>
-#include <rt-sched.h>
-#include <error.h>
+#include "rt-utils.h"
+#include "rt-sched.h"
+#include "rt-error.h"
 
 #define _STR(x) #x
 #define STR(x) _STR(x)
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 5427db7f8d85..c34bc994d886 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -31,7 +31,7 @@
 #include <sys/time.h>
 #include <sys/mman.h>
 
-#include "error.h"
+#include "rt-error.h"
 #include "rt-utils.h"
 #include "rt-numa.h"
 
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 7e287bd2424f..f10c24914d4a 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -42,7 +42,7 @@
 
 #include "rt-utils.h"
 #include "rt-get_cpu.h"
-#include "error.h"
+#include "rt-error.h"
 
 enum {
 	AFFINITY_UNSPECIFIED,
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 7388efb3f488..7a298e0dea8c 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -28,9 +28,10 @@
 #include <sys/sem.h>
 #include <sys/time.h>
 #include <sys/mman.h>
+
 #include "rt-utils.h"
 #include "rt-get_cpu.h"
-#include "error.h"
+#include "rt-error.h"
 
 #define SEM_WAIT_FOR_RECEIVER 0
 #define SEM_WAIT_FOR_SENDER 1
-- 
2.30.0


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

* Re: [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic
  2021-02-10 13:34 ` [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
@ 2021-02-15  4:06   ` Punit Agrawal
  2021-02-15  9:00     ` Daniel Wagner
  0 siblings, 1 reply; 22+ messages in thread
From: Punit Agrawal @ 2021-02-15  4:06 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, John Kacur, linux-rt-users

Hi Daniel,

Spotted one typo below while browsing through the patches.

Daniel Wagner <dwagner@suse.de> writes:

> Allow each command line only to update one variable and do the final
> decission at the end of the parsing step. With this the order
  ^
  decision

Regards,
Punit

> of the command line is not important.
>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c | 34 ++++++++--------------------------
>  1 file changed, 8 insertions(+), 26 deletions(-)
>
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 4c02f067fbad..b5cca3ae166b 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -880,14 +880,13 @@ static int timermode = TIMER_ABSTIME;
>  static int use_system;
>  static int priority;
>  static int policy = SCHED_OTHER;	/* default policy if not specified */
> -static int num_threads = 1;
> +static int num_threads = -1;
>  static int max_cycles;
>  static int clocksel = 0;
>  static int quiet;
>  static int interval = DEFAULT_INTERVAL;
>  static int distance = -1;
>  static struct bitmask *affinity_mask = NULL;
> -static int smp = 0;
>  
>  static int clocksources[] = {
>  	CLOCK_MONOTONIC,
> @@ -953,7 +952,7 @@ enum option_values {
>  static void process_options(int argc, char *argv[], int max_cpus)
>  {
>  	int error = 0;
> -	int option_affinity = 0;
> +	int smp = 0;
>  
>  	for (;;) {
>  		int option_index = 0;
> @@ -1008,10 +1007,6 @@ static void process_options(int argc, char *argv[], int max_cpus)
>  		switch (c) {
>  		case 'a':
>  		case OPT_AFFINITY:
> -			option_affinity = 1;
> -			/* smp sets AFFINITY_USEALL in OPT_SMP */
> -			if (smp)
> -				break;
>  			if (optarg) {
>  				parse_cpumask(optarg, max_cpus, &affinity_mask);
>  			} else if (optind < argc &&
> @@ -1019,8 +1014,6 @@ static void process_options(int argc, char *argv[], int max_cpus)
>  				    argv[optind][0] == '0' ||
>  				    argv[optind][0] == '!')) {
>  				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
> -			} else {
> -				num_threads = -1;
>  			}
>  			break;
>  		case 'A':
> @@ -1108,22 +1101,14 @@ static void process_options(int argc, char *argv[], int max_cpus)
>  		case OPT_SYSTEM:
>  			use_system = MODE_SYS_OFFSET; break;
>  		case 'S':
> -		case OPT_SMP: /* SMP testing */
> -			smp = 1;
> -			num_threads = -1; /* update after parsing */
> -			break;
> +		case OPT_SMP:
> +			smp = 1; break;
>  		case 't':
>  		case OPT_THREADS:
> -			if (smp) {
> -				warn("-t ignored due to smp mode\n");
> -				break;
> -			}
>  			if (optarg != NULL)
>  				num_threads = atoi(optarg);
>  			else if (optind < argc && atoi(argv[optind]))
>  				num_threads = atoi(argv[optind]);
> -			else
> -				num_threads = -1; /* update after parsing */
>  			break;
>  		case OPT_TRIGGER:
>  			trigger = atoi(optarg);
> @@ -1179,13 +1164,10 @@ static void process_options(int argc, char *argv[], int max_cpus)
>  		use_nanosleep = MODE_CLOCK_NANOSLEEP;
>  	}
>  
> -	if (option_affinity && smp) {
> -		warn("-a ignored due to smp mode\n");
> -		if (affinity_mask) {
> -			numa_bitmask_free(affinity_mask);
> -			affinity_mask = NULL;
> -		}
> -	}
> +	if (smp && num_threads != -1)
> +		warn("--threads overwrites smp mode\n");
> +	if (smp && affinity_mask)
> +		warn("--affinity overwrites smp mode\n");
>  
>  	if (smi) {
>  		if (affinity_mask)

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

* Re: [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic
  2021-02-15  4:06   ` Punit Agrawal
@ 2021-02-15  9:00     ` Daniel Wagner
  0 siblings, 0 replies; 22+ messages in thread
From: Daniel Wagner @ 2021-02-15  9:00 UTC (permalink / raw)
  To: Punit Agrawal; +Cc: Clark Williams, John Kacur, linux-rt-users

Hi Punit,

On Mon, Feb 15, 2021 at 01:06:52PM +0900, Punit Agrawal wrote:
> Spotted one typo below while browsing through the patches.

Thanks, fixed the two commit message up.
Daniel

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

* Re: [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly
  2021-02-10 13:34 ` [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly Daniel Wagner
@ 2021-02-17  3:49   ` John Kacur
  0 siblings, 0 replies; 22+ messages in thread
From: John Kacur @ 2021-02-17  3:49 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Wed, 10 Feb 2021, Daniel Wagner wrote:

> There is no need for small libnuma wrappers functions as we always
> use libnuma. Remove them and get rid of rt_numa.h, so there is
> no confusion with rt-numa.h anymore.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c | 43 +++++++++--------
>  src/cyclictest/rt_numa.h    | 96 -------------------------------------
>  2 files changed, 24 insertions(+), 115 deletions(-)
>  delete mode 100644 src/cyclictest/rt_numa.h
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 99846e78526f..6009ff2a83bc 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -33,10 +33,10 @@
>  #include <sys/utsname.h>
>  #include <sys/mman.h>
>  #include <sys/syscall.h>
> -#include "rt_numa.h"
>  
>  #include "rt-utils.h"
>  #include "rt-numa.h"
> +#include "error.h"
>  
>  #include <bionic.h>
>  
> @@ -514,9 +514,9 @@ static void *timerthread(void *param)
>  
>  	memset(&stop, 0, sizeof(stop));
>  
> -	/* if we're running in numa mode, set our memory node */
> -	if (par->node != -1)
> -		rt_numa_set_numa_run_on_node(par->node, par->cpu);
> +	if (numa_run_on_node(par->node))
> +		warn("Could not set NUMA node %d for thread %d: %s\n",
> +				par->node, par->cpu, strerror(errno));
>  
>  	if (par->cpu != -1) {
>  		CPU_ZERO(&mask);
> @@ -1251,7 +1251,7 @@ static void process_options(int argc, char *argv[], int max_cpus)
>  	}
>  	if (error) {
>  		if (affinity_mask)
> -			rt_bitmask_free(affinity_mask);
> +			numa_bitmask_free(affinity_mask);
>  		display_help(1);
>  	}
>  }
> @@ -1907,7 +1907,9 @@ int main(int argc, char **argv)
>  			printf("Thread %d using cpu %d.\n", i, cpu);
>  
>  		/* find the memory node associated with the cpu i */
> -		node = rt_numa_numa_node_of_cpu(cpu);
> +		node = numa_node_of_cpu(cpu);
> +		if (node == -1)
> +			fatal("Invalid NUMA node selected via affinity mask\n");
>  
>  		/* get the stack size set for this thread */
>  		if (pthread_attr_getstack(&attr, &currstk, &stksize))
> @@ -1918,7 +1920,10 @@ 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 = numa_alloc_onnode(stksize, node);
> +		if (!stack)
> +			fatal("failed to allocate %d bytes on node %d for cpu %d\n",
> +				stksize, node, cpu);
>  
>  		/* touch the stack pages to pre-fault them in */
>  		memset(stack, 0, stksize);
> @@ -1929,13 +1934,13 @@ int main(int argc, char **argv)
>  				i, stack+stksize);
>  
>  		/* allocate the thread's parameter block  */
> -		parameters[i] = par = threadalloc(sizeof(struct thread_param), node);
> +		parameters[i] = par = numa_alloc_onnode(sizeof(struct thread_param), node);
>  		if (par == NULL)
>  			fatal("error allocating thread_param struct for thread %d\n", i);
>  		memset(par, 0, sizeof(struct thread_param));
>  
>  		/* allocate the thread's statistics block */
> -		statistics[i] = stat = threadalloc(sizeof(struct thread_stat), node);
> +		statistics[i] = stat = numa_alloc_onnode(sizeof(struct thread_stat), node);
>  		if (stat == NULL)
>  			fatal("error allocating thread status struct for thread %d\n", i);
>  		memset(stat, 0, sizeof(struct thread_stat));
> @@ -1944,8 +1949,8 @@ int main(int argc, char **argv)
>  		if (histogram) {
>  			int bufsize = histogram * sizeof(long);
>  
> -			stat->hist_array = threadalloc(bufsize, node);
> -			stat->outliers = threadalloc(bufsize, node);
> +			stat->hist_array = numa_alloc_onnode(bufsize, node);
> +			stat->outliers = numa_alloc_onnode(bufsize, node);
>  			if (stat->hist_array == NULL || stat->outliers == NULL)
>  				fatal("failed to allocate histogram of size %d on node %d\n",
>  				      histogram, i);
> @@ -1955,14 +1960,14 @@ int main(int argc, char **argv)
>  
>  		if (verbose) {
>  			int bufsize = VALBUF_SIZE * sizeof(long);
> -			stat->values = threadalloc(bufsize, node);
> +			stat->values = numa_alloc_onnode(bufsize, node);
>  			if (!stat->values)
>  				goto outall;
>  			memset(stat->values, 0, bufsize);
>  			par->bufmsk = VALBUF_SIZE - 1;
>  			if (smi) {
>  				int bufsize = VALBUF_SIZE * sizeof(long);
> -				stat->smis = threadalloc(bufsize, node);
> +				stat->smis = numa_alloc_onnode(bufsize, node);
>  				if (!stat->smis)
>  					goto outall;
>  				memset(stat->smis, 0, bufsize);
> @@ -2077,7 +2082,7 @@ int main(int argc, char **argv)
>  				print_stat(stdout, parameters[i], i, 0, 0);
>  		}
>  		if (statistics[i]->values)
> -			threadfree(statistics[i]->values, VALBUF_SIZE*sizeof(long), parameters[i]->node);
> +			numa_free(statistics[i]->values, VALBUF_SIZE*sizeof(long));
>  	}
>  
>  	if (trigger)
> @@ -2086,8 +2091,8 @@ int main(int argc, char **argv)
>  	if (histogram) {
>  		print_hist(parameters, num_threads);
>  		for (i = 0; i < num_threads; i++) {
> -			threadfree(statistics[i]->hist_array, histogram*sizeof(long), parameters[i]->node);
> -			threadfree(statistics[i]->outliers, histogram*sizeof(long), parameters[i]->node);
> +			numa_free(statistics[i]->hist_array, histogram*sizeof(long));
> +			numa_free(statistics[i]->outliers, histogram*sizeof(long));
>  		}
>  	}
>  
> @@ -2103,14 +2108,14 @@ int main(int argc, char **argv)
>  	for (i=0; i < num_threads; i++) {
>  		if (!statistics[i])
>  			continue;
> -		threadfree(statistics[i], sizeof(struct thread_stat), parameters[i]->node);
> +		numa_free(statistics[i], sizeof(struct thread_stat));
>  	}
>  
>   outpar:
>  	for (i = 0; i < num_threads; i++) {
>  		if (!parameters[i])
>  			continue;
> -		threadfree(parameters[i], sizeof(struct thread_param), parameters[i]->node);
> +		numa_free(parameters[i], sizeof(struct thread_param));
>  	}
>   out:
>  	/* close any tracer file descriptors */
> @@ -2125,7 +2130,7 @@ int main(int argc, char **argv)
>  		close(latency_target_fd);
>  
>  	if (affinity_mask)
> -		rt_bitmask_free(affinity_mask);
> +		numa_bitmask_free(affinity_mask);
>  
>  	/* Remove running status shared memory file if it exists */
>  	if (rstat_fd >= 0)
> diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
> deleted file mode 100644
> index 8d02f419ed6d..000000000000
> --- a/src/cyclictest/rt_numa.h
> +++ /dev/null
> @@ -1,96 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * A numa library for cyclictest.
> - *
> - * (C) 2010 John Kacur <jkacur@redhat.com>
> - * (C) 2010 Clark Williams <williams@redhat.com>
> - *
> - */
> -
> -#ifndef _RT_NUMA_H
> -#define _RT_NUMA_H
> -
> -#include "rt-utils.h"
> -#include "error.h"
> -
> -#include <numa.h>
> -
> -static void *
> -threadalloc(size_t size, int node)
> -{
> -	if (node == -1)
> -		return malloc(size);
> -	return numa_alloc_onnode(size, node);
> -}
> -
> -static void
> -threadfree(void *ptr, size_t size, int node)
> -{
> -	if (node == -1)
> -		free(ptr);
> -	else
> -		numa_free(ptr, size);
> -}
> -
> -static void rt_numa_set_numa_run_on_node(int node, int cpu)
> -{
> -	int res;
> -	res = numa_run_on_node(node);
> -	if (res)
> -		warn("Could not set NUMA node %d for thread %d: %s\n",
> -				node, cpu, strerror(errno));
> -	return;
> -}
> -
> -static void *rt_numa_numa_alloc_onnode(size_t size, int node, int cpu)
> -{
> -	void *stack;
> -	stack = numa_alloc_onnode(size, node);
> -	if (stack == NULL)
> -		fatal("failed to allocate %d bytes on node %d for cpu %d\n",
> -				size, node, cpu);
> -	return stack;
> -}
> -
> -/*
> - * Use new bit mask CPU affinity behavior
> - */
> -static int rt_numa_numa_node_of_cpu(int cpu)
> -{
> -	int node;
> -	node = numa_node_of_cpu(cpu);
> -	if (node == -1)
> -		fatal("invalid cpu passed to numa_node_of_cpu(%d)\n", cpu);
> -	return node;
> -}
> -
> -static inline unsigned int rt_numa_bitmask_isbitset( const struct bitmask *mask,
> -	unsigned long i)
> -{
> -	return numa_bitmask_isbitset(mask,i);
> -}
> -
> -static inline struct bitmask* rt_numa_parse_cpustring(const char* s,
> -	int max_cpus)
> -{
> -	return numa_parse_cpustring_all(s);
> -}
> -
> -static inline void rt_bitmask_free(struct bitmask *mask)
> -{
> -	numa_bitmask_free(mask);
> -}
> -
> -/** Returns number of bits set in mask. */
> -static inline unsigned int rt_numa_bitmask_count(const struct bitmask *mask)
> -{
> -	unsigned int num_bits = 0, i;
> -	for (i = 0; i < mask->size; i++) {
> -		if (rt_numa_bitmask_isbitset(mask, i))
> -			num_bits++;
> -	}
> -	/* Could stash this instead of recomputing every time. */
> -	return num_bits;
> -}
> -
> -#endif	/* _RT_NUMA_H */
> -- 
> 2.30.0
> 
> 

I don't want to do this right now until we figure out the future of 
rt_numa.h

Using rt_numa.h is not harmful, and in fact using the numa api directly
increases the code size in cyclictest.

We can revisit this later, but I don't want it to hold up the JSON stuff 
anymore.

Thanks

John

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

* Re: [PATCH rt-tests v4 02/16] cyclictest: Mimic --smp behavior with --affinity
  2021-02-10 13:34 ` [PATCH rt-tests v4 02/16] cyclictest: Mimic --smp behavior with --affinity Daniel Wagner
@ 2021-02-17  3:49   ` John Kacur
  0 siblings, 0 replies; 22+ messages in thread
From: John Kacur @ 2021-02-17  3:49 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Wed, 10 Feb 2021, Daniel Wagner wrote:

> Let --affinity without an argument behave in the same way as
> --smp. Run a thread on each CPU. This makes cyclictest behave as the
> rest of the rt-tests when --affinity is used.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 6009ff2a83bc..4c02f067fbad 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1019,6 +1019,8 @@ static void process_options(int argc, char *argv[], int max_cpus)
>  				    argv[optind][0] == '0' ||
>  				    argv[optind][0] == '!')) {
>  				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
> +			} else {
> +				num_threads = -1;
>  			}
>  			break;
>  		case 'A':
> -- 
> 2.30.0
> 
> 

This doesn't look right. num_threads = -1 will get the number of cpus 
after parsing, so that's okay, it should imply use all available cpus,
and also the priorities of all threads are the same.

As I've explained though, I'm not ready to drop the possibility to compile
without numa, and then we need to think what this implies to the smp 
option. I do like the way you are simplifying things here, we maybe able
to drop smp altogether in the future, or have it just an option that keeps 
the priorities the same.

Need to look at it more, not applying right now. I want to get the JSON 
code applied, this stuff is holding it up.

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

* Re: [PATCH rt-tests v4 16/16] rt-tests: Rename error.h to rt-error.h
  2021-02-10 13:34 ` [PATCH rt-tests v4 16/16] rt-tests: Rename error.h to rt-error.h Daniel Wagner
@ 2021-02-17  3:50   ` John Kacur
  0 siblings, 0 replies; 22+ messages in thread
From: John Kacur @ 2021-02-17  3:50 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Wed, 10 Feb 2021, Daniel Wagner wrote:

> Avoid confusion with the system header called error.h.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  Makefile                            | 2 +-
>  src/cyclictest/cyclictest.c         | 2 +-
>  src/include/pip_stress.h            | 5 +++--
>  src/include/{error.h => rt-error.h} | 0
>  src/lib/{error.c => rt-error.c}     | 2 +-
>  src/lib/rt-numa.c                   | 2 +-
>  src/lib/rt-utils.c                  | 3 ++-
>  src/oslat/oslat.c                   | 2 +-
>  src/pi_tests/pi_stress.c            | 3 +--
>  src/pmqtest/pmqtest.c               | 6 +++---
>  src/ptsematest/ptsematest.c         | 6 +++---
>  src/sched_deadline/cyclicdeadline.c | 6 +++---
>  src/signaltest/signaltest.c         | 2 +-
>  src/sigwaittest/sigwaittest.c       | 2 +-
>  src/svsematest/svsematest.c         | 3 ++-
>  15 files changed, 24 insertions(+), 22 deletions(-)
>  rename src/include/{error.h => rt-error.h} (100%)
>  rename src/lib/{error.c => rt-error.c} (98%)
> 
> diff --git a/Makefile b/Makefile
> index 636f1914a777..b17ac0957adc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -177,7 +177,7 @@ oslat: $(OBJDIR)/oslat.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
>  %.8.bz2: %.8
>  	bzip2 -c $< > $@
>  
> -LIBOBJS =$(addprefix $(OBJDIR)/,error.o rt-get_cpu.o rt-sched.o rt-utils.o)
> +LIBOBJS =$(addprefix $(OBJDIR)/,rt-error.o rt-get_cpu.o rt-sched.o rt-utils.o)
>  $(OBJDIR)/librttest.a: $(LIBOBJS)
>  	$(AR) rcs $@ $^
>  
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index f912bcf82def..c4b2369bee6b 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -36,7 +36,7 @@
>  
>  #include "rt-utils.h"
>  #include "rt-numa.h"
> -#include "error.h"
> +#include "rt-error.h"
>  
>  #include <bionic.h>
>  
> diff --git a/src/include/pip_stress.h b/src/include/pip_stress.h
> index ee8b545ab117..f03aaf397897 100644
> --- a/src/include/pip_stress.h
> +++ b/src/include/pip_stress.h
> @@ -14,8 +14,9 @@
>  #include <sys/wait.h>
>  #include <signal.h>
>  #include <sched.h>
> -#include <rt-utils.h>
> -#include "error.h"
> +
> +#include "rt-utils.h"
> +#include "rt-error.h"
>  
>  void low(pid_t pid);	/* low priority process */
>  void medium(void);	/* medium priority process */
> diff --git a/src/include/error.h b/src/include/rt-error.h
> similarity index 100%
> rename from src/include/error.h
> rename to src/include/rt-error.h
> diff --git a/src/lib/error.c b/src/lib/rt-error.c
> similarity index 98%
> rename from src/lib/error.c
> rename to src/lib/rt-error.c
> index 4434a842da17..616f70b044e0 100644
> --- a/src/lib/error.c
> +++ b/src/lib/rt-error.c
> @@ -5,7 +5,7 @@
>   * error routines, similar to those found in
>   * Advanced Programming in the UNIX Environment 2nd ed.
>   */
> -#include "error.h"
> +#include "rt-error.h"
>  
>  /* Print an error message, plus a message for err and exit with error err */
>  void err_exit(int err, char *fmt, ...)
> diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
> index 04f2e9adb4b1..4a0865715141 100644
> --- a/src/lib/rt-numa.c
> +++ b/src/lib/rt-numa.c
> @@ -10,7 +10,7 @@
>  #include <sched.h>
>  #include <pthread.h>
>  
> -#include "error.h"
> +#include "rt-error.h"
>  #include "rt-numa.h"
>  
>  int get_available_cpus(struct bitmask *cpumask)
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index 2d68d62cd875..321a11b1172d 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -20,9 +20,10 @@
>  #include <sys/stat.h>
>  #include <unistd.h>
>  #include <sys/syscall.h> /* For SYS_gettid definitions */
> +
>  #include "rt-utils.h"
>  #include "rt-sched.h"
> -#include "error.h"
> +#include "rt-error.h"
>  
>  #define  TRACEBUFSIZ  1024
>  
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index 0811079d9f04..9e6f70600830 100644
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -43,7 +43,7 @@
>  
>  #include "rt-utils.h"
>  #include "rt-numa.h"
> -#include "error.h"
> +#include "rt-error.h"
>  
>  #ifdef __GNUC__
>  # define atomic_inc(ptr)   __sync_add_and_fetch((ptr), 1)
> diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
> index 538d12c975aa..49f89b7b0136 100644
> --- a/src/pi_tests/pi_stress.c
> +++ b/src/pi_tests/pi_stress.c
> @@ -47,8 +47,7 @@
>  
>  #include "rt-sched.h"
>  #include "rt-utils.h"
> -
> -#include "error.h"
> +#include "rt-error.h"
>  
>  /* test timeout */
>  #define TIMEOUT 2
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index 5f7a24d55db6..349b47741003 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -21,11 +21,11 @@
>  #include <linux/unistd.h>
>  #include <utmpx.h>
>  #include <mqueue.h>
> +#include <pthread.h>
> +
>  #include "rt-utils.h"
>  #include "rt-get_cpu.h"
> -#include "error.h"
> -
> -#include <pthread.h>
> +#include "rt-error.h"
>  
>  #define SYNCMQ_NAME "/syncmsg%d"
>  #define TESTMQ_NAME "/testmsg%d"
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index f8f075591f4b..7d4ca97773d6 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -19,11 +19,11 @@
>  #include <sys/mman.h>
>  #include <linux/unistd.h>
>  #include <utmpx.h>
> +#include <pthread.h>
> +
>  #include "rt-utils.h"
>  #include "rt-get_cpu.h"
> -#include "error.h"
> -
> -#include <pthread.h>
> +#include "rt-error.h"
>  
>  enum {
>  	AFFINITY_UNSPECIFIED,
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 6dcfd6074085..71cde5781499 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -30,9 +30,9 @@
>  #include <linux/unistd.h>
>  #include <linux/magic.h>
>  
> -#include <rt-utils.h>
> -#include <rt-sched.h>
> -#include <error.h>
> +#include "rt-utils.h"
> +#include "rt-sched.h"
> +#include "rt-error.h"
>  
>  #define _STR(x) #x
>  #define STR(x) _STR(x)
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 5427db7f8d85..c34bc994d886 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -31,7 +31,7 @@
>  #include <sys/time.h>
>  #include <sys/mman.h>
>  
> -#include "error.h"
> +#include "rt-error.h"
>  #include "rt-utils.h"
>  #include "rt-numa.h"
>  
> diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
> index 7e287bd2424f..f10c24914d4a 100644
> --- a/src/sigwaittest/sigwaittest.c
> +++ b/src/sigwaittest/sigwaittest.c
> @@ -42,7 +42,7 @@
>  
>  #include "rt-utils.h"
>  #include "rt-get_cpu.h"
> -#include "error.h"
> +#include "rt-error.h"
>  
>  enum {
>  	AFFINITY_UNSPECIFIED,
> diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
> index 7388efb3f488..7a298e0dea8c 100644
> --- a/src/svsematest/svsematest.c
> +++ b/src/svsematest/svsematest.c
> @@ -28,9 +28,10 @@
>  #include <sys/sem.h>
>  #include <sys/time.h>
>  #include <sys/mman.h>
> +
>  #include "rt-utils.h"
>  #include "rt-get_cpu.h"
> -#include "error.h"
> +#include "rt-error.h"
>  
>  #define SEM_WAIT_FOR_RECEIVER 0
>  #define SEM_WAIT_FOR_SENDER 1
> -- 
> 2.30.0
> 
> 
   - Fixed a conflict in cyclictest.c
    - Fixed up rt_numa.h
    Signed-off-by: John Kacur <jkacur@redhat.com>



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

end of thread, other threads:[~2021-02-17  3:51 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 13:34 [PATCH rt-tests v4 00/16] rt-numa.h cleanups Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 01/16] cyclictest: Use numa API directly Daniel Wagner
2021-02-17  3:49   ` John Kacur
2021-02-10 13:34 ` [PATCH rt-tests v4 02/16] cyclictest: Mimic --smp behavior with --affinity Daniel Wagner
2021-02-17  3:49   ` John Kacur
2021-02-10 13:34 ` [PATCH rt-tests v4 03/16] cyclictest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
2021-02-15  4:06   ` Punit Agrawal
2021-02-15  9:00     ` Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 04/16] signaltest: Use affinity_mask for steering thread placement Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 05/16] signaltest: Simplify --smp vs --affinity vs --threads argument logic Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 06/16] rt-numa: Remove unused definitions and numa_initialize() Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 07/16] rt-numa: Add generic cpu_for_thread() helper Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 08/16] rt-numa: Use mask size for iterator limit Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 09/16] rt-numa: Remove max_cpus argument from parse_cpusmask Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 10/16] signaltest: Remove unused max_cpus argument from process_options Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 11/16] cyclictest: " Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 12/16] rt-numa: Use CPU_SETSIZE as upper loop limit Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 13/16] rt-numa: Remove used max_cpus argument from cpu_for_thread() Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 14/16] cyclictest: Remove max cpus used verbose information Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 15/16] cyclictest: Remove unecessary local variable Daniel Wagner
2021-02-10 13:34 ` [PATCH rt-tests v4 16/16] rt-tests: Rename error.h to rt-error.h Daniel Wagner
2021-02-17  3:50   ` John Kacur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).