* [PATCH v2 0/4] Android: clean-up patches
@ 2015-10-21 19:00 Henrik Austad
2015-10-21 19:00 ` [PATCH v2 1/4] Android: clean up the bypass ifdeffery Henrik Austad
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Henrik Austad @ 2015-10-21 19:00 UTC (permalink / raw)
To: linux-rt-users; +Cc: John Kacur, Henrik Austad
From: Henrik Austad <henrik@austad.us>
Changes since v1:
- Changed ifdef in bionic.h to PTHREAD_BIONIC instead of the previous 2
- Moved pthread_setaffinity_np() out of cyclictest and into bionic.h
- Marked the end of #ifedf with /* __UCLIBC__ */ to avoid future confusion
Initial changelog:
Some of these are a respin of previous patches. I considered adding
bionic.h to src/arch/bionic/include, but that was a horrible path and
the file must be included unconditionally by android-target anyway.
src/arch/bionic was renamed to src/arch/android for the sake of clarity.
Tested on android/arm64, tilegx and x64
Henrik Austad (4):
Android: clean up the bypass ifdeffery
android: rename arch from bionic to android
android: Expand match for android in ostype
rt-sched.h: do not unconditionally define syscall-numbers
Makefile | 3 +--
src/arch/android/Makefile | 24 ++++++++++++++++++++++++
src/arch/bionic/Makefile | 25 -------------------------
src/cyclictest/cyclictest.c | 35 ++++-------------------------------
src/include/bionic.h | 42 ++++++++++++++++++++++++++++++++++++++++++
src/include/rt-sched.h | 4 ++++
6 files changed, 75 insertions(+), 58 deletions(-)
create mode 100644 src/arch/android/Makefile
delete mode 100644 src/arch/bionic/Makefile
create mode 100644 src/include/bionic.h
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/4] Android: clean up the bypass ifdeffery
2015-10-21 19:00 [PATCH v2 0/4] Android: clean-up patches Henrik Austad
@ 2015-10-21 19:00 ` Henrik Austad
2015-10-22 8:30 ` John Kacur
2015-10-21 19:00 ` [PATCH v2 2/4] Android: rename arch from bionic to android Henrik Austad
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Henrik Austad @ 2015-10-21 19:00 UTC (permalink / raw)
To: linux-rt-users; +Cc: John Kacur, Henrik Austad
88af643971b9 (android: adjust target for android) introduced some really
ugly ifdefs to avoid calling into pthread_barrier_wait and
pthread_barrier_init.
This patch attempts to coalesce this into a single place and let the
compiler handle the linking so that cyclictest.c is untouched by evil
ifdefs.
It also combines NO_PTHREAD_BARRIER and NO_PTHREAD_SETAFFINITY into a
PTHREAD_BIONIC as it does not make much sense to keep them separated.
Compiled and tested on:
- x86_64 (v3.13 kernel)
- tilegx (v3.10 kernel)
- arm64 android (v3.10 kernel)
Note: this includes bionic.h unconditionally, so it makes most sense to
keep bionic.h in src/include/ (and not in src/arch/bionic/).
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
---
src/arch/bionic/Makefile | 7 ++-----
src/cyclictest/cyclictest.c | 35 ++++-------------------------------
src/include/bionic.h | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 36 deletions(-)
create mode 100644 src/include/bionic.h
diff --git a/src/arch/bionic/Makefile b/src/arch/bionic/Makefile
index 410d2c9c7c37..e25f67203e5a 100644
--- a/src/arch/bionic/Makefile
+++ b/src/arch/bionic/Makefile
@@ -6,8 +6,7 @@
# Typically see something like "aarch64-linux-android"
ifeq (android,$(ostype))
USE_BIONIC := 1
- CFLAGS += -DNO_PTHREAD_BARRIER
- CFLAGS += -DNO_PTHREAD_SETAFFINITY
+ CFLAGS += -DPTHREAD_BIONIC
LDFLAGS += -pie
# -lrt and -lpthread is in standard bionic library, no standalone library
@@ -19,7 +18,5 @@ ifeq (android,$(ostype))
# and link properly:
# - cyclictest
# - hackbench
-# - hwlatdetect
- sources := cyclictest.c hackbench.c hwlatdetect.c
+ sources := cyclictest.c hackbench.c
endif
-
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 975e7858fb8e..b53fb27a2a41 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -40,6 +40,8 @@
#include "rt-utils.h"
+#include <bionic.h>
+
#define DEFAULT_INTERVAL 1000
#define DEFAULT_DISTANCE 500
@@ -87,15 +89,7 @@ int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
extern int clock_nanosleep(clockid_t __clock_id, int __flags,
__const struct timespec *__req,
struct timespec *__rem);
-#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);
-}
-#endif
+#endif /* __UCLIBC__ */
#define USEC_PER_SEC 1000000
#define NSEC_PER_SEC 1000000000
@@ -202,14 +196,12 @@ 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 {
@@ -813,7 +805,6 @@ static void *timerthread(void *param)
par->cpu, par->prio);
/* Get current time */
-#ifndef NO_PTHREAD_BARRIER
if (aligned || secaligned) {
pthread_barrier_wait(&globalt_barr);
if (par->tnum == 0) {
@@ -838,7 +829,6 @@ static void *timerthread(void *param)
tsnorm(&now);
}
} else
-#endif
clock_gettime(par->clock, &now);
next = now;
@@ -1052,9 +1042,7 @@ 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"
@@ -1095,9 +1083,7 @@ 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"
@@ -1247,10 +1233,7 @@ enum option_values {
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,
-#ifndef NO_PTHREAD_BARRIER
- OPT_ALIGNED, OPT_SECALIGNED,
-#endif
- OPT_LAPTOP,
+ OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP,
};
/* Process commandline options */
@@ -1268,9 +1251,7 @@ 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 },
@@ -1300,9 +1281,7 @@ 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 },
@@ -1337,7 +1316,6 @@ 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;
@@ -1348,7 +1326,6 @@ 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;
@@ -1449,7 +1426,6 @@ 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)
@@ -1459,7 +1435,6 @@ 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':
@@ -1596,7 +1571,6 @@ 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;
@@ -1604,7 +1578,6 @@ 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);
diff --git a/src/include/bionic.h b/src/include/bionic.h
new file mode 100644
index 000000000000..54f9c54b0824
--- /dev/null
+++ b/src/include/bionic.h
@@ -0,0 +1,42 @@
+#ifndef BIONIC_H
+#define BIONIC_H
+
+#ifdef PTHREAD_BIONIC
+#warning Program is being compiled with PTHREAD_BIONIC, some options may behave erratically.
+
+/*
+ * We do not have pthread_barrier_t available, but since we are not
+ * going to use them for anything useful, just typedef them to int
+ */
+typedef int pthread_barrier_t;
+typedef int pthread_barrierattr_t;
+
+#ifndef PTHREAD_BARRIER_SERIAL_THREAD
+#define PTHREAD_BARRIER_SERIAL_THREAD 0
+#endif
+
+static inline int pthread_barrier_wait(pthread_barrier_t *barrier)
+{
+ return PTHREAD_BARRIER_SERIAL_THREAD;
+}
+
+static inline int pthread_barrier_destroy(pthread_barrier_t *barrier)
+{
+ return 0;
+}
+static inline int pthread_barrier_init(pthread_barrier_t * barrier,
+ const pthread_barrierattr_t * attr,
+ unsigned count)
+{
+ return 0;
+}
+
+static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
+ const cpu_set_t *cpuset)
+{
+ return sched_setaffinity(0, cpusetsize, cpuset);
+}
+
+#endif /* PTHREAD_BIONIC */
+
+#endif /* BIONIC_H */
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/4] Android: rename arch from bionic to android
2015-10-21 19:00 [PATCH v2 0/4] Android: clean-up patches Henrik Austad
2015-10-21 19:00 ` [PATCH v2 1/4] Android: clean up the bypass ifdeffery Henrik Austad
@ 2015-10-21 19:00 ` Henrik Austad
2015-10-22 8:36 ` John Kacur
2015-10-21 19:00 ` [PATCH v2 3/4] Android: Expand match for android in ostype Henrik Austad
2015-10-21 19:00 ` [PATCH v2 4/4] rt-sched.h: do not unconditionally define syscall-numbers Henrik Austad
3 siblings, 1 reply; 9+ messages in thread
From: Henrik Austad @ 2015-10-21 19:00 UTC (permalink / raw)
To: linux-rt-users; +Cc: John Kacur, Henrik Austad, Henrik Austad
From: Henrik Austad <henrik@austad.us>
Bionic is the libc implementation used in Android and should not be
confused with the architecture.
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
---
Makefile | 3 +--
src/arch/android/Makefile | 22 ++++++++++++++++++++++
src/arch/bionic/Makefile | 22 ----------------------
3 files changed, 23 insertions(+), 24 deletions(-)
create mode 100644 src/arch/android/Makefile
delete mode 100644 src/arch/bionic/Makefile
diff --git a/Makefile b/Makefile
index 703333fe1b42..86a5c4b211a0 100644
--- a/Makefile
+++ b/Makefile
@@ -69,8 +69,7 @@ ifdef HAVE_PARSE_CPUSTRING_ALL
endif
endif
-# Include any arch specific makefiles here.
-include src/arch/bionic/Makefile
+include src/arch/android/Makefile
VPATH = src/cyclictest:
VPATH += src/signaltest:
diff --git a/src/arch/android/Makefile b/src/arch/android/Makefile
new file mode 100644
index 000000000000..e25f67203e5a
--- /dev/null
+++ b/src/arch/android/Makefile
@@ -0,0 +1,22 @@
+
+# Bionic (android) does not have:
+# - pthread barriers
+# - pthread_[gs]etaffinity
+#
+# Typically see something like "aarch64-linux-android"
+ifeq (android,$(ostype))
+ USE_BIONIC := 1
+ CFLAGS += -DPTHREAD_BIONIC
+
+ 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 has different files in
+# include/. This means that currently, only these binaries will compile
+# and link properly:
+# - cyclictest
+# - hackbench
+ sources := cyclictest.c hackbench.c
+endif
diff --git a/src/arch/bionic/Makefile b/src/arch/bionic/Makefile
deleted file mode 100644
index e25f67203e5a..000000000000
--- a/src/arch/bionic/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-
-# Bionic (android) does not have:
-# - pthread barriers
-# - pthread_[gs]etaffinity
-#
-# Typically see something like "aarch64-linux-android"
-ifeq (android,$(ostype))
- USE_BIONIC := 1
- CFLAGS += -DPTHREAD_BIONIC
-
- LDFLAGS += -pie
-# -lrt and -lpthread is in standard bionic library, no standalone library
- LIBS := $(filter-out -lrt,$(LIBS))
- LIBS := $(filter-out -lpthread,$(LIBS))
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/4] Android: Expand match for android in ostype
2015-10-21 19:00 [PATCH v2 0/4] Android: clean-up patches Henrik Austad
2015-10-21 19:00 ` [PATCH v2 1/4] Android: clean up the bypass ifdeffery Henrik Austad
2015-10-21 19:00 ` [PATCH v2 2/4] Android: rename arch from bionic to android Henrik Austad
@ 2015-10-21 19:00 ` Henrik Austad
2015-10-22 8:43 ` John Kacur
2015-10-21 19:00 ` [PATCH v2 4/4] rt-sched.h: do not unconditionally define syscall-numbers Henrik Austad
3 siblings, 1 reply; 9+ messages in thread
From: Henrik Austad @ 2015-10-21 19:00 UTC (permalink / raw)
To: linux-rt-users; +Cc: John Kacur, Henrik Austad, Henrik Austad
From: Henrik Austad <henrik@austad.us>
Some buildsystems use androidabe, so an exact match will break in those
circumstances.
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
---
src/arch/android/Makefile | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/arch/android/Makefile b/src/arch/android/Makefile
index e25f67203e5a..2c4b4b7ef9ae 100644
--- a/src/arch/android/Makefile
+++ b/src/arch/android/Makefile
@@ -1,10 +1,14 @@
-# Bionic (android) does not have:
+# Android use Bionic for libc, and this does not have
# - pthread barriers
# - pthread_[gs]etaffinity
#
-# Typically see something like "aarch64-linux-android"
-ifeq (android,$(ostype))
+# This is all handled by bionic.h based on flags we set here.
+
+# Typically see something like "aarch64-linux-android". However, in some
+# buildsystems, it will be a variation of -androidabe.
+ost=$(findstring android, $(ostype))
+ifeq (android,$(ost))
USE_BIONIC := 1
CFLAGS += -DPTHREAD_BIONIC
@@ -13,9 +17,7 @@ ifeq (android,$(ostype))
LIBS := $(filter-out -lrt,$(LIBS))
LIBS := $(filter-out -lpthread,$(LIBS))
-# BIONIC does not support PI, barriers and has different files in
-# include/. This means that currently, only these binaries will compile
-# and link properly:
+# Currently, only these binaries will compile and link properly for android
# - cyclictest
# - hackbench
sources := cyclictest.c hackbench.c
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/4] rt-sched.h: do not unconditionally define syscall-numbers
2015-10-21 19:00 [PATCH v2 0/4] Android: clean-up patches Henrik Austad
` (2 preceding siblings ...)
2015-10-21 19:00 ` [PATCH v2 3/4] Android: Expand match for android in ostype Henrik Austad
@ 2015-10-21 19:00 ` Henrik Austad
2015-10-22 9:43 ` John Kacur
3 siblings, 1 reply; 9+ messages in thread
From: Henrik Austad @ 2015-10-21 19:00 UTC (permalink / raw)
To: linux-rt-users; +Cc: John Kacur, Henrik Austad
These could be defined elsewhere, be careful when defining these
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
---
src/include/rt-sched.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h
index b46b1b16606f..679c4bd10ae2 100644
--- a/src/include/rt-sched.h
+++ b/src/include/rt-sched.h
@@ -43,9 +43,13 @@
#endif
#ifdef __arm__
+#ifndef __NR_sched_setattr
#define __NR_sched_setattr 380
+#endif
+#ifndef __NR_sched_getattr
#define __NR_sched_getattr 381
#endif
+#endif
#ifdef __tilegx__
#define __NR_sched_setattr 274
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/4] Android: clean up the bypass ifdeffery
2015-10-21 19:00 ` [PATCH v2 1/4] Android: clean up the bypass ifdeffery Henrik Austad
@ 2015-10-22 8:30 ` John Kacur
0 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2015-10-22 8:30 UTC (permalink / raw)
To: Henrik Austad; +Cc: linux-rt-users
On Wed, 21 Oct 2015, Henrik Austad wrote:
> 88af643971b9 (android: adjust target for android) introduced some really
> ugly ifdefs to avoid calling into pthread_barrier_wait and
> pthread_barrier_init.
>
> This patch attempts to coalesce this into a single place and let the
> compiler handle the linking so that cyclictest.c is untouched by evil
> ifdefs.
>
> It also combines NO_PTHREAD_BARRIER and NO_PTHREAD_SETAFFINITY into a
> PTHREAD_BIONIC as it does not make much sense to keep them separated.
>
> Compiled and tested on:
> - x86_64 (v3.13 kernel)
> - tilegx (v3.10 kernel)
> - arm64 android (v3.10 kernel)
>
> Note: this includes bionic.h unconditionally, so it makes most sense to
> keep bionic.h in src/include/ (and not in src/arch/bionic/).
>
> Cc: John Kacur <jkacur@redhat.com>
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
> src/arch/bionic/Makefile | 7 ++-----
> src/cyclictest/cyclictest.c | 35 ++++-------------------------------
> src/include/bionic.h | 42 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 48 insertions(+), 36 deletions(-)
> create mode 100644 src/include/bionic.h
>
> diff --git a/src/arch/bionic/Makefile b/src/arch/bionic/Makefile
> index 410d2c9c7c37..e25f67203e5a 100644
> --- a/src/arch/bionic/Makefile
> +++ b/src/arch/bionic/Makefile
> @@ -6,8 +6,7 @@
> # Typically see something like "aarch64-linux-android"
> ifeq (android,$(ostype))
> USE_BIONIC := 1
> - CFLAGS += -DNO_PTHREAD_BARRIER
> - CFLAGS += -DNO_PTHREAD_SETAFFINITY
> + CFLAGS += -DPTHREAD_BIONIC
>
> LDFLAGS += -pie
> # -lrt and -lpthread is in standard bionic library, no standalone library
> @@ -19,7 +18,5 @@ ifeq (android,$(ostype))
> # and link properly:
> # - cyclictest
> # - hackbench
> -# - hwlatdetect
> - sources := cyclictest.c hackbench.c hwlatdetect.c
> + sources := cyclictest.c hackbench.c
> endif
> -
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 975e7858fb8e..b53fb27a2a41 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -40,6 +40,8 @@
>
> #include "rt-utils.h"
>
> +#include <bionic.h>
> +
> #define DEFAULT_INTERVAL 1000
> #define DEFAULT_DISTANCE 500
>
> @@ -87,15 +89,7 @@ int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
> extern int clock_nanosleep(clockid_t __clock_id, int __flags,
> __const struct timespec *__req,
> struct timespec *__rem);
> -#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);
> -}
> -#endif
> +#endif /* __UCLIBC__ */
>
> #define USEC_PER_SEC 1000000
> #define NSEC_PER_SEC 1000000000
> @@ -202,14 +196,12 @@ 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 {
> @@ -813,7 +805,6 @@ static void *timerthread(void *param)
> par->cpu, par->prio);
>
> /* Get current time */
> -#ifndef NO_PTHREAD_BARRIER
> if (aligned || secaligned) {
> pthread_barrier_wait(&globalt_barr);
> if (par->tnum == 0) {
> @@ -838,7 +829,6 @@ static void *timerthread(void *param)
> tsnorm(&now);
> }
> } else
> -#endif
> clock_gettime(par->clock, &now);
>
> next = now;
> @@ -1052,9 +1042,7 @@ 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"
> @@ -1095,9 +1083,7 @@ 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"
> @@ -1247,10 +1233,7 @@ enum option_values {
> 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,
> -#ifndef NO_PTHREAD_BARRIER
> - OPT_ALIGNED, OPT_SECALIGNED,
> -#endif
> - OPT_LAPTOP,
> + OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP,
> };
>
> /* Process commandline options */
> @@ -1268,9 +1251,7 @@ 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 },
> @@ -1300,9 +1281,7 @@ 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 },
> @@ -1337,7 +1316,6 @@ 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;
> @@ -1348,7 +1326,6 @@ 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;
> @@ -1449,7 +1426,6 @@ 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)
> @@ -1459,7 +1435,6 @@ 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':
> @@ -1596,7 +1571,6 @@ 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;
>
> @@ -1604,7 +1578,6 @@ 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);
> diff --git a/src/include/bionic.h b/src/include/bionic.h
> new file mode 100644
> index 000000000000..54f9c54b0824
> --- /dev/null
> +++ b/src/include/bionic.h
> @@ -0,0 +1,42 @@
> +#ifndef BIONIC_H
> +#define BIONIC_H
> +
> +#ifdef PTHREAD_BIONIC
> +#warning Program is being compiled with PTHREAD_BIONIC, some options may behave erratically.
> +
> +/*
> + * We do not have pthread_barrier_t available, but since we are not
> + * going to use them for anything useful, just typedef them to int
> + */
> +typedef int pthread_barrier_t;
> +typedef int pthread_barrierattr_t;
> +
> +#ifndef PTHREAD_BARRIER_SERIAL_THREAD
> +#define PTHREAD_BARRIER_SERIAL_THREAD 0
> +#endif
> +
> +static inline int pthread_barrier_wait(pthread_barrier_t *barrier)
> +{
> + return PTHREAD_BARRIER_SERIAL_THREAD;
> +}
> +
> +static inline int pthread_barrier_destroy(pthread_barrier_t *barrier)
> +{
> + return 0;
> +}
> +static inline int pthread_barrier_init(pthread_barrier_t * barrier,
> + const pthread_barrierattr_t * attr,
> + unsigned count)
> +{
> + return 0;
> +}
> +
> +static inline int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
> + const cpu_set_t *cpuset)
> +{
> + return sched_setaffinity(0, cpusetsize, cpuset);
> +}
> +
> +#endif /* PTHREAD_BIONIC */
> +
> +#endif /* BIONIC_H */
> --
> 1.9.1
>
> --
Thank you.
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/4] Android: rename arch from bionic to android
2015-10-21 19:00 ` [PATCH v2 2/4] Android: rename arch from bionic to android Henrik Austad
@ 2015-10-22 8:36 ` John Kacur
0 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2015-10-22 8:36 UTC (permalink / raw)
To: Henrik Austad; +Cc: linux-rt-users, Henrik Austad
On Wed, 21 Oct 2015, Henrik Austad wrote:
> From: Henrik Austad <henrik@austad.us>
>
> Bionic is the libc implementation used in Android and should not be
> confused with the architecture.
>
> Cc: John Kacur <jkacur@redhat.com>
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
> Makefile | 3 +--
> src/arch/android/Makefile | 22 ++++++++++++++++++++++
> src/arch/bionic/Makefile | 22 ----------------------
> 3 files changed, 23 insertions(+), 24 deletions(-)
> create mode 100644 src/arch/android/Makefile
> delete mode 100644 src/arch/bionic/Makefile
>
> diff --git a/Makefile b/Makefile
> index 703333fe1b42..86a5c4b211a0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -69,8 +69,7 @@ ifdef HAVE_PARSE_CPUSTRING_ALL
> endif
> endif
>
> -# Include any arch specific makefiles here.
> -include src/arch/bionic/Makefile
> +include src/arch/android/Makefile
>
> VPATH = src/cyclictest:
> VPATH += src/signaltest:
> diff --git a/src/arch/android/Makefile b/src/arch/android/Makefile
> new file mode 100644
> index 000000000000..e25f67203e5a
> --- /dev/null
> +++ b/src/arch/android/Makefile
> @@ -0,0 +1,22 @@
> +
> +# Bionic (android) does not have:
> +# - pthread barriers
> +# - pthread_[gs]etaffinity
> +#
> +# Typically see something like "aarch64-linux-android"
> +ifeq (android,$(ostype))
> + USE_BIONIC := 1
> + CFLAGS += -DPTHREAD_BIONIC
> +
> + 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 has different files in
> +# include/. This means that currently, only these binaries will compile
> +# and link properly:
> +# - cyclictest
> +# - hackbench
> + sources := cyclictest.c hackbench.c
> +endif
> diff --git a/src/arch/bionic/Makefile b/src/arch/bionic/Makefile
> deleted file mode 100644
> index e25f67203e5a..000000000000
> --- a/src/arch/bionic/Makefile
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -
> -# Bionic (android) does not have:
> -# - pthread barriers
> -# - pthread_[gs]etaffinity
> -#
> -# Typically see something like "aarch64-linux-android"
> -ifeq (android,$(ostype))
> - USE_BIONIC := 1
> - CFLAGS += -DPTHREAD_BIONIC
> -
> - 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 has different files in
> -# include/. This means that currently, only these binaries will compile
> -# and link properly:
> -# - cyclictest
> -# - hackbench
> - sources := cyclictest.c hackbench.c
> -endif
> --
> 1.9.1
>
> --
Thanks
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/4] Android: Expand match for android in ostype
2015-10-21 19:00 ` [PATCH v2 3/4] Android: Expand match for android in ostype Henrik Austad
@ 2015-10-22 8:43 ` John Kacur
0 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2015-10-22 8:43 UTC (permalink / raw)
To: Henrik Austad; +Cc: linux-rt-users, Henrik Austad
On Wed, 21 Oct 2015, Henrik Austad wrote:
> From: Henrik Austad <henrik@austad.us>
>
> Some buildsystems use androidabe, so an exact match will break in those
> circumstances.
>
> Cc: John Kacur <jkacur@redhat.com>
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
> src/arch/android/Makefile | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/arch/android/Makefile b/src/arch/android/Makefile
> index e25f67203e5a..2c4b4b7ef9ae 100644
> --- a/src/arch/android/Makefile
> +++ b/src/arch/android/Makefile
> @@ -1,10 +1,14 @@
>
> -# Bionic (android) does not have:
> +# Android use Bionic for libc, and this does not have
> # - pthread barriers
> # - pthread_[gs]etaffinity
> #
> -# Typically see something like "aarch64-linux-android"
> -ifeq (android,$(ostype))
> +# This is all handled by bionic.h based on flags we set here.
> +
> +# Typically see something like "aarch64-linux-android". However, in some
> +# buildsystems, it will be a variation of -androidabe.
> +ost=$(findstring android, $(ostype))
> +ifeq (android,$(ost))
> USE_BIONIC := 1
> CFLAGS += -DPTHREAD_BIONIC
>
> @@ -13,9 +17,7 @@ ifeq (android,$(ostype))
> LIBS := $(filter-out -lrt,$(LIBS))
> LIBS := $(filter-out -lpthread,$(LIBS))
>
> -# BIONIC does not support PI, barriers and has different files in
> -# include/. This means that currently, only these binaries will compile
> -# and link properly:
> +# Currently, only these binaries will compile and link properly for android
> # - cyclictest
> # - hackbench
> sources := cyclictest.c hackbench.c
> --
> 1.9.1
>
> --
This change looks fine, of course, just be forewarned that I'll be
depending on you to test anything that touches android only.
Thanks
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/4] rt-sched.h: do not unconditionally define syscall-numbers
2015-10-21 19:00 ` [PATCH v2 4/4] rt-sched.h: do not unconditionally define syscall-numbers Henrik Austad
@ 2015-10-22 9:43 ` John Kacur
0 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2015-10-22 9:43 UTC (permalink / raw)
To: Henrik Austad; +Cc: linux-rt-users
On Wed, 21 Oct 2015, Henrik Austad wrote:
> These could be defined elsewhere, be careful when defining these
>
> Cc: John Kacur <jkacur@redhat.com>
> Signed-off-by: Henrik Austad <haustad@cisco.com>
> ---
> src/include/rt-sched.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h
> index b46b1b16606f..679c4bd10ae2 100644
> --- a/src/include/rt-sched.h
> +++ b/src/include/rt-sched.h
> @@ -43,9 +43,13 @@
> #endif
>
> #ifdef __arm__
> +#ifndef __NR_sched_setattr
> #define __NR_sched_setattr 380
> +#endif
> +#ifndef __NR_sched_getattr
> #define __NR_sched_getattr 381
> #endif
> +#endif
>
> #ifdef __tilegx__
> #define __NR_sched_setattr 274
> --
> 1.9.1
>
> --
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-10-22 9:43 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 19:00 [PATCH v2 0/4] Android: clean-up patches Henrik Austad
2015-10-21 19:00 ` [PATCH v2 1/4] Android: clean up the bypass ifdeffery Henrik Austad
2015-10-22 8:30 ` John Kacur
2015-10-21 19:00 ` [PATCH v2 2/4] Android: rename arch from bionic to android Henrik Austad
2015-10-22 8:36 ` John Kacur
2015-10-21 19:00 ` [PATCH v2 3/4] Android: Expand match for android in ostype Henrik Austad
2015-10-22 8:43 ` John Kacur
2015-10-21 19:00 ` [PATCH v2 4/4] rt-sched.h: do not unconditionally define syscall-numbers Henrik Austad
2015-10-22 9:43 ` 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).