linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6]  RFC v2: add support for tilegx and (partial) android support to rt-test
@ 2015-09-21 15:27 Henrik Austad
  2015-09-21 15:27 ` [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR Henrik Austad
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

Take 2 on the series for adding cross-compile support to tilegx and 64
bit arm android to rt-test.

v2:
- drop patch for numa_on_available call
- change how makefile calls rebuild (thanks Josh!)
- Rebased onto v0.94-devel

v1:
So this is an attempt to consolidate some of the changes we've added to
rt-test to use rt-test. It adds support for TileGx, and a subset of the
binaries for android (cyclictest and hackbench to be precise).

They will probably need some more work, any feedback is welcome

Henrik Austad (6):
  Add CROSS_COMPILE-switch to CC and AR
  Add syscall-number for sched_(gs)etattr() for tile
  Add a rebuild-switch to Makefile
  Fix compile-warnings
  Makefile: add librttest to rt-migrate-test
  android: adjust target for android

 Makefile                              | 38 ++++++++++++++++++++++--
 src/backfire/sendme.c                 |  8 +++--
 src/cyclictest/cyclictest.c           | 55 ++++++++++++++++++++++++++++-------
 src/include/rt-sched.h                |  5 ++++
 src/pmqtest/pmqtest.c                 |  3 +-
 src/ptsematest/ptsematest.c           |  3 +-
 src/rt-migrate-test/rt-migrate-test.c |  5 ++--
 src/signaltest/signaltest.c           | 25 +++++++++-------
 src/sigwaittest/sigwaittest.c         |  8 +++--
 src/svsematest/svsematest.c           |  9 ++++--
 10 files changed, 125 insertions(+), 34 deletions(-)

-- 
1.9.1


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

* [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR
  2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
@ 2015-09-21 15:27 ` Henrik Austad
  2015-09-21 19:41   ` John Kacur
  2015-09-21 15:27 ` [PATCH 2/6] Add syscall-number for sched_(gs)etattr() for tile Henrik Austad
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

Signed-off-by: Henrik Austad <haustad@cisco.com>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 3094e1b..f630076 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,6 @@
 VERSION = 0.93
+CC=$(CROSS_COMPILE)gcc
+AR=$(CROSS_COMPILE)ar
 
 HAVE_NPTL ?= yes
 
-- 
1.9.1


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

* [PATCH 2/6] Add syscall-number for sched_(gs)etattr() for tile
  2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
  2015-09-21 15:27 ` [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR Henrik Austad
@ 2015-09-21 15:27 ` Henrik Austad
  2015-09-21 19:42   ` John Kacur
  2015-09-21 15:27 ` [PATCH 3/6] Add a rebuild-switch to Makefile Henrik Austad
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

Signed-off-by: Henrik Austad <haustad@cisco.com>
---
 src/include/rt-sched.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h
index 6c45f7a..b46b1b1 100644
--- a/src/include/rt-sched.h
+++ b/src/include/rt-sched.h
@@ -47,6 +47,11 @@
 #define __NR_sched_getattr		381
 #endif
 
+#ifdef __tilegx__
+#define __NR_sched_setattr		274
+#define __NR_sched_getattr		275
+#endif
+
 struct sched_attr {
 	uint32_t size;
 	uint32_t sched_policy;
-- 
1.9.1


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

* [PATCH 3/6] Add a rebuild-switch to Makefile
  2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
  2015-09-21 15:27 ` [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR Henrik Austad
  2015-09-21 15:27 ` [PATCH 2/6] Add syscall-number for sched_(gs)etattr() for tile Henrik Austad
@ 2015-09-21 15:27 ` Henrik Austad
  2015-09-21 19:43   ` John Kacur
  2015-09-21 15:27 ` [PATCH 4/6] Fix compile-warnings Henrik Austad
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

Update from joshc for job-level safety

Co-authored.by: Josh Cartwright <joshc@ni.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index f630076..fcf20ce 100644
--- a/Makefile
+++ b/Makefile
@@ -129,6 +129,11 @@ RPMDIRS = BUILD BUILDROOT RPMS SRPMS SPECS
 distclean: clean
 	rm -rf $(RPMDIRS) releases *.tar.gz rt-tests.spec tmp
 
+.PHONY: rebuild
+rebuild:
+	$(MAKE) clean
+	$(MAKE) all
+
 .PHONY: changelog
 changelog:
 	git log >ChangeLog
-- 
1.9.1


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

* [PATCH 4/6] Fix compile-warnings
  2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
                   ` (2 preceding siblings ...)
  2015-09-21 15:27 ` [PATCH 3/6] Add a rebuild-switch to Makefile Henrik Austad
@ 2015-09-21 15:27 ` Henrik Austad
  2015-09-21 19:49   ` John Kacur
  2015-09-21 15:27 ` [PATCH 5/6] Makefile: add librttest to rt-migrate-test Henrik Austad
  2015-09-21 15:27 ` [PATCH 6/6] android: adjust target for android Henrik Austad
  5 siblings, 1 reply; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

Check return-value from read/write/ftruncate and remove unused variables.

Signed-off-by: Henrik Austad <haustad@cisco.com>
---
 src/backfire/sendme.c                 |  8 ++++++--
 src/cyclictest/cyclictest.c           | 10 +++++++---
 src/pmqtest/pmqtest.c                 |  3 ++-
 src/ptsematest/ptsematest.c           |  3 ++-
 src/rt-migrate-test/rt-migrate-test.c |  5 +++--
 src/signaltest/signaltest.c           | 25 +++++++++++++++----------
 src/sigwaittest/sigwaittest.c         |  8 ++++++--
 src/svsematest/svsematest.c           |  9 +++++++--
 8 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c
index c1854d9..e524fbf 100644
--- a/src/backfire/sendme.c
+++ b/src/backfire/sendme.c
@@ -256,9 +256,13 @@ int main(int argc, char *argv[])
 			ts.tv_nsec = (interval % USEC_PER_SEC) * 1000;
 
 			gettimeofday(&before, NULL);
-			write(path, sigtest, strlen(sigtest));
+			if (write(path, sigtest, strlen(sigtest)) < 0) {
+				fprintf(stderr, "Could not write sigtest to backfire-path\n");
+			}
 			while (after.tv_sec == 0);
-			read(path, timestamp, sizeof(timestamp));
+			if (read(path, timestamp, sizeof(timestamp)) <= 0) {
+				fprintf(stderr, "Trouble reading file backfire-path\n");
+			}
 			if (sscanf(timestamp, "%lu,%lu\n", &sendtime.tv_sec,
 			    &sendtime.tv_usec) != 2)
 				break;
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 2be72fa..42cd964 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -439,7 +439,9 @@ static void tracemark(char *fmt, ...)
 	va_start(ap, fmt);
 	len = vsnprintf(tracebuf, TRACEBUFSIZ, fmt, ap);
 	va_end(ap);
-	write(tracemark_fd, tracebuf, len);
+	if (write(tracemark_fd, tracebuf, len) < 0) {
+		err_msg_n(errno, "WARN: could not write to tracebuf");
+	}
 }
 
 
@@ -452,7 +454,8 @@ static void tracing(int on)
 		case KV_26_LT24: prctl(0, 1); break;
 		case KV_26_33:
 		case KV_30:
-			write(trace_fd, "1", 1);
+			if (write(trace_fd, "1", 1) < 0)
+				err_msg_n(errno, "Could not set trace_fd");
 			break;
 		default:	 break;
 		}
@@ -462,7 +465,8 @@ static void tracing(int on)
 		case KV_26_LT24: prctl(0, 0); break;
 		case KV_26_33:
 		case KV_30:
-			write(trace_fd, "0", 1);
+			if (write(trace_fd, "0", 1) < 0)
+				err_msg_n(errno, "Could not set trace_fd");
 			break;
 		default:	break;
 		}
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index 75d5ee8..78eaa9c 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -210,7 +210,8 @@ void *pmqthread(void *param)
 				int tracing_enabled =
 				    open(tracing_enabled_file, O_WRONLY);
 				if (tracing_enabled >= 0) {
-					write(tracing_enabled, "0", 1);
+					if (write(tracing_enabled, "0", 1) < 0)
+						err_msg_n(errno, "WARN: could write to tracing_enabled");
 					close(tracing_enabled);
 				} else
 					snprintf(par->error, sizeof(par->error),
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index a31c745..f777b38 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -137,7 +137,8 @@ void *semathread(void *param)
 				int tracing_enabled =
 				    open(tracing_enabled_file, O_WRONLY);
 				if (tracing_enabled >= 0) {
-					write(tracing_enabled, "0", 1);
+					if (write(tracing_enabled, "0", 1) < 0)
+						err_msg_n(errno, "WARN: Could not enable tracing.");
 					close(tracing_enabled);
 				} else
 					snprintf(par->error, sizeof(par->error),
diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index 85a78da..1501432 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -44,7 +44,7 @@
 #include <errno.h>
 #include <sched.h>
 #include <pthread.h>
-
+#include "error.h"
 #define gettid() syscall(__NR_gettid)
 
 int nr_tasks;
@@ -87,7 +87,8 @@ static void ftrace_write(const char *fmt, ...)
 	n = vsnprintf(buff, BUFSIZ, fmt, ap);
 	va_end(ap);
 
-	write(mark_fd, buff, n);
+	if (write(mark_fd, buff, n) < 0)
+		err_msg_n(errno, "WARN: Could not write to trace_marker.");
 }
 
 #define nano2sec(nan) (nan / 1000000000ULL)
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 61259a0..8c780b9 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -64,6 +64,11 @@ struct thread_stat {
 	int threadstarted;
 	int tid;
 };
+#define SYSTEM_W(x)				\
+	if (system((x)) < 0) {			\
+		fprintf(stderr, "Trouble running %s\n", (x));	\
+		return NULL;					\
+	}							\
 
 static int shutdown;
 static int tracelimit = 0;
@@ -101,16 +106,16 @@ void *signalthread(void *param)
 	int first = 1;
 
 	if (tracelimit) {
-		system("echo 1 > /proc/sys/kernel/trace_all_cpus");
-		system("echo 1 > /proc/sys/kernel/trace_enabled");
-		system("echo 1 > /proc/sys/kernel/trace_freerunning");
-		system("echo 0 > /proc/sys/kernel/trace_print_at_crash");
-		system("echo 1 > /proc/sys/kernel/trace_user_triggered");
-		system("echo -1 > /proc/sys/kernel/trace_user_trigger_irq");
-		system("echo 0 > /proc/sys/kernel/trace_verbose");
-		system("echo 0 > /proc/sys/kernel/preempt_thresh");
-		system("echo 0 > /proc/sys/kernel/wakeup_timing");
-		system("echo 0 > /proc/sys/kernel/preempt_max_latency");
+		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_all_cpus");
+		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_enabled");
+		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_freerunning");
+		SYSTEM_W("echo 0 > /proc/sys/kernel/trace_print_at_crash");
+		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_user_triggered");
+		SYSTEM_W("echo -1 > /proc/sys/kernel/trace_user_trigger_irq");
+		SYSTEM_W("echo 0 > /proc/sys/kernel/trace_verbose");
+		SYSTEM_W("echo 0 > /proc/sys/kernel/preempt_thresh");
+		SYSTEM_W("echo 0 > /proc/sys/kernel/wakeup_timing");
+		SYSTEM_W("echo 0 > /proc/sys/kernel/preempt_max_latency");
 	}
 
 	stat->tid = gettid();
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 91fcdaa..abeaa35 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -36,6 +36,7 @@
 #include <sys/time.h>
 #include <linux/unistd.h>
 #include <utmpx.h>
+#include "error.h"
 #include "rt-utils.h"
 #include "rt-get_cpu.h"
 
@@ -185,7 +186,8 @@ void *semathread(void *param)
 				int tracing_enabled =
 				    open(tracing_enabled_file, O_WRONLY);
 				if (tracing_enabled >= 0) {
-					write(tracing_enabled, "0", 1);
+					if (write(tracing_enabled, "0", 1) < 0)
+						err_msg_n(errno, "WARN: Could not disable tracing.");
 					close(tracing_enabled);
 				} else
 					snprintf(par->error, sizeof(par->error),
@@ -378,7 +380,9 @@ int main(int argc, char *argv[])
 			fprintf(stderr, "Could not create shared memory\n");
 			return 1;
 		}
-		ftruncate(shmem, totalsize);
+		if (ftruncate(shmem, totalsize) < 0)
+			err_msg_n(errno, "WARN: Could not truncate file to %d bytes.", totalsize);
+
 		param = mmap(0, totalsize, PROT_READ|PROT_WRITE, MAP_SHARED,
 		    shmem, 0);
 		if (param == MAP_FAILED) {
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index eeb8285..9d4d2b9 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -191,7 +191,8 @@ void *semathread(void *param)
 				int tracing_enabled =
 				    open(tracing_enabled_file, O_WRONLY);
 				if (tracing_enabled >= 0) {
-					write(tracing_enabled, "0", 1);
+					if (write(tracing_enabled, "0", 1))
+						err_msg_n(errno, "WARN: Could not write to tracing_enabled!");
 					close(tracing_enabled);
 				} else
 					snprintf(par->error, sizeof(par->error),
@@ -431,7 +432,11 @@ int main(int argc, char *argv[])
 			fprintf(stderr, "Could not create shared memory\n");
 			return 1;
 		}
-		ftruncate(shmem, totalsize);
+		if (ftruncate(shmem, totalsize) < 0) {
+			fprintf(stderr, "Could not truncate file to specified size (%d)\n", totalsize);
+			return 1;
+
+		}
 		param = mmap(0, totalsize, PROT_READ|PROT_WRITE, MAP_SHARED,
 		    shmem, 0);
 		if (param == MAP_FAILED) {
-- 
1.9.1


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

* [PATCH 5/6] Makefile: add librttest to rt-migrate-test
  2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
                   ` (3 preceding siblings ...)
  2015-09-21 15:27 ` [PATCH 4/6] Fix compile-warnings Henrik Austad
@ 2015-09-21 15:27 ` Henrik Austad
  2015-09-21 19:52   ` John Kacur
  2015-09-21 15:27 ` [PATCH 6/6] android: adjust target for android Henrik Austad
  5 siblings, 1 reply; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

linker must be able to resolve reference to err_msg_n properly

   rt-migrate-test.c:(.text+0x1ff): undefined reference to `err_msg_n'

Signed-off-by: Henrik Austad <haustad@cisco.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fcf20ce..66de743 100644
--- a/Makefile
+++ b/Makefile
@@ -87,8 +87,8 @@ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
 	chmod +x src/hwlatdetect/hwlatdetect.py
 	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
 
-rt-migrate-test: rt-migrate-test.o
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
+rt-migrate-test: rt-migrate-test.o librttest.a
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
 
 ptsematest: ptsematest.o librttest.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(EXTRA_LIBS)
-- 
1.9.1


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

* [PATCH 6/6] android: adjust target for android
  2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
                   ` (4 preceding siblings ...)
  2015-09-21 15:27 ` [PATCH 5/6] Makefile: add librttest to rt-migrate-test Henrik Austad
@ 2015-09-21 15:27 ` Henrik Austad
  2015-09-21 20:00   ` John Kacur
  5 siblings, 1 reply; 15+ messages in thread
From: Henrik Austad @ 2015-09-21 15:27 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Josh Cartwright, Henrik Austad

Bionic (Android's libc implementation) lacks support for (amongst other
things) pthread_barriers and pthread_setaffinity. The former is removed
by ifdeffery, the latter is added as a per-android wrapper to
sched_setaffinity.

Signed-off-by: Henrik Austad <haustad@cisco.com>
---
 Makefile                    | 27 ++++++++++++++++++++++++++-
 src/cyclictest/cyclictest.c | 45 +++++++++++++++++++++++++++++++++++++--------
 2 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 66de743..04ba190 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,32 @@ ifeq ($(NUMA),1)
 	NUMA_LIBS = -lnuma
 endif
 
+# Bionic (android) does not have:
+# - pthread barriers
+# - pthread_[gs]etaffinity
+#
+# Typically see something like "aarch64-linux-android"
+
+ifneq ($(shell $(CC) -dumpmachine | grep -i android),)
+	USE_BIONIC := 1
+	CFLAGS += -DNO_PTHREAD_BARRIER
+	CFLAGS += -DNO_PTHREAD_SETAFFINITY
+
+	LDFLAGS += -pie
+# -lrt and -lpthread is in standard bionic library, no standalone library
+	LIBS := $(filter-out -lrt,$(LIBS))
+	LIBS := $(filter-out -lpthread,$(LIBS))
+
+# BIONIC does not support PI, barriers and have different files in
+# include/. This menas that currently, only these binaries will compile
+# and link properly:
+# - cyclictest
+# - hackbench
+# - hwlatdetect
+	sources := cyclictest.c hackbench.c hwlatdetect.c
+	TARGETS = $(sources:.c=)
+endif
+
 VPATH	= src/cyclictest:
 VPATH	+= src/signaltest:
 VPATH	+= src/pi_tests:
@@ -164,7 +190,6 @@ install_hwlatdetect: hwlatdetect
 		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
 		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
 	fi
-
 .PHONY: release
 release: distclean changelog
 	mkdir -p releases
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 42cd964..96fa864 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -11,7 +11,6 @@
  * 2 as published by the Free Software Foundation.
  *
  */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -36,6 +35,7 @@
 #include <sys/resource.h>
 #include <sys/utsname.h>
 #include <sys/mman.h>
+#include <sys/syscall.h>
 #include "rt_numa.h"
 
 #include "rt-utils.h"
@@ -78,6 +78,15 @@ int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
 	return -EINVAL;
 }
 
+#endif
+
+#ifdef NO_PTHREAD_SETAFFINITY
+static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
+                                         const cpu_set_t *cpuset)
+{
+    return sched_setaffinity(0, cpusetsize, cpuset);
+}
+
 #undef CPU_SET
 #undef CPU_ZERO
 #define CPU_SET(cpu, cpusetp)
@@ -184,9 +193,6 @@ static int check_clock_resolution;
 static int ct_debug;
 static int use_fifo = 0;
 static pthread_t fifo_threadid;
-static int aligned = 0;
-static int secaligned = 0;
-static int offset = 0;
 static int laptop = 0;
 static int use_histfile = 0;
 
@@ -197,9 +203,14 @@ static pthread_mutex_t break_thread_id_lock = PTHREAD_MUTEX_INITIALIZER;
 static pid_t break_thread_id = 0;
 static uint64_t break_thread_value = 0;
 
+#ifndef NO_PTHREAD_BARRIER
+static int aligned = 0;
+static int secaligned = 0;
+static int offset = 0;
 static pthread_barrier_t align_barr;
 static pthread_barrier_t globalt_barr;
 static struct timespec globalt;
+#endif
 
 /* Backup of kernel variables that we modify */
 static struct kvars {
@@ -805,7 +816,8 @@ static void *timerthread(void *param)
 		fatal("timerthread%d: failed to set priority to %d\n", par->cpu, par->prio);
 
 	/* Get current time */
-	if (aligned || secaligned) {
+#ifndef NO_PTHREAD_BARRIER
+	if(aligned || secaligned){
 		pthread_barrier_wait(&globalt_barr);
 		if (par->tnum == 0) {
 			clock_gettime(par->clock, &globalt);
@@ -830,6 +842,7 @@ static void *timerthread(void *param)
 		}
 	}
 	else
+#endif
 		clock_gettime(par->clock, &now);
 
 	next = now;
@@ -1036,7 +1049,9 @@ static void display_help(int error)
 	       "-a [NUM] --affinity        run thread #N on processor #N, if possible\n"
 	       "                           with NUM pin all threads to the processor NUM\n"
 #endif
+#ifndef NO_PTHREAD_BARRIER
 	       "-A USEC  --aligned=USEC    align thread wakeups to a specific offset\n"
+#endif
 	       "-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n"
 	       "-B       --preemptirqs     both preempt and irqsoff tracing (used with -b)\n"
 	       "-c CLOCK --clock=CLOCK     select clock\n"
@@ -1077,7 +1092,9 @@ static void display_help(int error)
 	       "-R       --resolution      check clock resolution, calling clock_gettime() many\n"
 	       "                           times.  list of clock_gettime() values will be\n"
 	       "                           reported with -X\n"
+#ifndef NO_PTHREAD_BARRIER
 	       "         --secaligned [USEC] align thread wakeups to the next full second,\n"
+#endif
 	       "                           and apply the optional offset\n"
 	       "-s       --system          use sys_nanosleep and sys_setitimer\n"
 	       "-S       --smp             Standard SMP testing: options -a -t -n and\n"
@@ -1226,8 +1243,11 @@ enum option_values {
 	OPT_NSECS, OPT_OSCOPE, OPT_TRACEOPT, OPT_PRIORITY, OPT_PREEMPTOFF, OPT_QUIET,
 	OPT_PRIOSPREAD, OPT_RELATIVE, OPT_RESOLUTION, OPT_SYSTEM, OPT_SMP, OPT_THREADS,
 	OPT_TRACER, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP, OPT_WAKEUPRT,
-	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS, OPT_ALIGNED, OPT_LAPTOP,
-	OPT_SECALIGNED,
+	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS,
+#ifndef NO_PTHREAD_BARRIER
+	OPT_ALIGNED, OPT_SECALIGNED,
+#endif
+        OPT_LAPTOP,
 };
 
 /* Process commandline options */
@@ -1245,7 +1265,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
 		static struct option long_options[] = {
 			{"affinity",         optional_argument, NULL, OPT_AFFINITY},
 			{"notrace",          no_argument,       NULL, OPT_NOTRACE },
+#ifndef NO_PTHREAD_BARRIER
 			{"aligned",          optional_argument, NULL, OPT_ALIGNED },
+#endif
 			{"breaktrace",       required_argument, NULL, OPT_BREAKTRACE },
 			{"preemptirqs",      no_argument,       NULL, OPT_PREEMPTIRQ },
 			{"clock",            required_argument, NULL, OPT_CLOCK },
@@ -1275,7 +1297,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
 			{"priospread",       no_argument,       NULL, OPT_PRIOSPREAD },
 			{"relative",         no_argument,       NULL, OPT_RELATIVE },
 			{"resolution",       no_argument,       NULL, OPT_RESOLUTION },
+#ifndef NO_PTHREAD_BARRIER
 			{"secaligned",       optional_argument, NULL, OPT_SECALIGNED },
+#endif
 			{"system",           no_argument,       NULL, OPT_SYSTEM },
 			{"smp",              no_argument,       NULL, OPT_SMP },
 			{"threads",          optional_argument, NULL, OPT_THREADS },
@@ -1310,6 +1334,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 				setaffinity = AFFINITY_USEALL;
 			}
 			break;
+#ifndef NO_PTHREAD_BARRIER
 		case 'A':
 		case OPT_ALIGNED:
 			aligned=1;
@@ -1320,6 +1345,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 			else
 				offset = 0;
 			break;
+#endif
 		case 'b':
 		case OPT_BREAKTRACE:
 			tracelimit = atoi(optarg); break;
@@ -1420,6 +1446,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 		case OPT_RESOLUTION:
 			check_clock_resolution = 1; break;
 		case 's':
+#ifndef NO_PTHREAD_BARRIER
 		case OPT_SECALIGNED:
 			secaligned = 1;
 			if (optarg != NULL)
@@ -1429,6 +1456,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 			else
 				offset = 0;
 			break;
+#endif
 		case OPT_SYSTEM:
 			use_system = MODE_SYS_OFFSET; break;
 		case 'S':
@@ -1565,6 +1593,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 	if (num_threads < 1)
 		error = 1;
 
+#ifndef NO_PTHREAD_BARRIER
 	if (aligned && secaligned)
 		error = 1;
 
@@ -1572,7 +1601,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 		pthread_barrier_init(&globalt_barr, NULL, num_threads);
 		pthread_barrier_init(&align_barr, NULL, num_threads);
 	}

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

* Re: [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR
  2015-09-21 15:27 ` [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR Henrik Austad
@ 2015-09-21 19:41   ` John Kacur
  0 siblings, 0 replies; 15+ messages in thread
From: John Kacur @ 2015-09-21 19:41 UTC (permalink / raw)
  To: Henrik Austad; +Cc: Clark Williams, John Kacur, linux-rt-users, Josh Cartwright



On Mon, 21 Sep 2015, Henrik Austad wrote:

> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
>  Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 3094e1b..f630076 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,4 +1,6 @@
>  VERSION = 0.93
> +CC=$(CROSS_COMPILE)gcc
> +AR=$(CROSS_COMPILE)ar
>  
>  HAVE_NPTL ?= yes
>  
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH 2/6] Add syscall-number for sched_(gs)etattr() for tile
  2015-09-21 15:27 ` [PATCH 2/6] Add syscall-number for sched_(gs)etattr() for tile Henrik Austad
@ 2015-09-21 19:42   ` John Kacur
  0 siblings, 0 replies; 15+ messages in thread
From: John Kacur @ 2015-09-21 19:42 UTC (permalink / raw)
  To: Henrik Austad; +Cc: Clark Williams, John Kacur, linux-rt-users, Josh Cartwright



On Mon, 21 Sep 2015, Henrik Austad wrote:

> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
>  src/include/rt-sched.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h
> index 6c45f7a..b46b1b1 100644
> --- a/src/include/rt-sched.h
> +++ b/src/include/rt-sched.h
> @@ -47,6 +47,11 @@
>  #define __NR_sched_getattr		381
>  #endif
>  
> +#ifdef __tilegx__
> +#define __NR_sched_setattr		274
> +#define __NR_sched_getattr		275
> +#endif
> +
>  struct sched_attr {
>  	uint32_t size;
>  	uint32_t sched_policy;
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH 3/6] Add a rebuild-switch to Makefile
  2015-09-21 15:27 ` [PATCH 3/6] Add a rebuild-switch to Makefile Henrik Austad
@ 2015-09-21 19:43   ` John Kacur
  0 siblings, 0 replies; 15+ messages in thread
From: John Kacur @ 2015-09-21 19:43 UTC (permalink / raw)
  To: Henrik Austad; +Cc: Clark Williams, John Kacur, linux-rt-users, Josh Cartwright



On Mon, 21 Sep 2015, Henrik Austad wrote:

> Update from joshc for job-level safety
> 
> Co-authored.by: Josh Cartwright <joshc@ni.com>
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
>  Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index f630076..fcf20ce 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -129,6 +129,11 @@ RPMDIRS = BUILD BUILDROOT RPMS SRPMS SPECS
>  distclean: clean
>  	rm -rf $(RPMDIRS) releases *.tar.gz rt-tests.spec tmp
>  
> +.PHONY: rebuild
> +rebuild:
> +	$(MAKE) clean
> +	$(MAKE) all
> +
>  .PHONY: changelog
>  changelog:
>  	git log >ChangeLog
> -- 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH 4/6] Fix compile-warnings
  2015-09-21 15:27 ` [PATCH 4/6] Fix compile-warnings Henrik Austad
@ 2015-09-21 19:49   ` John Kacur
  0 siblings, 0 replies; 15+ messages in thread
From: John Kacur @ 2015-09-21 19:49 UTC (permalink / raw)
  To: Henrik Austad; +Cc: Clark Williams, John Kacur, linux-rt-users, Josh Cartwright



On Mon, 21 Sep 2015, Henrik Austad wrote:

> Check return-value from read/write/ftruncate and remove unused variables.
> 
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
>  src/backfire/sendme.c                 |  8 ++++++--
>  src/cyclictest/cyclictest.c           | 10 +++++++---
>  src/pmqtest/pmqtest.c                 |  3 ++-
>  src/ptsematest/ptsematest.c           |  3 ++-
>  src/rt-migrate-test/rt-migrate-test.c |  5 +++--
>  src/signaltest/signaltest.c           | 25 +++++++++++++++----------
>  src/sigwaittest/sigwaittest.c         |  8 ++++++--
>  src/svsematest/svsematest.c           |  9 +++++++--
>  8 files changed, 48 insertions(+), 23 deletions(-)
> 
> diff --git a/src/backfire/sendme.c b/src/backfire/sendme.c
> index c1854d9..e524fbf 100644
> --- a/src/backfire/sendme.c
> +++ b/src/backfire/sendme.c
> @@ -256,9 +256,13 @@ int main(int argc, char *argv[])
>  			ts.tv_nsec = (interval % USEC_PER_SEC) * 1000;
>  
>  			gettimeofday(&before, NULL);
> -			write(path, sigtest, strlen(sigtest));
> +			if (write(path, sigtest, strlen(sigtest)) < 0) {
> +				fprintf(stderr, "Could not write sigtest to backfire-path\n");
> +			}
>  			while (after.tv_sec == 0);
> -			read(path, timestamp, sizeof(timestamp));
> +			if (read(path, timestamp, sizeof(timestamp)) <= 0) {
> +				fprintf(stderr, "Trouble reading file backfire-path\n");
> +			}
>  			if (sscanf(timestamp, "%lu,%lu\n", &sendtime.tv_sec,
>  			    &sendtime.tv_usec) != 2)
>  				break;
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 2be72fa..42cd964 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -439,7 +439,9 @@ static void tracemark(char *fmt, ...)
>  	va_start(ap, fmt);
>  	len = vsnprintf(tracebuf, TRACEBUFSIZ, fmt, ap);
>  	va_end(ap);
> -	write(tracemark_fd, tracebuf, len);
> +	if (write(tracemark_fd, tracebuf, len) < 0) {
> +		err_msg_n(errno, "WARN: could not write to tracebuf");
> +	}
>  }
>  
>  
> @@ -452,7 +454,8 @@ static void tracing(int on)
>  		case KV_26_LT24: prctl(0, 1); break;
>  		case KV_26_33:
>  		case KV_30:
> -			write(trace_fd, "1", 1);
> +			if (write(trace_fd, "1", 1) < 0)
> +				err_msg_n(errno, "Could not set trace_fd");
>  			break;
>  		default:	 break;
>  		}
> @@ -462,7 +465,8 @@ static void tracing(int on)
>  		case KV_26_LT24: prctl(0, 0); break;
>  		case KV_26_33:
>  		case KV_30:
> -			write(trace_fd, "0", 1);
> +			if (write(trace_fd, "0", 1) < 0)
> +				err_msg_n(errno, "Could not set trace_fd");
>  			break;
>  		default:	break;
>  		}
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index 75d5ee8..78eaa9c 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -210,7 +210,8 @@ void *pmqthread(void *param)
>  				int tracing_enabled =
>  				    open(tracing_enabled_file, O_WRONLY);
>  				if (tracing_enabled >= 0) {
> -					write(tracing_enabled, "0", 1);
> +					if (write(tracing_enabled, "0", 1) < 0)
> +						err_msg_n(errno, "WARN: could write to tracing_enabled");
>  					close(tracing_enabled);
>  				} else
>  					snprintf(par->error, sizeof(par->error),
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index a31c745..f777b38 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -137,7 +137,8 @@ void *semathread(void *param)
>  				int tracing_enabled =
>  				    open(tracing_enabled_file, O_WRONLY);
>  				if (tracing_enabled >= 0) {
> -					write(tracing_enabled, "0", 1);
> +					if (write(tracing_enabled, "0", 1) < 0)
> +						err_msg_n(errno, "WARN: Could not enable tracing.");
>  					close(tracing_enabled);
>  				} else
>  					snprintf(par->error, sizeof(par->error),
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index 85a78da..1501432 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -44,7 +44,7 @@
>  #include <errno.h>
>  #include <sched.h>
>  #include <pthread.h>
> -
> +#include "error.h"
>  #define gettid() syscall(__NR_gettid)
>  
>  int nr_tasks;
> @@ -87,7 +87,8 @@ static void ftrace_write(const char *fmt, ...)
>  	n = vsnprintf(buff, BUFSIZ, fmt, ap);
>  	va_end(ap);
>  
> -	write(mark_fd, buff, n);
> +	if (write(mark_fd, buff, n) < 0)
> +		err_msg_n(errno, "WARN: Could not write to trace_marker.");
>  }
>  
>  #define nano2sec(nan) (nan / 1000000000ULL)
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 61259a0..8c780b9 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -64,6 +64,11 @@ struct thread_stat {
>  	int threadstarted;
>  	int tid;
>  };
> +#define SYSTEM_W(x)				\
> +	if (system((x)) < 0) {			\
> +		fprintf(stderr, "Trouble running %s\n", (x));	\
> +		return NULL;					\
> +	}							\
>  
>  static int shutdown;
>  static int tracelimit = 0;
> @@ -101,16 +106,16 @@ void *signalthread(void *param)
>  	int first = 1;
>  
>  	if (tracelimit) {
> -		system("echo 1 > /proc/sys/kernel/trace_all_cpus");
> -		system("echo 1 > /proc/sys/kernel/trace_enabled");
> -		system("echo 1 > /proc/sys/kernel/trace_freerunning");
> -		system("echo 0 > /proc/sys/kernel/trace_print_at_crash");
> -		system("echo 1 > /proc/sys/kernel/trace_user_triggered");
> -		system("echo -1 > /proc/sys/kernel/trace_user_trigger_irq");
> -		system("echo 0 > /proc/sys/kernel/trace_verbose");
> -		system("echo 0 > /proc/sys/kernel/preempt_thresh");
> -		system("echo 0 > /proc/sys/kernel/wakeup_timing");
> -		system("echo 0 > /proc/sys/kernel/preempt_max_latency");
> +		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_all_cpus");
> +		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_enabled");
> +		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_freerunning");
> +		SYSTEM_W("echo 0 > /proc/sys/kernel/trace_print_at_crash");
> +		SYSTEM_W("echo 1 > /proc/sys/kernel/trace_user_triggered");
> +		SYSTEM_W("echo -1 > /proc/sys/kernel/trace_user_trigger_irq");
> +		SYSTEM_W("echo 0 > /proc/sys/kernel/trace_verbose");
> +		SYSTEM_W("echo 0 > /proc/sys/kernel/preempt_thresh");
> +		SYSTEM_W("echo 0 > /proc/sys/kernel/wakeup_timing");
> +		SYSTEM_W("echo 0 > /proc/sys/kernel/preempt_max_latency");
>  	}
>  
>  	stat->tid = gettid();
> diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
> index 91fcdaa..abeaa35 100644
> --- a/src/sigwaittest/sigwaittest.c
> +++ b/src/sigwaittest/sigwaittest.c
> @@ -36,6 +36,7 @@
>  #include <sys/time.h>
>  #include <linux/unistd.h>
>  #include <utmpx.h>
> +#include "error.h"
>  #include "rt-utils.h"
>  #include "rt-get_cpu.h"
>  
> @@ -185,7 +186,8 @@ void *semathread(void *param)
>  				int tracing_enabled =
>  				    open(tracing_enabled_file, O_WRONLY);
>  				if (tracing_enabled >= 0) {
> -					write(tracing_enabled, "0", 1);
> +					if (write(tracing_enabled, "0", 1) < 0)
> +						err_msg_n(errno, "WARN: Could not disable tracing.");
>  					close(tracing_enabled);
>  				} else
>  					snprintf(par->error, sizeof(par->error),
> @@ -378,7 +380,9 @@ int main(int argc, char *argv[])
>  			fprintf(stderr, "Could not create shared memory\n");
>  			return 1;
>  		}
> -		ftruncate(shmem, totalsize);
> +		if (ftruncate(shmem, totalsize) < 0)
> +			err_msg_n(errno, "WARN: Could not truncate file to %d bytes.", totalsize);
> +
>  		param = mmap(0, totalsize, PROT_READ|PROT_WRITE, MAP_SHARED,
>  		    shmem, 0);
>  		if (param == MAP_FAILED) {
> diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
> index eeb8285..9d4d2b9 100644
> --- a/src/svsematest/svsematest.c
> +++ b/src/svsematest/svsematest.c
> @@ -191,7 +191,8 @@ void *semathread(void *param)
>  				int tracing_enabled =
>  				    open(tracing_enabled_file, O_WRONLY);
>  				if (tracing_enabled >= 0) {
> -					write(tracing_enabled, "0", 1);
> +					if (write(tracing_enabled, "0", 1))
> +						err_msg_n(errno, "WARN: Could not write to tracing_enabled!");
>  					close(tracing_enabled);
>  				} else
>  					snprintf(par->error, sizeof(par->error),
> @@ -431,7 +432,11 @@ int main(int argc, char *argv[])
>  			fprintf(stderr, "Could not create shared memory\n");
>  			return 1;
>  		}
> -		ftruncate(shmem, totalsize);
> +		if (ftruncate(shmem, totalsize) < 0) {
> +			fprintf(stderr, "Could not truncate file to specified size (%d)\n", totalsize);
> +			return 1;
> +
> +		}
>  		param = mmap(0, totalsize, PROT_READ|PROT_WRITE, MAP_SHARED,
>  		    shmem, 0);
>  		if (param == MAP_FAILED) {
> -- 


After applying your patch, I get this build failure.

gcc -Wall -Wno-nonnull -O2 -DNUMA  -o rt-migrate-test rt-migrate-test.o 
-lrt -lpthread
rt-migrate-test.o: In function `ftrace_write':
rt-migrate-test.c:(.text+0x1b7): undefined reference to `err_msg_n'
collect2: error: ld returned 1 exit status
Makefile:91: recipe for target 'rt-migrate-test' failed
make: *** [rt-migrate-test] Error 1

I think you should break this up into some smaller patches.
Make sure you are doing something logical if a test fails.
Don't just slap a message on a failure to shut-up the compiler for
not checking. Are these tests that you are actually using?

This needs some work.

Thanks

John

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

* Re: [PATCH 5/6] Makefile: add librttest to rt-migrate-test
  2015-09-21 15:27 ` [PATCH 5/6] Makefile: add librttest to rt-migrate-test Henrik Austad
@ 2015-09-21 19:52   ` John Kacur
  2015-09-22 10:06     ` Henrik Austad
  0 siblings, 1 reply; 15+ messages in thread
From: John Kacur @ 2015-09-21 19:52 UTC (permalink / raw)
  To: Henrik Austad; +Cc: Clark Williams, John Kacur, linux-rt-users, Josh Cartwright



On Mon, 21 Sep 2015, Henrik Austad wrote:

> linker must be able to resolve reference to err_msg_n properly
> 
>    rt-migrate-test.c:(.text+0x1ff): undefined reference to `err_msg_n'
> 
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index fcf20ce..66de743 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -87,8 +87,8 @@ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
>  	chmod +x src/hwlatdetect/hwlatdetect.py
>  	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
>  
> -rt-migrate-test: rt-migrate-test.o
> -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
> +rt-migrate-test: rt-migrate-test.o librttest.a
> +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
>  
>  ptsematest: ptsematest.o librttest.a
>  	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(EXTRA_LIBS)
> -- 

Ah, I see, this patch fixes the compile error that the previous patch 
introduces. So, you at least need to reorder them.

I'm accepting this patch for now, but I think some time is necessary to 
review the previous patch.

Signed-off-by: John Kacur <jkacur@redhat.com>
> 

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

* Re: [PATCH 6/6] android: adjust target for android
  2015-09-21 15:27 ` [PATCH 6/6] android: adjust target for android Henrik Austad
@ 2015-09-21 20:00   ` John Kacur
  2015-09-22 10:08     ` Henrik Austad
  0 siblings, 1 reply; 15+ messages in thread
From: John Kacur @ 2015-09-21 20:00 UTC (permalink / raw)
  To: Henrik Austad; +Cc: Clark Williams, John Kacur, linux-rt-users, Josh Cartwright



On Mon, 21 Sep 2015, Henrik Austad wrote:

> Bionic (Android's libc implementation) lacks support for (amongst other
> things) pthread_barriers and pthread_setaffinity. The former is removed
> by ifdeffery, the latter is added as a per-android wrapper to
> sched_setaffinity.
> 
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
>  Makefile                    | 27 ++++++++++++++++++++++++++-
>  src/cyclictest/cyclictest.c | 45 +++++++++++++++++++++++++++++++++++++--------
>  2 files changed, 63 insertions(+), 9 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 66de743..04ba190 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -49,6 +49,32 @@ ifeq ($(NUMA),1)
>  	NUMA_LIBS = -lnuma
>  endif
>  
> +# Bionic (android) does not have:
> +# - pthread barriers
> +# - pthread_[gs]etaffinity
> +#
> +# Typically see something like "aarch64-linux-android"
> +
> +ifneq ($(shell $(CC) -dumpmachine | grep -i android),)
> +	USE_BIONIC := 1
> +	CFLAGS += -DNO_PTHREAD_BARRIER
> +	CFLAGS += -DNO_PTHREAD_SETAFFINITY
> +
> +	LDFLAGS += -pie
> +# -lrt and -lpthread is in standard bionic library, no standalone library
> +	LIBS := $(filter-out -lrt,$(LIBS))
> +	LIBS := $(filter-out -lpthread,$(LIBS))
> +
> +# BIONIC does not support PI, barriers and have different files in
> +# include/. This menas that currently, only these binaries will compile
> +# and link properly:
> +# - cyclictest
> +# - hackbench
> +# - hwlatdetect
> +	sources := cyclictest.c hackbench.c hwlatdetect.c
> +	TARGETS = $(sources:.c=)
> +endif
> +
>  VPATH	= src/cyclictest:
>  VPATH	+= src/signaltest:
>  VPATH	+= src/pi_tests:
> @@ -164,7 +190,6 @@ install_hwlatdetect: hwlatdetect
>  		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
>  		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
>  	fi
> -
>  .PHONY: release
>  release: distclean changelog
>  	mkdir -p releases
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 42cd964..96fa864 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -11,7 +11,6 @@
>   * 2 as published by the Free Software Foundation.
>   *
>   */
> -
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <stdint.h>
> @@ -36,6 +35,7 @@
>  #include <sys/resource.h>
>  #include <sys/utsname.h>
>  #include <sys/mman.h>
> +#include <sys/syscall.h>
>  #include "rt_numa.h"
>  
>  #include "rt-utils.h"
> @@ -78,6 +78,15 @@ int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
>  	return -EINVAL;
>  }
>  
> +#endif
> +
> +#ifdef NO_PTHREAD_SETAFFINITY
> +static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
> +                                         const cpu_set_t *cpuset)
> +{
> +    return sched_setaffinity(0, cpusetsize, cpuset);
> +}
> +
>  #undef CPU_SET
>  #undef CPU_ZERO
>  #define CPU_SET(cpu, cpusetp)
> @@ -184,9 +193,6 @@ static int check_clock_resolution;
>  static int ct_debug;
>  static int use_fifo = 0;
>  static pthread_t fifo_threadid;
> -static int aligned = 0;
> -static int secaligned = 0;
> -static int offset = 0;
>  static int laptop = 0;
>  static int use_histfile = 0;
>  
> @@ -197,9 +203,14 @@ static pthread_mutex_t break_thread_id_lock = PTHREAD_MUTEX_INITIALIZER;
>  static pid_t break_thread_id = 0;
>  static uint64_t break_thread_value = 0;
>  
> +#ifndef NO_PTHREAD_BARRIER
> +static int aligned = 0;
> +static int secaligned = 0;
> +static int offset = 0;
>  static pthread_barrier_t align_barr;
>  static pthread_barrier_t globalt_barr;
>  static struct timespec globalt;
> +#endif
>  
>  /* Backup of kernel variables that we modify */
>  static struct kvars {
> @@ -805,7 +816,8 @@ static void *timerthread(void *param)
>  		fatal("timerthread%d: failed to set priority to %d\n", par->cpu, par->prio);
>  
>  	/* Get current time */
> -	if (aligned || secaligned) {
> +#ifndef NO_PTHREAD_BARRIER
> +	if(aligned || secaligned){
>  		pthread_barrier_wait(&globalt_barr);
>  		if (par->tnum == 0) {
>  			clock_gettime(par->clock, &globalt);
> @@ -830,6 +842,7 @@ static void *timerthread(void *param)
>  		}
>  	}
>  	else
> +#endif
>  		clock_gettime(par->clock, &now);
>  
>  	next = now;
> @@ -1036,7 +1049,9 @@ static void display_help(int error)
>  	       "-a [NUM] --affinity        run thread #N on processor #N, if possible\n"
>  	       "                           with NUM pin all threads to the processor NUM\n"
>  #endif
> +#ifndef NO_PTHREAD_BARRIER
>  	       "-A USEC  --aligned=USEC    align thread wakeups to a specific offset\n"
> +#endif
>  	       "-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n"
>  	       "-B       --preemptirqs     both preempt and irqsoff tracing (used with -b)\n"
>  	       "-c CLOCK --clock=CLOCK     select clock\n"
> @@ -1077,7 +1092,9 @@ static void display_help(int error)
>  	       "-R       --resolution      check clock resolution, calling clock_gettime() many\n"
>  	       "                           times.  list of clock_gettime() values will be\n"
>  	       "                           reported with -X\n"
> +#ifndef NO_PTHREAD_BARRIER
>  	       "         --secaligned [USEC] align thread wakeups to the next full second,\n"
> +#endif
>  	       "                           and apply the optional offset\n"
>  	       "-s       --system          use sys_nanosleep and sys_setitimer\n"
>  	       "-S       --smp             Standard SMP testing: options -a -t -n and\n"
> @@ -1226,8 +1243,11 @@ enum option_values {
>  	OPT_NSECS, OPT_OSCOPE, OPT_TRACEOPT, OPT_PRIORITY, OPT_PREEMPTOFF, OPT_QUIET,
>  	OPT_PRIOSPREAD, OPT_RELATIVE, OPT_RESOLUTION, OPT_SYSTEM, OPT_SMP, OPT_THREADS,
>  	OPT_TRACER, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP, OPT_WAKEUPRT,
> -	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS, OPT_ALIGNED, OPT_LAPTOP,
> -	OPT_SECALIGNED,
> +	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS,
> +#ifndef NO_PTHREAD_BARRIER
> +	OPT_ALIGNED, OPT_SECALIGNED,
> +#endif
> +        OPT_LAPTOP,
>  };
>  
>  /* Process commandline options */
> @@ -1245,7 +1265,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  		static struct option long_options[] = {
>  			{"affinity",         optional_argument, NULL, OPT_AFFINITY},
>  			{"notrace",          no_argument,       NULL, OPT_NOTRACE },
> +#ifndef NO_PTHREAD_BARRIER
>  			{"aligned",          optional_argument, NULL, OPT_ALIGNED },
> +#endif
>  			{"breaktrace",       required_argument, NULL, OPT_BREAKTRACE },
>  			{"preemptirqs",      no_argument,       NULL, OPT_PREEMPTIRQ },
>  			{"clock",            required_argument, NULL, OPT_CLOCK },
> @@ -1275,7 +1297,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  			{"priospread",       no_argument,       NULL, OPT_PRIOSPREAD },
>  			{"relative",         no_argument,       NULL, OPT_RELATIVE },
>  			{"resolution",       no_argument,       NULL, OPT_RESOLUTION },
> +#ifndef NO_PTHREAD_BARRIER
>  			{"secaligned",       optional_argument, NULL, OPT_SECALIGNED },
> +#endif
>  			{"system",           no_argument,       NULL, OPT_SYSTEM },
>  			{"smp",              no_argument,       NULL, OPT_SMP },
>  			{"threads",          optional_argument, NULL, OPT_THREADS },
> @@ -1310,6 +1334,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  				setaffinity = AFFINITY_USEALL;
>  			}
>  			break;
> +#ifndef NO_PTHREAD_BARRIER
>  		case 'A':
>  		case OPT_ALIGNED:
>  			aligned=1;
> @@ -1320,6 +1345,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  			else
>  				offset = 0;
>  			break;
> +#endif
>  		case 'b':
>  		case OPT_BREAKTRACE:
>  			tracelimit = atoi(optarg); break;
> @@ -1420,6 +1446,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  		case OPT_RESOLUTION:
>  			check_clock_resolution = 1; break;
>  		case 's':
> +#ifndef NO_PTHREAD_BARRIER
>  		case OPT_SECALIGNED:
>  			secaligned = 1;
>  			if (optarg != NULL)
> @@ -1429,6 +1456,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  			else
>  				offset = 0;
>  			break;
> +#endif
>  		case OPT_SYSTEM:
>  			use_system = MODE_SYS_OFFSET; break;
>  		case 'S':
> @@ -1565,6 +1593,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  	if (num_threads < 1)
>  		error = 1;
>  
> +#ifndef NO_PTHREAD_BARRIER
>  	if (aligned && secaligned)
>  		error = 1;
>  
> @@ -1572,7 +1601,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  		pthread_barrier_init(&globalt_barr, NULL, num_threads);
>  		pthread_barrier_init(&align_barr, NULL, num_threads);
>  	}
> -
> +#endif
>  	if (error) {
>  		if (affinity_mask)
>  			rt_bitmask_free(affinity_mask);
> -- 


Not thrilled with all the #ifdef code, litering the c files, but I like 
what it can do. We many need to clean this up a bit in the future.
I'll rely on you to be testing the USE_BIONIC=1 feature.

I fixed a minor spelling error, other than that.

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH 5/6] Makefile: add librttest to rt-migrate-test
  2015-09-21 19:52   ` John Kacur
@ 2015-09-22 10:06     ` Henrik Austad
  0 siblings, 0 replies; 15+ messages in thread
From: Henrik Austad @ 2015-09-22 10:06 UTC (permalink / raw)
  To: John Kacur; +Cc: Clark Williams, linux-rt-users, Josh Cartwright

On Mon, Sep 21, 2015 at 09:52:55PM +0200, John Kacur wrote:
> 
> 
> On Mon, 21 Sep 2015, Henrik Austad wrote:
> 
> > linker must be able to resolve reference to err_msg_n properly
> > 
> >    rt-migrate-test.c:(.text+0x1ff): undefined reference to `err_msg_n'
> > 
> > Signed-off-by: Henrik Austad <haustad@cisco.com>
> > ---
> >  Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index fcf20ce..66de743 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -87,8 +87,8 @@ hwlatdetect:  src/hwlatdetect/hwlatdetect.py
> >  	chmod +x src/hwlatdetect/hwlatdetect.py
> >  	ln -s src/hwlatdetect/hwlatdetect.py hwlatdetect
> >  
> > -rt-migrate-test: rt-migrate-test.o
> > -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
> > +rt-migrate-test: rt-migrate-test.o librttest.a
> > +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
> >  
> >  ptsematest: ptsematest.o librttest.a
> >  	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(EXTRA_LIBS)
> > -- 
> 
> Ah, I see, this patch fixes the compile error that the previous patch 
> introduces. So, you at least need to reorder them.
> 
> I'm accepting this patch for now, but I think some time is necessary to 
> review the previous patch.

Yep, I'll see if I can clean it up and make sure I catch all instances of 
warnings etc. It should have been applied *before* the "remove 
warnings"-patch.

> Signed-off-by: John Kacur <jkacur@redhat.com>

Thanks though!

-- 
Henrik Austad
TIPBU Eng
Cisco Systems Norway

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

* Re: [PATCH 6/6] android: adjust target for android
  2015-09-21 20:00   ` John Kacur
@ 2015-09-22 10:08     ` Henrik Austad
  0 siblings, 0 replies; 15+ messages in thread
From: Henrik Austad @ 2015-09-22 10:08 UTC (permalink / raw)
  To: John Kacur; +Cc: Clark Williams, linux-rt-users, Josh Cartwright

On Mon, Sep 21, 2015 at 10:00:32PM +0200, John Kacur wrote:
> 
> 
> On Mon, 21 Sep 2015, Henrik Austad wrote:
> 
> > Bionic (Android's libc implementation) lacks support for (amongst other
> > things) pthread_barriers and pthread_setaffinity. The former is removed
> > by ifdeffery, the latter is added as a per-android wrapper to
> > sched_setaffinity.
> > 
> > Signed-off-by: Henrik Austad <haustad@cisco.com>
> > ---
> >  Makefile                    | 27 ++++++++++++++++++++++++++-
> >  src/cyclictest/cyclictest.c | 45 +++++++++++++++++++++++++++++++++++++--------
> >  2 files changed, 63 insertions(+), 9 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 66de743..04ba190 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -49,6 +49,32 @@ ifeq ($(NUMA),1)
> >  	NUMA_LIBS = -lnuma
> >  endif
> >  
> > +# Bionic (android) does not have:
> > +# - pthread barriers
> > +# - pthread_[gs]etaffinity
> > +#
> > +# Typically see something like "aarch64-linux-android"
> > +
> > +ifneq ($(shell $(CC) -dumpmachine | grep -i android),)
> > +	USE_BIONIC := 1
> > +	CFLAGS += -DNO_PTHREAD_BARRIER
> > +	CFLAGS += -DNO_PTHREAD_SETAFFINITY
> > +
> > +	LDFLAGS += -pie
> > +# -lrt and -lpthread is in standard bionic library, no standalone library
> > +	LIBS := $(filter-out -lrt,$(LIBS))
> > +	LIBS := $(filter-out -lpthread,$(LIBS))
> > +
> > +# BIONIC does not support PI, barriers and have different files in
> > +# include/. This menas that currently, only these binaries will compile
> > +# and link properly:
> > +# - cyclictest
> > +# - hackbench
> > +# - hwlatdetect
> > +	sources := cyclictest.c hackbench.c hwlatdetect.c
> > +	TARGETS = $(sources:.c=)
> > +endif
> > +
> >  VPATH	= src/cyclictest:
> >  VPATH	+= src/signaltest:
> >  VPATH	+= src/pi_tests:
> > @@ -164,7 +190,6 @@ install_hwlatdetect: hwlatdetect
> >  		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
> >  		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
> >  	fi
> > -
> >  .PHONY: release
> >  release: distclean changelog
> >  	mkdir -p releases
> > diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> > index 42cd964..96fa864 100644
> > --- a/src/cyclictest/cyclictest.c
> > +++ b/src/cyclictest/cyclictest.c
> > @@ -11,7 +11,6 @@
> >   * 2 as published by the Free Software Foundation.
> >   *
> >   */
> > -
> >  #include <stdio.h>
> >  #include <stdlib.h>
> >  #include <stdint.h>
> > @@ -36,6 +35,7 @@
> >  #include <sys/resource.h>
> >  #include <sys/utsname.h>
> >  #include <sys/mman.h>
> > +#include <sys/syscall.h>
> >  #include "rt_numa.h"
> >  
> >  #include "rt-utils.h"
> > @@ -78,6 +78,15 @@ int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
> >  	return -EINVAL;
> >  }
> >  
> > +#endif
> > +
> > +#ifdef NO_PTHREAD_SETAFFINITY
> > +static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
> > +                                         const cpu_set_t *cpuset)
> > +{
> > +    return sched_setaffinity(0, cpusetsize, cpuset);
> > +}
> > +
> >  #undef CPU_SET
> >  #undef CPU_ZERO
> >  #define CPU_SET(cpu, cpusetp)
> > @@ -184,9 +193,6 @@ static int check_clock_resolution;
> >  static int ct_debug;
> >  static int use_fifo = 0;
> >  static pthread_t fifo_threadid;
> > -static int aligned = 0;
> > -static int secaligned = 0;
> > -static int offset = 0;
> >  static int laptop = 0;
> >  static int use_histfile = 0;
> >  
> > @@ -197,9 +203,14 @@ static pthread_mutex_t break_thread_id_lock = PTHREAD_MUTEX_INITIALIZER;
> >  static pid_t break_thread_id = 0;
> >  static uint64_t break_thread_value = 0;
> >  
> > +#ifndef NO_PTHREAD_BARRIER
> > +static int aligned = 0;
> > +static int secaligned = 0;
> > +static int offset = 0;
> >  static pthread_barrier_t align_barr;
> >  static pthread_barrier_t globalt_barr;
> >  static struct timespec globalt;
> > +#endif
> >  
> >  /* Backup of kernel variables that we modify */
> >  static struct kvars {
> > @@ -805,7 +816,8 @@ static void *timerthread(void *param)
> >  		fatal("timerthread%d: failed to set priority to %d\n", par->cpu, par->prio);
> >  
> >  	/* Get current time */
> > -	if (aligned || secaligned) {
> > +#ifndef NO_PTHREAD_BARRIER
> > +	if(aligned || secaligned){
> >  		pthread_barrier_wait(&globalt_barr);
> >  		if (par->tnum == 0) {
> >  			clock_gettime(par->clock, &globalt);
> > @@ -830,6 +842,7 @@ static void *timerthread(void *param)
> >  		}
> >  	}
> >  	else
> > +#endif
> >  		clock_gettime(par->clock, &now);
> >  
> >  	next = now;
> > @@ -1036,7 +1049,9 @@ static void display_help(int error)
> >  	       "-a [NUM] --affinity        run thread #N on processor #N, if possible\n"
> >  	       "                           with NUM pin all threads to the processor NUM\n"
> >  #endif
> > +#ifndef NO_PTHREAD_BARRIER
> >  	       "-A USEC  --aligned=USEC    align thread wakeups to a specific offset\n"
> > +#endif
> >  	       "-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n"
> >  	       "-B       --preemptirqs     both preempt and irqsoff tracing (used with -b)\n"
> >  	       "-c CLOCK --clock=CLOCK     select clock\n"
> > @@ -1077,7 +1092,9 @@ static void display_help(int error)
> >  	       "-R       --resolution      check clock resolution, calling clock_gettime() many\n"
> >  	       "                           times.  list of clock_gettime() values will be\n"
> >  	       "                           reported with -X\n"
> > +#ifndef NO_PTHREAD_BARRIER
> >  	       "         --secaligned [USEC] align thread wakeups to the next full second,\n"
> > +#endif
> >  	       "                           and apply the optional offset\n"
> >  	       "-s       --system          use sys_nanosleep and sys_setitimer\n"
> >  	       "-S       --smp             Standard SMP testing: options -a -t -n and\n"
> > @@ -1226,8 +1243,11 @@ enum option_values {
> >  	OPT_NSECS, OPT_OSCOPE, OPT_TRACEOPT, OPT_PRIORITY, OPT_PREEMPTOFF, OPT_QUIET,
> >  	OPT_PRIOSPREAD, OPT_RELATIVE, OPT_RESOLUTION, OPT_SYSTEM, OPT_SMP, OPT_THREADS,
> >  	OPT_TRACER, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP, OPT_WAKEUPRT,
> > -	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS, OPT_ALIGNED, OPT_LAPTOP,
> > -	OPT_SECALIGNED,
> > +	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS,
> > +#ifndef NO_PTHREAD_BARRIER
> > +	OPT_ALIGNED, OPT_SECALIGNED,
> > +#endif
> > +        OPT_LAPTOP,
> >  };
> >  
> >  /* Process commandline options */
> > @@ -1245,7 +1265,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  		static struct option long_options[] = {
> >  			{"affinity",         optional_argument, NULL, OPT_AFFINITY},
> >  			{"notrace",          no_argument,       NULL, OPT_NOTRACE },
> > +#ifndef NO_PTHREAD_BARRIER
> >  			{"aligned",          optional_argument, NULL, OPT_ALIGNED },
> > +#endif
> >  			{"breaktrace",       required_argument, NULL, OPT_BREAKTRACE },
> >  			{"preemptirqs",      no_argument,       NULL, OPT_PREEMPTIRQ },
> >  			{"clock",            required_argument, NULL, OPT_CLOCK },
> > @@ -1275,7 +1297,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  			{"priospread",       no_argument,       NULL, OPT_PRIOSPREAD },
> >  			{"relative",         no_argument,       NULL, OPT_RELATIVE },
> >  			{"resolution",       no_argument,       NULL, OPT_RESOLUTION },
> > +#ifndef NO_PTHREAD_BARRIER
> >  			{"secaligned",       optional_argument, NULL, OPT_SECALIGNED },
> > +#endif
> >  			{"system",           no_argument,       NULL, OPT_SYSTEM },
> >  			{"smp",              no_argument,       NULL, OPT_SMP },
> >  			{"threads",          optional_argument, NULL, OPT_THREADS },
> > @@ -1310,6 +1334,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  				setaffinity = AFFINITY_USEALL;
> >  			}
> >  			break;
> > +#ifndef NO_PTHREAD_BARRIER
> >  		case 'A':
> >  		case OPT_ALIGNED:
> >  			aligned=1;
> > @@ -1320,6 +1345,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  			else
> >  				offset = 0;
> >  			break;
> > +#endif
> >  		case 'b':
> >  		case OPT_BREAKTRACE:
> >  			tracelimit = atoi(optarg); break;
> > @@ -1420,6 +1446,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  		case OPT_RESOLUTION:
> >  			check_clock_resolution = 1; break;
> >  		case 's':
> > +#ifndef NO_PTHREAD_BARRIER
> >  		case OPT_SECALIGNED:
> >  			secaligned = 1;
> >  			if (optarg != NULL)
> > @@ -1429,6 +1456,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  			else
> >  				offset = 0;
> >  			break;
> > +#endif
> >  		case OPT_SYSTEM:
> >  			use_system = MODE_SYS_OFFSET; break;
> >  		case 'S':
> > @@ -1565,6 +1593,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  	if (num_threads < 1)
> >  		error = 1;
> >  
> > +#ifndef NO_PTHREAD_BARRIER
> >  	if (aligned && secaligned)
> >  		error = 1;
> >  
> > @@ -1572,7 +1601,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
> >  		pthread_barrier_init(&globalt_barr, NULL, num_threads);
> >  		pthread_barrier_init(&align_barr, NULL, num_threads);
> >  	}
> > -
> > +#endif
> >  	if (error) {
> >  		if (affinity_mask)
> >  			rt_bitmask_free(affinity_mask);
> > -- 
> 
> 
> Not thrilled with all the #ifdef code, litering the c files, but I like 
> what it can do. We many need to clean this up a bit in the future.
> I'll rely on you to be testing the USE_BIONIC=1 feature.

Yes, I will keep track of both USE_BIONIC=1 and tilegx compiles.

> I fixed a minor spelling error, other than that.

Ah, thanks!

> Signed-off-by: John Kacur <jkacur@redhat.com>

-- 
Henrik Austad
TIPBU Eng
Cisco Systems Norway

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

end of thread, other threads:[~2015-09-22 10:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 15:27 [PATCH 0/6] RFC v2: add support for tilegx and (partial) android support to rt-test Henrik Austad
2015-09-21 15:27 ` [PATCH 1/6] Add CROSS_COMPILE-switch to CC and AR Henrik Austad
2015-09-21 19:41   ` John Kacur
2015-09-21 15:27 ` [PATCH 2/6] Add syscall-number for sched_(gs)etattr() for tile Henrik Austad
2015-09-21 19:42   ` John Kacur
2015-09-21 15:27 ` [PATCH 3/6] Add a rebuild-switch to Makefile Henrik Austad
2015-09-21 19:43   ` John Kacur
2015-09-21 15:27 ` [PATCH 4/6] Fix compile-warnings Henrik Austad
2015-09-21 19:49   ` John Kacur
2015-09-21 15:27 ` [PATCH 5/6] Makefile: add librttest to rt-migrate-test Henrik Austad
2015-09-21 19:52   ` John Kacur
2015-09-22 10:06     ` Henrik Austad
2015-09-21 15:27 ` [PATCH 6/6] android: adjust target for android Henrik Austad
2015-09-21 20:00   ` John Kacur
2015-09-22 10:08     ` Henrik Austad

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).