[Xenomai-git] 3.x build test report

2016-03-19 Thread git

next branch build test:
git hash: 3fbb01e1e0bbf0dd479f8905912fdf4bcc770dd2
see: 
http://git.xenomai.org/xenomai-3.git/log/?id=3fbb01e1e0bbf0dd479f8905912fdf4bcc770dd2
distcheck-bfin-linux-uclibc-gcc-4.3.5/cobalt: failed with 2 warnings/errors
See 
http://xenomai.org/build-test-next/distcheck-bfin-linux-uclibc-gcc-4.3.5/cobalt/log.html#1
distcheck-powerpc64-unknown-linux-gnu-gcc-4.4.3/cobalt: failed with 6 
warnings/errors
See 
http://xenomai.org/build-test-next/distcheck-powerpc64-unknown-linux-gnu-gcc-4.4.3/cobalt/log.html#1

stable branch build test:
git hash: e95e7563c02aa86b438677f8a38427634c7d49c9
see: 
http://git.xenomai.org/xenomai-3.git/log/?id=e95e7563c02aa86b438677f8a38427634c7d49c9
Passed.


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : smokey/posix-mutex: Fix test case /wrt mutex object reuse

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5393de43e60bab0682f84733174c4fc089a7fd42
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5393de43e60bab0682f84733174c4fc089a7fd42

Author: Jan Kiszka 
Date:   Thu Feb 25 11:29:00 2016 +0100

smokey/posix-mutex: Fix test case /wrt mutex object reuse

Mutex objects created on the stack must be properly destroyed after use.
Otherwise, succeeding tests that use the same stack layout will consider
them busy and refuse to recreate the mutexes.

Signed-off-by: Jan Kiszka 

---

 testsuite/smokey/posix-mutex/posix-mutex.c |   26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ae82fc1..151c2f3 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -623,7 +623,10 @@ static int protect_raise(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -651,7 +654,10 @@ static int protect_lower(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -699,7 +705,10 @@ static int protect_weak(void)
if (!__T(ret, pthread_setschedparam(pthread_self(),
old_policy, _param)))
return ret;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -745,7 +754,11 @@ static int protect_nesting_protect(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy(_high)) ||
+   !__T(ret, pthread_mutex_destroy(_very_high)))
+   return ret;
+
return 0;
 }
 
@@ -782,7 +795,10 @@ static int protect_nesting_pi(void)
/* PP boost just dropped: HIGH -> MEDIUM. */
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy(_pp)))
+   return ret;
+
return 0;
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/smokey: mutex: simplify, introduce PP tests

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: a05e5fd457a2a7b7a21ac842ff36616ddf34bdfe
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a05e5fd457a2a7b7a21ac842ff36616ddf34bdfe

Author: Philippe Gerum 
Date:   Wed Feb 17 09:21:27 2016 +0100

testsuite/smokey: mutex: simplify, introduce PP tests

At this chance, the lock stealing test is also fixed.

---

 testsuite/smokey/posix-mutex/posix-mutex.c | 1357 ++--
 1 file changed, 670 insertions(+), 687 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ac71b31..ae82fc1 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -4,6 +4,7 @@
  * Copyright (C) Gilles Chanteperdrix  ,
  *   Marion Deveaud ,
  *   Jan Kiszka 
+ *   Philippe Gerum 
  *
  * Released under the terms of GPLv2.
  */
@@ -17,8 +18,6 @@
 #include 
 #include 
 #include 
-#include 
-#include "lib/cobalt/current.h"
 #include 
 
 smokey_test_plugin(posix_mutex,
@@ -26,886 +25,870 @@ smokey_test_plugin(posix_mutex,
   "Check POSIX mutex services"
 );
 
-#define MUTEX_CREATE   1
-#define MUTEX_LOCK 2
-#define MUTEX_TRYLOCK  3
-#define MUTEX_TIMED_LOCK   4
-#define MUTEX_UNLOCK   5
-#define MUTEX_DESTROY  6
-#define COND_CREATE7
-#define COND_SIGNAL8
-#define COND_WAIT  9
-#define COND_DESTROY   10
-#define THREAD_DETACH  11
-#define THREAD_CREATE  12
-#define THREAD_JOIN13
-#define THREAD_RENICE   14
-
-#define NS_PER_MS  100
-
 static const char *reason_str[] = {
-   [SIGDEBUG_UNDEFINED] = "undefined",
+   [SIGDEBUG_UNDEFINED] = "received SIGDEBUG for unknown reason",
[SIGDEBUG_MIGRATE_SIGNAL] = "received signal",
[SIGDEBUG_MIGRATE_SYSCALL] = "invoked syscall",
[SIGDEBUG_MIGRATE_FAULT] = "triggered fault",
[SIGDEBUG_MIGRATE_PRIOINV] = "affected by priority inversion",
-   [SIGDEBUG_NOMLOCK] = "missing mlockall",
-   [SIGDEBUG_WATCHDOG] = "runaway thread",
+   [SIGDEBUG_NOMLOCK] = "process memory not locked",
+   [SIGDEBUG_WATCHDOG] = "watchdog triggered (period too short?)",
+   [SIGDEBUG_LOCK_BREAK] = "scheduler lock break",
 };
 
 static void sigdebug(int sig, siginfo_t *si, void *context)
 {
+   const char fmt[] = "%s, this is unexpected.\n"
+   "(enabling CONFIG_XENO_OPT_DEBUG_TRACE_RELAX may help)\n";
unsigned int reason = sigdebug_reason(si);
+   int n __attribute__ ((unused));
+   static char buffer[256];
 
-   smokey_trace("\nSIGDEBUG received, reason %d: %s\n", reason,
-reason <= SIGDEBUG_WATCHDOG ? reason_str[reason] : 
"");
-}
+   if (reason > SIGDEBUG_WATCHDOG)
+   reason = SIGDEBUG_UNDEFINED;
 
-static inline unsigned long long timer_get_tsc(void)
-{
-   return clockobj_get_tsc();
+   n = snprintf(buffer, sizeof(buffer), fmt, reason_str[reason]);
+   n = write(STDERR_FILENO, buffer, n);
 }
 
-static inline unsigned long long timer_tsc2ns(unsigned long long tsc)
-{
-   return clockobj_tsc_to_ns(tsc);
-}
+#define THREAD_PRIO_WEAK   0
+#define THREAD_PRIO_LOW1
+#define THREAD_PRIO_MEDIUM 2
+#define THREAD_PRIO_HIGH   3
+#define THREAD_PRIO_VERY_HIGH  4
 
-static void add_timespec(struct timespec *ts, unsigned long long value)
-{
-   ts->tv_sec += value / 10;
-   ts->tv_nsec += value % 10;
-   if (ts->tv_nsec > 10) {
-   ts->tv_sec++;
-   ts->tv_nsec -= 10;
-   }
-}
+#define MAX_100_MS  1ULL
+
+struct locker_context {
+   pthread_mutex_t *mutex;
+   struct smokey_barrier *barrier;
+   int lock_acquired;
+};
 
-static void ms_sleep(int time)
+static void sleep_ms(unsigned int ms)  /* < 1000 */
 {
struct timespec ts;
-
+   
ts.tv_sec = 0;
-   ts.tv_nsec = time*NS_PER_MS;
-
-   nanosleep(, NULL);
+   ts.tv_nsec = ms * 100;
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
 }
 
-static void check_current_prio(int expected_prio)
+static int get_effective_prio(void) 
 {
struct cobalt_threadstat stat;
int ret;
 
ret = cobalt_thread_stat(0, );
-   if (ret) {
-   fprintf(stderr,
-   "FAILURE: cobalt_threadstat (%s)\n", strerror(-ret));
-   exit(EXIT_FAILURE);
-   }
+   if (ret)
+   return ret;
 
-   if (stat.cprio != expected_prio) {
-   fprintf(stderr,
-   "FAILURE: current prio (%d) != expected prio (%d)\n",
-   stat.cprio, expected_prio);
-   exit(EXIT_FAILURE);
-   }
+   

[Xenomai-git] Philippe Gerum : cobalt/thread: add schedparam lazy propagation

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 4eee0136b4bcb744b9dfdc195f18dd839b3e2198
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4eee0136b4bcb744b9dfdc195f18dd839b3e2198

Author: Philippe Gerum 
Date:   Fri Mar 18 12:12:50 2016 +0100

cobalt/thread: add schedparam lazy propagation

Provide a mechanism for carrying out a lazy propagation of schedparam
updates to the regular kernel, so that userland does not have to
switch to secondary mode for this.

When userland issues sc_cobalt_thread_setschedparam_ex for updating
the scheduling parameters of a Xenomai thread, a request for
propagating this change to the regular kernel is made pending. Such
request will be committed later, either when:

- the thread relaxes if it is running in primary mode when the update
  request is received;

- next time the thread calls back into the Cobalt core as a result of
  receiving a HOME action from a SIGSHADOW notification, which is sent
  if such thread was relaxed at the time of the update request.

As a result, the target thread will have propagated the schedparams
update to the regular kernel as soon as it resumes (relaxed) execution
in user-space.

---

 include/cobalt/kernel/thread.h  |8 +
 include/cobalt/uapi/kernel/thread.h |1 +
 include/cobalt/uapi/signal.h|1 +
 kernel/cobalt/posix/syscall.c   |9 --
 kernel/cobalt/thread.c  |   55 +++
 5 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 07b6996..a4d826e 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -567,6 +567,14 @@ int xnthread_set_schedparam(struct xnthread *thread,
 
 int xnthread_killall(int grace, int mask);
 
+void __xnthread_propagate_schedparam(struct xnthread *curr);
+
+static inline void xnthread_propagate_schedparam(struct xnthread *curr)
+{
+   if (xnthread_test_info(curr, XNSCHEDP))
+   __xnthread_propagate_schedparam(curr);
+}
+
 extern struct xnthread_personality xenomai_personality;
 
 /** @} */
diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index 0cfc5c8..8d26f16 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -71,6 +71,7 @@
 #define XNROBBED  0x0020 /**< Robbed from resource ownership */
 #define XNCANCELD 0x0040 /**< Cancellation request is pending */
 #define XNPIALERT 0x0080 /**< Priority inversion alert (SIGDEBUG sent) */
+#define XNSCHEDP  0x0100 /**< schedparam propagation is pending */
 
 /* Local information flags (private to current thread) */
 
diff --git a/include/cobalt/uapi/signal.h b/include/cobalt/uapi/signal.h
index b5483d7..8a7ea15 100644
--- a/include/cobalt/uapi/signal.h
+++ b/include/cobalt/uapi/signal.h
@@ -47,6 +47,7 @@
 /* SIGSHADOW action codes. */
 #define SIGSHADOW_ACTION_HARDEN1
 #define SIGSHADOW_ACTION_BACKTRACE 2
+#define SIGSHADOW_ACTION_HOME  3
 #define SIGSHADOW_BACKTRACE_DEPTH  16
 
 #define SIGDEBUG   SIGXCPU
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index a2e87ab..9893b30 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -717,11 +717,16 @@ restart:
goto ret_handled;
}
switched = 1;
-   } else
+   } else {
/*
-* We want to run the syscall in the Linux domain.
+* We want to run the syscall in the current Linux
+* domain. This is a slow path, so proceed with any
+* pending schedparam update on the fly.
 */
switched = 0;
+   if (thread)
+   xnthread_propagate_schedparam(thread);
+   }
 
ret = handler(__xn_reg_arglist(regs));
if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive) != 0) {
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 0ea746d..cabc6b8 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1974,6 +1975,11 @@ int __xnthread_set_schedparam(struct xnthread *thread,
thread->lock_count == 0)
xnsched_putback(thread);
 
+   xnthread_set_info(thread, XNSCHEDP);
+   /* Ask the target thread to call back if relaxed. */
+   if (xnthread_test_state(thread, XNRELAX))
+   xnthread_signal(thread, SIGSHADOW, SIGSHADOW_ACTION_HOME);
+   
return ret;
 }
 
@@ -2095,6 +2101,40 @@ static void post_wakeup(struct task_struct *p)
ipipe_post_work_root(, work);
 }
 
+void __xnthread_propagate_schedparam(struct xnthread *curr)
+{
+   int kpolicy = SCHED_FIFO, kprio = curr->bprio, ret;
+   struct task_struct *p = current;
+   struct 

[Xenomai-git] Philippe Gerum : doc: prebuild

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 80f7710f5c954e4afa3f369b9e3c57ecfc563c07
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=80f7710f5c954e4afa3f369b9e3c57ecfc563c07

Author: Philippe Gerum 
Date:   Wed Mar  2 17:16:48 2016 +0100

doc: prebuild

---

 doc/prebuilt/html/MIGRATION/index.html |6 +-
 doc/prebuilt/html/README.APPLICATIONS/index.html   |2 +-
 doc/prebuilt/html/README.INSTALL/index.html|2 +-
 .../html/TROUBLESHOOTING.COBALT/index.html |2 +-
 .../html/TROUBLESHOOTING.MERCURY/index.html|2 +-
 doc/prebuilt/html/man1/autotune/index.html |2 +-
 doc/prebuilt/html/man1/clocktest/index.html|2 +-
 doc/prebuilt/html/man1/corectl/index.html  |2 +-
 doc/prebuilt/html/man1/dohell/index.html   |2 +-
 doc/prebuilt/html/man1/latency/index.html  |2 +-
 doc/prebuilt/html/man1/rtcanconfig/index.html  |2 +-
 doc/prebuilt/html/man1/rtcanrecv/index.html|2 +-
 doc/prebuilt/html/man1/rtcansend/index.html|2 +-
 doc/prebuilt/html/man1/slackspot/index.html|2 +-
 doc/prebuilt/html/man1/switchtest/index.html   |2 +-
 doc/prebuilt/html/man1/xeno-config/index.html  |2 +-
 doc/prebuilt/html/man1/xeno-test/index.html|2 +-
 doc/prebuilt/html/man1/xeno/index.html |2 +-
 .../html/xeno3prm/16550A__io_8h_source.html|2 +-
 .../html/xeno3prm/16550A__pci_8h_source.html   |2 +-
 .../html/xeno3prm/16550A__pnp_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/8255_8h_source.html |2 +-
 doc/prebuilt/html/xeno3prm/af__inet_8h_source.html |2 +-
 .../html/xeno3prm/alchemy_2compat_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/analogy_2driver_8h.html |   60 +-
 .../html/xeno3prm/analogy_2driver_8h__incl.map |   58 +-
 .../html/xeno3prm/analogy_2driver_8h__incl.md5 |2 +-
 .../html/xeno3prm/analogy_2driver_8h__incl.png |  Bin 271875 -> 289554 
bytes
 .../html/xeno3prm/analogy_2driver_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/analogy_8h.html |2 +-
 doc/prebuilt/html/xeno3prm/analogy_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/annotated.html  |2 +-
 doc/prebuilt/html/xeno3prm/apc_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/api-tags.html   |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +-
 ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +-
 ...m_2include_2asm_2xenomai_2fptest_8h_source.html |2 +-
 ...lude_2asm_2xenomai_2uapi_2fptest_8h_source.html |2 +-
 doc/prebuilt/html/xeno3prm/arp_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/assert_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/async_8c.html   |2 +-
 doc/prebuilt/html/xeno3prm/atomic_8h_source.html   |2 +-
 doc/prebuilt/html/xeno3prm/bheap_8h_source.html|2 +-
 ...n_2include_2asm_2xenomai_2fptest_8h_source.html |2 +-
 ...lude_2asm_2xenomai_2uapi_2fptest_8h_source.html |2 +-
 .../boilerplate_2ancillaries_8h_source.html|  209 ++--
 .../html/xeno3prm/boilerplate_2list_8h_source.html |2 +-
 .../html/xeno3prm/boilerplate_2lock_8h_source.html |2 +-
 .../html/xeno3prm/boilerplate_2time_8h_source.html |2 +-
 .../xeno3prm/boilerplate_2tunables_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/bufd_8h_source.html |2 +-
 .../html/xeno3prm/bufp-label_8c-example.html   |2 +-
 .../html/xeno3prm/bufp-readwrite_8c-example.html   |2 +-
 doc/prebuilt/html/xeno3prm/c1e_8h_source.html  |2 +-
 doc/prebuilt/html/xeno3prm/calibration_8c.html |2 +-
 doc/prebuilt/html/xeno3prm/can-rtt_8c-example.html |2 +-
 doc/prebuilt/html/xeno3prm/channel__range_8h.html  |2 +-
 .../html/xeno3prm/channel__range_8h_source.html|2 +-
 doc/prebuilt/html/xeno3prm/classes.html|2 +-
 doc/prebuilt/html/xeno3prm/clockobj_8h_source.html |2 +-
 doc/prebuilt/html/xeno3prm/cluster_8h_source.html  |2 +-
 .../html/xeno3prm/cobalt-core_8h_source.html   | 1221 ++--
 .../html/xeno3prm/cobalt-posix_8h_source.html  |2 +-
 .../html/xeno3prm/cobalt-rtdm_8h_source.html   |  993 
 .../cobalt_2boilerplate_2limits_8h_source.html |2 +-
 .../cobalt_2boilerplate_2trace_8h_source.html  |2 +-
 .../cobalt_2kernel_2ancillaries_8h_source.html |2 +-
 .../xeno3prm/cobalt_2kernel_2compat_8h_source.html |2 +-
 .../xeno3prm/cobalt_2kernel_2init_8h_source.html   |2 +-
 

[Xenomai-git] Philippe Gerum : cobalt/x86: upgrade I-pipe support

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: d05500a29b6b8613ad54b95a1ed46138d70df369
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d05500a29b6b8613ad54b95a1ed46138d70df369

Author: Philippe Gerum 
Date:   Sun Mar 13 12:12:27 2016 +0100

cobalt/x86: upgrade I-pipe support

---

 ...-x86-6.patch => ipipe-core-3.10.32-x86-7.patch} |  135 ---
 ...x86-9.patch => ipipe-core-3.14.44-x86-11.patch} |  383 
 ...-x86-3.patch => ipipe-core-3.18.20-x86-5.patch} |  230 +++-
 ...8-x86-1.patch => ipipe-core-4.1.18-x86-2.patch} |   15 +-
 4 files changed, 467 insertions(+), 296 deletions(-)

diff --git a/kernel/cobalt/arch/x86/patches/ipipe-core-3.10.32-x86-6.patch 
b/kernel/cobalt/arch/x86/patches/ipipe-core-3.10.32-x86-7.patch
similarity index 99%
rename from kernel/cobalt/arch/x86/patches/ipipe-core-3.10.32-x86-6.patch
rename to kernel/cobalt/arch/x86/patches/ipipe-core-3.10.32-x86-7.patch
index 04b1d47..2702f29 100644
--- a/kernel/cobalt/arch/x86/patches/ipipe-core-3.10.32-x86-6.patch
+++ b/kernel/cobalt/arch/x86/patches/ipipe-core-3.10.32-x86-7.patch
@@ -1,5 +1,5 @@
 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index fe120da..6882e5c 100644
+index fe120da..19c951e 100644
 --- a/arch/x86/Kconfig
 +++ b/arch/x86/Kconfig
 @@ -9,6 +9,7 @@ config 64BIT
@@ -10,17 +10,18 @@ index fe120da..6882e5c 100644
select CLKSRC_I8253
select HAVE_UID16
  
-@@ -20,6 +21,9 @@ config X86_64
+@@ -20,6 +21,10 @@ config X86_64
  ### Arch settings
  config X86
def_bool y
 +  select IPIPE_HAVE_HOSTRT if IPIPE
 +  select IPIPE_HAVE_VM_NOTIFIER if IPIPE
 +  select IPIPE_HAVE_SAFE_THREAD_INFO if X86_64
++  select IPIPE_WANT_PTE_PINNING if IPIPE
select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
select HAVE_AOUT if X86_32
select HAVE_UNSTABLE_SCHED_CLOCK
-@@ -106,7 +110,7 @@ config X86
+@@ -106,7 +111,7 @@ config X86
select GENERIC_CLOCKEVENTS
select ARCH_CLOCKSOURCE_DATA if X86_64
select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && 
X86_LOCAL_APIC)
@@ -29,7 +30,7 @@ index fe120da..6882e5c 100644
select KTIME_SCALAR if X86_32
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
-@@ -605,6 +609,7 @@ if HYPERVISOR_GUEST
+@@ -605,6 +610,7 @@ if HYPERVISOR_GUEST
  
  config PARAVIRT
bool "Enable paravirtualization code"
@@ -37,7 +38,7 @@ index fe120da..6882e5c 100644
---help---
  This changes the kernel so it can modify itself when it is run
  under a hypervisor, potentially improving performance significantly
-@@ -837,6 +842,8 @@ config SCHED_MC
+@@ -837,6 +843,8 @@ config SCHED_MC
  
  source "kernel/Kconfig.preempt"
  
@@ -276,7 +277,7 @@ index 615fa90..e0a62ab 100644
  extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask,
 diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h
 new file mode 100644
-index 000..9e2c783
+index 000..6e490b5
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,104 @@
@@ -306,7 +307,7 @@ index 000..9e2c783
 +
 +#ifdef CONFIG_IPIPE
 +
-+#define IPIPE_CORE_RELEASE6
++#define IPIPE_CORE_RELEASE7
 +
 +struct ipipe_domain;
 +
@@ -2058,7 +2059,7 @@ index deeb48d..4c1be96 100644
  #else /* CONFIG_X86_64 */
  
 diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c 
b/arch/x86/kernel/cpu/mtrr/cyrix.c
-index 68a3343..057710f 100644
+index 68a3343..057710f3 100644
 --- a/arch/x86/kernel/cpu/mtrr/cyrix.c
 +++ b/arch/x86/kernel/cpu/mtrr/cyrix.c
 @@ -18,7 +18,7 @@ cyrix_get_arr(unsigned int reg, unsigned long *base,
@@ -4710,7 +4711,7 @@ index 4f74d94..022d754 100644
  
do {
 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
-index c1e9e4c..0d05419 100644
+index c1e9e4c..ee21fbd 100644
 --- a/arch/x86/mm/fault.c
 +++ b/arch/x86/mm/fault.c
 @@ -355,9 +355,9 @@ void vmalloc_sync_all(void)
@@ -4764,7 +4765,7 @@ index c1e9e4c..0d05419 100644
  }
 +
 +#ifdef CONFIG_IPIPE
-+void __ipipe_pin_range_globally(unsigned long start, unsigned long end)
++void __ipipe_pin_mapping_globally(unsigned long start, unsigned long end)
 +{
 +#ifdef CONFIG_X86_32
 +  unsigned long next, addr = start;
@@ -5554,10 +,10 @@ index e6bb36a..898a91a 100644
  
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 000..525f3cf
+index 000..4ef7e3d
 --- /dev/null
 +++ b/include/linux/ipipe.h
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,449 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe.h
 + *
@@ -5964,6 +5965,12 @@ index 000..525f3cf
 +#define __ipipe_uaccess_might_fault() might_fault()
 +#endif
 +
++#ifdef CONFIG_IPIPE_TRACE
++void __ipipe_tracer_hrclock_initialized(void);
++#else /* !CONFIG_IPIPE_TRACE */
++#define __ipipe_tracer_hrclock_initialized()  do { } while(0)
++#endif /* !CONFIG_IPIPE_TRACE */
++
 +#include 
 +
 +#else /* !CONFIG_IPIPE */
@@ -6003,10 +6010,10 @@ index 000..525f3cf
 +#endif/* 

[Xenomai-git] Philippe Gerum : include/boilerplate: add shorthand for deprecated calls

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: efd5d7448fc915fb5d6b839340ee1be963aac2da
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=efd5d7448fc915fb5d6b839340ee1be963aac2da

Author: Philippe Gerum 
Date:   Fri Mar 18 13:01:38 2016 +0100

include/boilerplate: add shorthand for deprecated calls

---

 include/boilerplate/compiler.h |4 
 include/cobalt/stdio.h |3 +--
 include/cobalt/wrappers.h  |2 ++
 include/trank/native/misc.h|4 ++--
 include/trank/native/task.h|2 +-
 include/trank/native/timer.h   |2 +-
 include/trank/trank.h  |4 ++--
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e27d165..e558f73 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -54,4 +54,8 @@
 #define __aligned(__n) __attribute__((aligned (__n)))
 #endif
 
+#ifndef __deprecated
+#define __deprecated   __attribute__((__deprecated__))
+#endif
+
 #endif /* _BOILERPLATE_COMPILER_H */
diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h
index 0d97b83..81486d5 100644
--- a/include/cobalt/stdio.h
+++ b/include/cobalt/stdio.h
@@ -114,8 +114,7 @@ void rt_print_flush_buffers(void);
 
 void assert_nrt(void);
 
-__attribute__((__deprecated__))
-void assert_nrt_fast(void);
+__deprecated void assert_nrt_fast(void);
 
 #ifdef __cplusplus
 }
diff --git a/include/cobalt/wrappers.h b/include/cobalt/wrappers.h
index 975f7a3..7e061ca 100644
--- a/include/cobalt/wrappers.h
+++ b/include/cobalt/wrappers.h
@@ -18,6 +18,8 @@
 #ifndef _COBALT_WRAPPERS_H
 #define _COBALT_WRAPPERS_H
 
+#include 
+
 #define __stringify_1(x...)#x
 #define __stringify(x...)  __stringify_1(x)
 
diff --git a/include/trank/native/misc.h b/include/trank/native/misc.h
index bf0ed17..ea242d2 100644
--- a/include/trank/native/misc.h
+++ b/include/trank/native/misc.h
@@ -32,7 +32,7 @@ typedef struct rt_ioregion {
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_io_get_region(RT_IOREGION *iorn,
   const char *name,
   uint64_t start,
@@ -43,7 +43,7 @@ static inline int rt_io_get_region(RT_IOREGION *iorn,
return -ENOSYS;
 }
 
-__attribute__((__deprecated__))
+__deprecated
 int rt_io_put_region(RT_IOREGION *iorn)
 {
trank_warning("service should be provided by a RTDM driver");
diff --git a/include/trank/native/task.h b/include/trank/native/task.h
index 5c4d354..85c3cd4 100644
--- a/include/trank/native/task.h
+++ b/include/trank/native/task.h
@@ -35,7 +35,7 @@
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_task_notify(RT_TASK *task, rt_sigset_t sigs)
 {
trank_warning("in-kernel native API is gone, rebase over RTDM");
diff --git a/include/trank/native/timer.h b/include/trank/native/timer.h
index 7ccba1c..9cb606d 100644
--- a/include/trank/native/timer.h
+++ b/include/trank/native/timer.h
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_timer_set_mode(RTIME nstick)
 {
 #ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
diff --git a/include/trank/trank.h b/include/trank/trank.h
index 693c015..2477d45 100644
--- a/include/trank/trank.h
+++ b/include/trank/trank.h
@@ -18,6 +18,8 @@
 #ifndef _XENOMAI_TRANK_TRANK_H
 #define _XENOMAI_TRANK_TRANK_H
 
+#include 
+
 #ifdef __XENO_COMPAT__
 
 void warning(const char *fmt, ...);
@@ -32,8 +34,6 @@ void warning(const char *fmt, ...);
 
 #else /* !__XENO_COMPAT__ */
 
-#include 
-
 #define __CURRENT(call)call
 
 #define COMPAT_DECL(T, P)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/kernel: raise default sysheap size to 512 Kb

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: af2e279b89554fb805b8d94c61fef4dd949bff56
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=af2e279b89554fb805b8d94c61fef4dd949bff56

Author: Philippe Gerum 
Date:   Fri Mar  4 17:59:16 2016 +0100

cobalt/kernel: raise default sysheap size to 512 Kb

---

 kernel/cobalt/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index afa62d2..24f09e8 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -257,7 +257,7 @@ config XENO_OPT_REGISTRY_NRSLOTS
 
 config XENO_OPT_SYS_HEAPSZ
int "Size of system heap (Kb)"
-   default 256
+   default 512
help
The system heap is used for various internal allocations by
the Cobalt kernel. The size is expressed in Kilobytes.


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/umm: get UMM heaps from the normal zone

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: b34fa9d81f55127b42c000a87d09bb14b17c3e39
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b34fa9d81f55127b42c000a87d09bb14b17c3e39

Author: Philippe Gerum 
Date:   Fri Mar  4 11:27:07 2016 +0100

cobalt/umm: get UMM heaps from the normal zone

---

 kernel/cobalt/posix/memory.c  |2 +-
 kernel/cobalt/posix/process.c |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/cobalt/posix/memory.c b/kernel/cobalt/posix/memory.c
index 5304272..1d888a2 100644
--- a/kernel/cobalt/posix/memory.c
+++ b/kernel/cobalt/posix/memory.c
@@ -321,7 +321,7 @@ int cobalt_umm_init(struct cobalt_umm *umm, u32 size,
secondary_mode_only();
 
size = PAGE_ALIGN(size);
-   basemem = __vmalloc(size, GFP_KERNEL|__GFP_HIGHMEM|__GFP_ZERO,
+   basemem = __vmalloc(size, GFP_KERNEL|__GFP_ZERO,
xnarch_cache_aliasing() ?
pgprot_noncached(PAGE_KERNEL) : PAGE_KERNEL);
if (basemem == NULL)
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 28fde9e..5c152e8 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/arm: upgrade I-pipe support

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 31c62a9ebf6c2e6b6642a4134eaeb56a7db09890
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=31c62a9ebf6c2e6b6642a4134eaeb56a7db09890

Author: Philippe Gerum 
Date:   Sun Mar 13 12:06:51 2016 +0100

cobalt/arm: upgrade I-pipe support

---

 ...rm-10.patch => ipipe-core-3.10.32-arm-11.patch} |  106 +++
 ...rm-12.patch => ipipe-core-3.14.44-arm-15.patch} |  197 +---
 ...-arm-6.patch => ipipe-core-3.18.20-arm-8.patch} |   71 ---
 ...8-arm-1.patch => ipipe-core-4.1.18-arm-2.patch} |   45 ++---
 4 files changed, 262 insertions(+), 157 deletions(-)

diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-10.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-11.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-10.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-11.patch
index 5ff3658..092b67d 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-10.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.10.32-arm-11.patch
@@ -1092,7 +1092,7 @@ index bb28af7..780ca50 100644
  static inline void sp804_clockevents_init(void __iomem *base, unsigned int 
irq, const char *name)
 diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
 new file mode 100644
-index 000..7599b0d
+index 000..c7704e8
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,274 @@
@@ -1140,7 +1140,7 @@ index 000..7599b0d
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE10
++#define IPIPE_CORE_RELEASE11
 +
 +struct ipipe_domain;
 +
@@ -3712,10 +3712,10 @@ index 000..5b77cfb
 +EXPORT_SYMBOL_GPL(cpu_architecture);
 diff --git a/arch/arm/kernel/ipipe_tsc.c b/arch/arm/kernel/ipipe_tsc.c
 new file mode 100644
-index 000..fa2d382
+index 000..f04e048
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe_tsc.c
-@@ -0,0 +1,179 @@
+@@ -0,0 +1,181 @@
 +#include 
 +#include 
 +#include 
@@ -3858,6 +3858,8 @@ index 000..fa2d382
 +  __clocksource_updatefreq_hz(, tsc_info.freq);
 +
 +  __ipipe_kuser_tsc_freq = tsc_info.freq;
++
++  __ipipe_tracer_hrclock_initialized();
 +}
 +
 +void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
@@ -11051,7 +11053,7 @@ index 8ea3b33..1079825 100644
  }
  
 diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
-index 19ceaa6..d56f20a 100644
+index 19ceaa6..16c312a 100644
 --- a/drivers/irqchip/irq-gic.c
 +++ b/drivers/irqchip/irq-gic.c
 @@ -41,6 +41,7 @@
@@ -11071,12 +11073,10 @@ index 19ceaa6..d56f20a 100644
  
  /*
   * The GIC mapping of CPU interfaces does not necessarily match
-@@ -153,37 +154,74 @@ static inline unsigned int gic_irq(struct irq_data *d)
-  */
+@@ -154,36 +155,73 @@ static inline unsigned int gic_irq(struct irq_data *d)
  static void gic_mask_irq(struct irq_data *d)
  {
--  u32 mask = 1 << (gic_irq(d) % 32);
-+  u32 mask = 1 << (d->irq % 32);
+   u32 mask = 1 << (gic_irq(d) % 32);
 +  unsigned long flags;
  
 -  raw_spin_lock(_controller_lock);
@@ -11091,8 +11091,7 @@ index 19ceaa6..d56f20a 100644
  
  static void gic_unmask_irq(struct irq_data *d)
  {
--  u32 mask = 1 << (gic_irq(d) % 32);
-+  u32 mask = 1 << (d->irq % 32);
+   u32 mask = 1 << (gic_irq(d) % 32);
 +  unsigned long flags;
  
 -  raw_spin_lock(_controller_lock);
@@ -8,14 +7,14 @@ index 19ceaa6..d56f20a 100644
 +  raw_spin_unlock_irqrestore_cond(_controller_lock, flags);
 +  writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
 +}
-+
+ 
 +#ifdef CONFIG_IPIPE
 +
 +static void gic_hold_irq(struct irq_data *d)
 +{
-+  u32 mask = 1 << (d->irq % 32);
++  u32 mask = 1 << (gic_irq(d) % 32);
 +  unsigned long flags;
- 
++
 +  raw_spin_lock_irqsave_cond(_controller_lock, flags);
 +  writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + 
(gic_irq(d) / 32) * 4);
 +  if (gic_arch_extn.irq_mask)
@@ -11139,7 +11138,7 @@ index 19ceaa6..d56f20a 100644
 +
 +static void gic_release_irq(struct irq_data *d)
 +{
-+  u32 mask = 1 << (d->irq % 32);
++  u32 mask = 1 << (gic_irq(d) % 32);
 +  unsigned long flags;
 +
 +  raw_spin_lock_irqsave_cond(_controller_lock, flags);
@@ -11984,10 +11983,10 @@ index e6bb36a..898a91a 100644
  
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 000..525f3cf
+index 000..4ef7e3d
 --- /dev/null
 +++ b/include/linux/ipipe.h
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,449 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe.h
 + *
@@ -12394,6 +12393,12 @@ index 000..525f3cf
 +#define __ipipe_uaccess_might_fault() might_fault()
 +#endif
 +
++#ifdef CONFIG_IPIPE_TRACE
++void __ipipe_tracer_hrclock_initialized(void);
++#else /* !CONFIG_IPIPE_TRACE */
++#define __ipipe_tracer_hrclock_initialized()  do { } while(0)
++#endif /* !CONFIG_IPIPE_TRACE */
++
 +#include 
 +
 +#else /* !CONFIG_IPIPE */
@@ 

[Xenomai-git] Philippe Gerum : cobalt/init: get system heap from the normal zone

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 1e3bf2f96b54b75b2f8764beb4f1ead70a4ffbb0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1e3bf2f96b54b75b2f8764beb4f1ead70a4ffbb0

Author: Philippe Gerum 
Date:   Fri Mar  4 11:26:39 2016 +0100

cobalt/init: get system heap from the normal zone

---

 kernel/cobalt/init.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c
index 6cbb67b..5a6fdbf 100644
--- a/kernel/cobalt/init.c
+++ b/kernel/cobalt/init.c
@@ -18,7 +18,6 @@
  */
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -156,7 +155,7 @@ static void sys_shutdown(void)
xnregistry_cleanup();
membase = xnheap_get_membase(_heap);
xnheap_destroy(_heap);
-   vfree(membase);
+   xnheap_vfree(membase);
 }
 
 static int __init mach_setup(void)
@@ -289,7 +288,7 @@ static __init int sys_init(void)
if (sysheap_size_arg == 0)
sysheap_size_arg = CONFIG_XENO_OPT_SYS_HEAPSZ;
 
-   heapaddr = vmalloc(sysheap_size_arg * 1024);
+   heapaddr = xnheap_vmalloc(sysheap_size_arg * 1024);
if (heapaddr == NULL ||
xnheap_init(_heap, heapaddr, sysheap_size_arg * 1024)) {
return -ENOMEM;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt/mutex: add support for priority ceiling protocol

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 34042751afac0e22495189fcafe84f1736059339
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=34042751afac0e22495189fcafe84f1736059339

Author: Philippe Gerum 
Date:   Tue Feb 16 10:13:03 2016 +0100

lib/cobalt/mutex: add support for priority ceiling protocol

---

 configure.ac   |2 +
 include/boilerplate/libc.h |   19 +++
 include/cobalt/pthread.h   |7 ++
 lib/cobalt/cobalt.wrappers |2 +
 lib/cobalt/init.c  |1 +
 lib/cobalt/internal.h  |8 ++
 lib/cobalt/mutex.c |  301 +++-
 lib/cobalt/sched.c |   33 -
 lib/cobalt/thread.c|7 +-
 9 files changed, 311 insertions(+), 69 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8bbeeef..578327e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -504,6 +504,8 @@ save_LIBS="$LIBS"
 LIBS="$LIBS -lrt -lpthread"
 AC_CHECK_FUNCS([pthread_mutexattr_setprotocol  \
pthread_mutexattr_getprotocol   \
+   pthread_mutexattr_getprioceiling \
+   pthread_mutexattr_setprioceiling \
pthread_mutexattr_setrobust_np  \
pthread_condattr_getclock   \
pthread_condattr_setclock   \
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 0e51b86..3a5af8c 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -108,6 +108,25 @@ int pthread_mutexattr_getprotocol(const 
pthread_mutexattr_t *
 }
 #endif /* !HAVE_PTHREAD_MUTEXATTR_GETPROTOCOL */
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING
+static inline
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
+int prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING */
+
+#ifndef HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING
+static inline
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *
+ __restrict attr,
+int *__restrict prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
+
 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
 #include 
 static inline
diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index 386c337..f1b1c8a 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -67,6 +67,13 @@ COBALT_DECL(int, pthread_mutex_trylock(pthread_mutex_t 
*mutex));
 
 COBALT_DECL(int, pthread_mutex_unlock(pthread_mutex_t *mutex));
 
+COBALT_DECL(int, pthread_mutex_setprioceiling(pthread_mutex_t *__restrict 
mutex,
+ int prioceiling,
+ int *__restrict old_ceiling));
+  
+COBALT_DECL(int, pthread_mutex_getprioceiling(pthread_mutex_t *__restrict 
mutex,
+ int *__restrict old_ceiling));
+
 COBALT_DECL(int, pthread_cond_init (pthread_cond_t *cond,
const pthread_condattr_t *attr));
 
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 9480f34..75f29d6 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -32,6 +32,8 @@
 --wrap pthread_mutex_trylock
 --wrap pthread_mutex_timedlock
 --wrap pthread_mutex_unlock
+--wrap pthread_mutex_setprioceiling
+--wrap pthread_mutex_getprioceiling
 --wrap pthread_cond_init
 --wrap pthread_cond_destroy
 --wrap pthread_cond_wait
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index f260744..69d4763 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -177,6 +177,7 @@ static void __cobalt_init(void)
sizeof(struct cobalt_sem_shadow));
 
cobalt_mutex_init();
+   cobalt_sched_init();
cobalt_thread_init();
cobalt_print_init();
 }
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index fee3fe1..4b8252b 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -52,6 +52,8 @@ void cobalt_thread_init(void);
 
 int cobalt_thread_probe(pid_t pid);
 
+void cobalt_sched_init(void);
+
 void cobalt_print_init(void);
 
 void cobalt_print_init_atfork(void);
@@ -73,4 +75,10 @@ void cobalt_check_features(struct cobalt_featinfo *finfo);
 
 extern struct sigaction __cobalt_orig_sigdebug;
 
+extern int __cobalt_std_fifo_minpri,
+  __cobalt_std_fifo_maxpri;
+
+extern int __cobalt_std_rr_minpri,
+  __cobalt_std_rr_maxpri;
+
 #endif /* _LIB_COBALT_INTERNAL_H */
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 9d8a914..1456099 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -99,6 +99,9 @@ void cobalt_mutex_init(void)
  *   mutex, increase CONFIG_XENO_OPT_SHARED_HEAPSZ for a process-shared
  *   mutex, or CONFIG_XENO_OPT_PRIVATE_HEAPSZ for a process-private mutex.
  * - EAGAIN, no registry slot available, check/raise 
CONFIG_XENO_OPT_REGISTRY_NRSLOTS.
+ * - ENOSYS, @a attr 

[Xenomai-git] Philippe Gerum : utils/autotune: protect against SIGHUP in background mode

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: e95e7563c02aa86b438677f8a38427634c7d49c9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e95e7563c02aa86b438677f8a38427634c7d49c9

Author: Philippe Gerum 
Date:   Sat Mar 19 08:44:34 2016 +0100

utils/autotune: protect against SIGHUP in background mode

---

 utils/autotune/autotune.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index 5c3e0fe..f52733b 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -285,6 +286,7 @@ int main(int argc, char *const argv[])
error(1, errno, "cannot set CPU affinity");
 
if (background) {
+   signal(SIGHUP, SIG_IGN);
ret = daemon(0, 0);
if (ret)
error(1, errno, "cannot daemonize");


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/powerpc: upgrade I-pipe support

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: fa916f9c245a72480de7b98d555bb05087971c6c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fa916f9c245a72480de7b98d555bb05087971c6c

Author: Philippe Gerum 
Date:   Wed Mar  2 17:02:11 2016 +0100

cobalt/powerpc: upgrade I-pipe support

---

 ...powerpc-1.patch => ipipe-core-4.1.18-powerpc-2.patch} |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/kernel/cobalt/arch/powerpc/patches/ipipe-core-4.1.18-powerpc-1.patch 
b/kernel/cobalt/arch/powerpc/patches/ipipe-core-4.1.18-powerpc-2.patch
similarity index 99%
rename from kernel/cobalt/arch/powerpc/patches/ipipe-core-4.1.18-powerpc-1.patch
rename to kernel/cobalt/arch/powerpc/patches/ipipe-core-4.1.18-powerpc-2.patch
index a5f320d..97fd4a6 100644
--- a/kernel/cobalt/arch/powerpc/patches/ipipe-core-4.1.18-powerpc-1.patch
+++ b/kernel/cobalt/arch/powerpc/patches/ipipe-core-4.1.18-powerpc-2.patch
@@ -304,7 +304,7 @@ index b59ac27..9cc1d25 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..af33819
+index 000..837a554
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,151 @@
@@ -349,7 +349,7 @@ index 000..af33819
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE1
++#define IPIPE_CORE_RELEASE2
 +
 +struct ipipe_domain;
 +
@@ -2437,7 +2437,7 @@ index 112ccf4..5dd70f7 100644
li  r0,0
 diff --git a/arch/powerpc/kernel/ipipe.c b/arch/powerpc/kernel/ipipe.c
 new file mode 100644
-index 000..d628fd56
+index 000..9a5702a
 --- /dev/null
 +++ b/arch/powerpc/kernel/ipipe.c
 @@ -0,0 +1,372 @@
@@ -2556,7 +2556,7 @@ index 000..d628fd56
 +  if (WARN_ON_ONCE(irq_get_chip(irq)->irq_set_affinity == NULL))
 +  return;
 +
-+  if (WARN_ON_ONCE(cpumask_any_and(, _online_mask) >= 
nr_cpu_ids))
++  if (WARN_ON_ONCE(cpumask_any_and(, cpu_online_mask) >= 
nr_cpu_ids))
 +  return;
 +
 +  irq_get_chip(irq)->irq_set_affinity(irq_get_irq_data(irq), , 
true);
@@ -2581,7 +2581,7 @@ index 000..d628fd56
 +  goto out;
 +
 +  me = ipipe_processor_id();
-+  for_each_cpu_mask_nr(cpu, cpumask) {
++  for_each_cpu(cpu, ) {
 +  if (cpu != me)
 +  smp_ops->message_pass(cpu, PPC_MSG_IPIPE_DEMUX);
 +  }
@@ -3300,7 +3300,7 @@ index c69671c..66ac366 100644
  #endif
  
 diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
-index ec9ec20..ebe3c2b 100644
+index ec9ec20..a17ba31 100644
 --- a/arch/powerpc/kernel/smp.c
 +++ b/arch/powerpc/kernel/smp.c
 @@ -179,7 +179,7 @@ const char *smp_ipi_name[] = {
@@ -3334,7 +3334,7 @@ index ec9ec20..ebe3c2b 100644
 -  if (cpu != me)
 +  if (cpu != me) {
 +#ifdef CONFIG_IPIPE
-+  cpu_set(cpu, __ipipe_dbrk_pending);
++  cpumask_set_cpu(cpu, &__ipipe_dbrk_pending);
 +#endif
do_message_pass(cpu, PPC_MSG_DEBUGGER_BREAK);
 +  }


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/smokey: mutex: simplify, introduce PP tests

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: fd5b395469ea6f088b3f05995d0df648cfee4fd2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fd5b395469ea6f088b3f05995d0df648cfee4fd2

Author: Philippe Gerum 
Date:   Wed Feb 17 09:21:27 2016 +0100

testsuite/smokey: mutex: simplify, introduce PP tests

At this chance, the lock stealing test is also fixed.

---

 testsuite/smokey/posix-mutex/posix-mutex.c | 1357 ++--
 1 file changed, 670 insertions(+), 687 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ac71b31..ae82fc1 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -4,6 +4,7 @@
  * Copyright (C) Gilles Chanteperdrix  ,
  *   Marion Deveaud ,
  *   Jan Kiszka 
+ *   Philippe Gerum 
  *
  * Released under the terms of GPLv2.
  */
@@ -17,8 +18,6 @@
 #include 
 #include 
 #include 
-#include 
-#include "lib/cobalt/current.h"
 #include 
 
 smokey_test_plugin(posix_mutex,
@@ -26,886 +25,870 @@ smokey_test_plugin(posix_mutex,
   "Check POSIX mutex services"
 );
 
-#define MUTEX_CREATE   1
-#define MUTEX_LOCK 2
-#define MUTEX_TRYLOCK  3
-#define MUTEX_TIMED_LOCK   4
-#define MUTEX_UNLOCK   5
-#define MUTEX_DESTROY  6
-#define COND_CREATE7
-#define COND_SIGNAL8
-#define COND_WAIT  9
-#define COND_DESTROY   10
-#define THREAD_DETACH  11
-#define THREAD_CREATE  12
-#define THREAD_JOIN13
-#define THREAD_RENICE   14
-
-#define NS_PER_MS  100
-
 static const char *reason_str[] = {
-   [SIGDEBUG_UNDEFINED] = "undefined",
+   [SIGDEBUG_UNDEFINED] = "received SIGDEBUG for unknown reason",
[SIGDEBUG_MIGRATE_SIGNAL] = "received signal",
[SIGDEBUG_MIGRATE_SYSCALL] = "invoked syscall",
[SIGDEBUG_MIGRATE_FAULT] = "triggered fault",
[SIGDEBUG_MIGRATE_PRIOINV] = "affected by priority inversion",
-   [SIGDEBUG_NOMLOCK] = "missing mlockall",
-   [SIGDEBUG_WATCHDOG] = "runaway thread",
+   [SIGDEBUG_NOMLOCK] = "process memory not locked",
+   [SIGDEBUG_WATCHDOG] = "watchdog triggered (period too short?)",
+   [SIGDEBUG_LOCK_BREAK] = "scheduler lock break",
 };
 
 static void sigdebug(int sig, siginfo_t *si, void *context)
 {
+   const char fmt[] = "%s, this is unexpected.\n"
+   "(enabling CONFIG_XENO_OPT_DEBUG_TRACE_RELAX may help)\n";
unsigned int reason = sigdebug_reason(si);
+   int n __attribute__ ((unused));
+   static char buffer[256];
 
-   smokey_trace("\nSIGDEBUG received, reason %d: %s\n", reason,
-reason <= SIGDEBUG_WATCHDOG ? reason_str[reason] : 
"");
-}
+   if (reason > SIGDEBUG_WATCHDOG)
+   reason = SIGDEBUG_UNDEFINED;
 
-static inline unsigned long long timer_get_tsc(void)
-{
-   return clockobj_get_tsc();
+   n = snprintf(buffer, sizeof(buffer), fmt, reason_str[reason]);
+   n = write(STDERR_FILENO, buffer, n);
 }
 
-static inline unsigned long long timer_tsc2ns(unsigned long long tsc)
-{
-   return clockobj_tsc_to_ns(tsc);
-}
+#define THREAD_PRIO_WEAK   0
+#define THREAD_PRIO_LOW1
+#define THREAD_PRIO_MEDIUM 2
+#define THREAD_PRIO_HIGH   3
+#define THREAD_PRIO_VERY_HIGH  4
 
-static void add_timespec(struct timespec *ts, unsigned long long value)
-{
-   ts->tv_sec += value / 10;
-   ts->tv_nsec += value % 10;
-   if (ts->tv_nsec > 10) {
-   ts->tv_sec++;
-   ts->tv_nsec -= 10;
-   }
-}
+#define MAX_100_MS  1ULL
+
+struct locker_context {
+   pthread_mutex_t *mutex;
+   struct smokey_barrier *barrier;
+   int lock_acquired;
+};
 
-static void ms_sleep(int time)
+static void sleep_ms(unsigned int ms)  /* < 1000 */
 {
struct timespec ts;
-
+   
ts.tv_sec = 0;
-   ts.tv_nsec = time*NS_PER_MS;
-
-   nanosleep(, NULL);
+   ts.tv_nsec = ms * 100;
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
 }
 
-static void check_current_prio(int expected_prio)
+static int get_effective_prio(void) 
 {
struct cobalt_threadstat stat;
int ret;
 
ret = cobalt_thread_stat(0, );
-   if (ret) {
-   fprintf(stderr,
-   "FAILURE: cobalt_threadstat (%s)\n", strerror(-ret));
-   exit(EXIT_FAILURE);
-   }
+   if (ret)
+   return ret;
 
-   if (stat.cprio != expected_prio) {
-   fprintf(stderr,
-   "FAILURE: current prio (%d) != expected prio (%d)\n",
-   stat.cprio, expected_prio);
-   exit(EXIT_FAILURE);
-   }
+   

[Xenomai-git] Philippe Gerum : lib/cobalt: simplify checks for secondary mode

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e0f1cd9568e3f00b2a148b6902327fc36346c25d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e0f1cd9568e3f00b2a148b6902327fc36346c25d

Author: Philippe Gerum 
Date:   Fri Mar 18 12:00:55 2016 +0100

lib/cobalt: simplify checks for secondary mode

Whether a current thread is currently running in primary/secondary
mode can be checked by inspecting the status of the XNRELAX bit in the
thread's u_window. The lack of u_window denotes a non-Xenomai, regular
thread which for which the current mode is always relaxed.

A thread's handle and its u_window area are tightly coupled: the
latter has to be valid for any thread with a valid handle.

Introduce cobalt_is_relaxed() for testing the current mode, and fixup
all open coded versions of this routine.

In addition, assert_nrt_fast() is marked as deprecated, since
assert_nrt() is not a slow call anymore.

---

 include/cobalt/stdio.h  |1 +
 lib/cobalt/assert_context.c |   14 +++---
 lib/cobalt/internal.c   |4 +---
 lib/cobalt/internal.h   |7 ++-
 lib/cobalt/printf.c |   27 +--
 5 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h
index f0c289d..0d97b83 100644
--- a/include/cobalt/stdio.h
+++ b/include/cobalt/stdio.h
@@ -114,6 +114,7 @@ void rt_print_flush_buffers(void);
 
 void assert_nrt(void);
 
+__attribute__((__deprecated__))
 void assert_nrt_fast(void);
 
 #ifdef __cplusplus
diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c
index da5f2b0..2085953 100644
--- a/lib/cobalt/assert_context.c
+++ b/lib/cobalt/assert_context.c
@@ -45,21 +45,13 @@ static void assert_nrt_inner(void)
 
 void assert_nrt(void)
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
assert_nrt_inner();
 }
 
-/*
- * Note: Works without syscalls but may not catch all errors when used inside
- * TSD destructors (as registered via pthread_key_create) when TLS support
- * (__thread) is disabled.
- */
-void assert_nrt_fast(void)
+void assert_nrt_fast(void) /* OBSOLETE */
 {
-   if (cobalt_get_current_fast() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
-   assert_nrt_inner();
+   assert_nrt();
 }
 
 /* Memory allocation services */
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 9220237..5b89db5 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -54,9 +54,7 @@ void cobalt_thread_harden(void)
 
 void cobalt_thread_relax(void)
 {
-   int status = cobalt_get_current_mode();
-
-   if ((status & XNRELAX) == 0)
+   if (!cobalt_is_relaxed())
XENOMAI_SYSCALL1(sc_cobalt_migrate, COBALT_SECONDARY);
 }
 
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 69ec7d1..fee3fe1 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -27,7 +27,10 @@ extern void *cobalt_umm_private;
 
 extern void *cobalt_umm_shared;
 
-void cobalt_sigshadow_install_once(void);
+static inline int cobalt_is_relaxed(void)
+{
+   return cobalt_get_current_mode() & XNRELAX;
+}
 
 static inline
 struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
@@ -43,6 +46,8 @@ static inline atomic_t *mutex_get_ownerp(struct 
cobalt_mutex_shadow *shadow)
return _get_state(shadow)->owner;
 }
 
+void cobalt_sigshadow_install_once(void);
+
 void cobalt_thread_init(void);
 
 int cobalt_thread_probe(pid_t pid);
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index 797a9b5..87cd5e2 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -730,8 +730,7 @@ done:
 
 COBALT_IMPL(int, vfprintf, (FILE *stream, const char *fmt, va_list args))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_vfprintf(stream, fmt, args);
else {
rt_print_flush_buffers();
@@ -770,8 +769,7 @@ COBALT_IMPL(int, printf, (const char *fmt, ...))
 
 COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_fputs(s, stream);
else {
rt_print_flush_buffers();
@@ -781,8 +779,7 @@ COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 
 COBALT_IMPL(int, puts, (const char *s))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_puts(s);
else {
rt_print_flush_buffers();
@@ -794,8 +791,7 @@ COBALT_IMPL(int, puts, (const char *s))
 
 COBALT_IMPL(int, fputc, (int c, FILE *stream))
 {
-   if 

[Xenomai-git] Philippe Gerum : include/boilerplate: add shorthand for deprecated calls

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: efd5d7448fc915fb5d6b839340ee1be963aac2da
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=efd5d7448fc915fb5d6b839340ee1be963aac2da

Author: Philippe Gerum 
Date:   Fri Mar 18 13:01:38 2016 +0100

include/boilerplate: add shorthand for deprecated calls

---

 include/boilerplate/compiler.h |4 
 include/cobalt/stdio.h |3 +--
 include/cobalt/wrappers.h  |2 ++
 include/trank/native/misc.h|4 ++--
 include/trank/native/task.h|2 +-
 include/trank/native/timer.h   |2 +-
 include/trank/trank.h  |4 ++--
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e27d165..e558f73 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -54,4 +54,8 @@
 #define __aligned(__n) __attribute__((aligned (__n)))
 #endif
 
+#ifndef __deprecated
+#define __deprecated   __attribute__((__deprecated__))
+#endif
+
 #endif /* _BOILERPLATE_COMPILER_H */
diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h
index 0d97b83..81486d5 100644
--- a/include/cobalt/stdio.h
+++ b/include/cobalt/stdio.h
@@ -114,8 +114,7 @@ void rt_print_flush_buffers(void);
 
 void assert_nrt(void);
 
-__attribute__((__deprecated__))
-void assert_nrt_fast(void);
+__deprecated void assert_nrt_fast(void);
 
 #ifdef __cplusplus
 }
diff --git a/include/cobalt/wrappers.h b/include/cobalt/wrappers.h
index 975f7a3..7e061ca 100644
--- a/include/cobalt/wrappers.h
+++ b/include/cobalt/wrappers.h
@@ -18,6 +18,8 @@
 #ifndef _COBALT_WRAPPERS_H
 #define _COBALT_WRAPPERS_H
 
+#include 
+
 #define __stringify_1(x...)#x
 #define __stringify(x...)  __stringify_1(x)
 
diff --git a/include/trank/native/misc.h b/include/trank/native/misc.h
index bf0ed17..ea242d2 100644
--- a/include/trank/native/misc.h
+++ b/include/trank/native/misc.h
@@ -32,7 +32,7 @@ typedef struct rt_ioregion {
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_io_get_region(RT_IOREGION *iorn,
   const char *name,
   uint64_t start,
@@ -43,7 +43,7 @@ static inline int rt_io_get_region(RT_IOREGION *iorn,
return -ENOSYS;
 }
 
-__attribute__((__deprecated__))
+__deprecated
 int rt_io_put_region(RT_IOREGION *iorn)
 {
trank_warning("service should be provided by a RTDM driver");
diff --git a/include/trank/native/task.h b/include/trank/native/task.h
index 5c4d354..85c3cd4 100644
--- a/include/trank/native/task.h
+++ b/include/trank/native/task.h
@@ -35,7 +35,7 @@
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_task_notify(RT_TASK *task, rt_sigset_t sigs)
 {
trank_warning("in-kernel native API is gone, rebase over RTDM");
diff --git a/include/trank/native/timer.h b/include/trank/native/timer.h
index 7ccba1c..9cb606d 100644
--- a/include/trank/native/timer.h
+++ b/include/trank/native/timer.h
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_timer_set_mode(RTIME nstick)
 {
 #ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
diff --git a/include/trank/trank.h b/include/trank/trank.h
index 693c015..2477d45 100644
--- a/include/trank/trank.h
+++ b/include/trank/trank.h
@@ -18,6 +18,8 @@
 #ifndef _XENOMAI_TRANK_TRANK_H
 #define _XENOMAI_TRANK_TRANK_H
 
+#include 
+
 #ifdef __XENO_COMPAT__
 
 void warning(const char *fmt, ...);
@@ -32,8 +34,6 @@ void warning(const char *fmt, ...);
 
 #else /* !__XENO_COMPAT__ */
 
-#include 
-
 #define __CURRENT(call)call
 
 #define COMPAT_DECL(T, P)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/powerpc: upgrade I-pipe support

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 8c3bb4a5c83e24eddd868f756604ce28454fc97b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8c3bb4a5c83e24eddd868f756604ce28454fc97b

Author: Philippe Gerum 
Date:   Sun Mar 13 12:08:26 2016 +0100

cobalt/powerpc: upgrade I-pipe support

---

 ...-6.patch => ipipe-core-3.10.32-powerpc-7.patch} |  133 ++--
 ...9.patch => ipipe-core-3.14.44-powerpc-12.patch} |  168 ++--
 ...-3.patch => ipipe-core-3.18.20-powerpc-5.patch} |   53 --
 3 files changed, 232 insertions(+), 122 deletions(-)

diff --git 
a/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.10.32-powerpc-6.patch 
b/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.10.32-powerpc-7.patch
similarity index 99%
rename from 
kernel/cobalt/arch/powerpc/patches/ipipe-core-3.10.32-powerpc-6.patch
rename to kernel/cobalt/arch/powerpc/patches/ipipe-core-3.10.32-powerpc-7.patch
index 52532d1..cdae495 100644
--- a/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.10.32-powerpc-6.patch
+++ b/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.10.32-powerpc-7.patch
@@ -239,7 +239,7 @@ index ba713f1..ed1b099 100644
   * or should we not care like we do now ? --BenH.
 diff --git a/arch/powerpc/include/asm/ipipe.h 
b/arch/powerpc/include/asm/ipipe.h
 new file mode 100644
-index 000..4806477
+index 000..2b71932
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,164 @@
@@ -284,7 +284,7 @@ index 000..4806477
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE6
++#define IPIPE_CORE_RELEASE7
 +
 +struct ipipe_domain;
 +
@@ -1150,7 +1150,7 @@ index ba7b197..0246507 100644
 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
 _TIF_NOHZ)
 diff --git a/arch/powerpc/include/asm/uaccess.h 
b/arch/powerpc/include/asm/uaccess.h
-index 4db4959..9d4627a 100644
+index 4db49590..9d4627a 100644
 --- a/arch/powerpc/include/asm/uaccess.h
 +++ b/arch/powerpc/include/asm/uaccess.h
 @@ -117,6 +117,21 @@ struct exception_table_entry {
@@ -1776,7 +1776,7 @@ index 8a9b6f5..9b6d8e2 100644
/* Fixed Interval Timer (FIT) Exception. (from 0x1010) */
  FITException:
 diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
-index 97e2671..c0e0e62 100644
+index 97e2671..207bca1 100644
 --- a/arch/powerpc/kernel/head_44x.S
 +++ b/arch/powerpc/kernel/head_44x.S
 @@ -262,8 +262,13 @@ interrupt_base:
@@ -1785,7 +1785,7 @@ index 97e2671..c0e0e62 100644
/* External Input Interrupt */
 +#ifdef CONFIG_IPIPE
 +  EXCEPTION(0x0500, BOOKE_INTERRUPT_EXTERNAL, ExternalInput, \
-+__ipipe_grab_irq, EXC_XFER_LITE)
++__ipipe_grab_irq, EXC_XFER_IPIPE)
 +#else /* !CONFIG_IPIPE */
EXCEPTION(0x0500, BOOKE_INTERRUPT_EXTERNAL, ExternalInput, \
  do_IRQ, EXC_XFER_LITE)
@@ -1979,10 +1979,10 @@ index 939ea7e..75479f9 100644
 * Go into low thread priority and possibly
 diff --git a/arch/powerpc/kernel/ipipe.c b/arch/powerpc/kernel/ipipe.c
 new file mode 100644
-index 000..1d08533
+index 000..0e30a84
 --- /dev/null
 +++ b/arch/powerpc/kernel/ipipe.c
-@@ -0,0 +1,471 @@
+@@ -0,0 +1,466 @@
 +/* -*- linux-c -*-
 + * linux/arch/powerpc/kernel/ipipe.c
 + *
@@ -2423,11 +2423,6 @@ index 000..1d08533
 +  return -ret;
 +}
 +
-+void __ipipe_pin_range_globally(unsigned long start, unsigned long end)
-+{
-+  /* We don't support this. */
-+}
-+
 +#ifndef CONFIG_SMP
 +EXPORT_SYMBOL_GPL(last_task_used_math);
 +#endif
@@ -5300,10 +5295,10 @@ index e6bb36a..898a91a 100644
  
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 000..525f3cf
+index 000..4ef7e3d
 --- /dev/null
 +++ b/include/linux/ipipe.h
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,449 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe.h
 + *
@@ -5710,6 +5705,12 @@ index 000..525f3cf
 +#define __ipipe_uaccess_might_fault() might_fault()
 +#endif
 +
++#ifdef CONFIG_IPIPE_TRACE
++void __ipipe_tracer_hrclock_initialized(void);
++#else /* !CONFIG_IPIPE_TRACE */
++#define __ipipe_tracer_hrclock_initialized()  do { } while(0)
++#endif /* !CONFIG_IPIPE_TRACE */
++
 +#include 
 +
 +#else /* !CONFIG_IPIPE */
@@ -5749,10 +5750,10 @@ index 000..525f3cf
 +#endif/* !__LINUX_IPIPE_H */
 diff --git a/include/linux/ipipe_base.h b/include/linux/ipipe_base.h
 new file mode 100644
-index 000..fc88b2e
+index 000..c8fed98
 --- /dev/null
 +++ b/include/linux/ipipe_base.h
-@@ -0,0 +1,392 @@
+@@ -0,0 +1,394 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe_base.h
 + *
@@ -5935,9 +5936,6 @@ index 000..fc88b2e
 +
 +void __ipipe_flush_printk(unsigned int irq, void *cookie);
 +
-+void __ipipe_pin_range_globally(unsigned long start,
-+  unsigned long end);
-+
 +#define hard_preempt_disable()\
 +  ({  \
 +  unsigned long 

[Xenomai-git] Philippe Gerum : lib/cobalt: simplify checks for secondary mode

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: d054cdb53e73832c292cb28a9b043d6b9eae3c5e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d054cdb53e73832c292cb28a9b043d6b9eae3c5e

Author: Philippe Gerum 
Date:   Fri Mar 18 12:00:55 2016 +0100

lib/cobalt: simplify checks for secondary mode

Whether a current thread is currently running in primary/secondary
mode can be checked by inspecting the status of the XNRELAX bit in the
thread's u_window. The lack of u_window denotes a non-Xenomai, regular
thread which for which the current mode is always relaxed.

A thread's handle and its u_window area are tightly coupled: the
latter has to be valid for any thread with a valid handle.

Introduce cobalt_is_relaxed() for testing the current mode, and fixup
all open coded versions of this routine.

In addition, assert_nrt_fast() is marked as deprecated, since
assert_nrt() is not a slow call anymore.

---

 include/cobalt/stdio.h  |1 +
 lib/cobalt/assert_context.c |   14 +++---
 lib/cobalt/internal.c   |4 +---
 lib/cobalt/internal.h   |7 ++-
 lib/cobalt/printf.c |   27 +--
 5 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h
index f0c289d..0d97b83 100644
--- a/include/cobalt/stdio.h
+++ b/include/cobalt/stdio.h
@@ -114,6 +114,7 @@ void rt_print_flush_buffers(void);
 
 void assert_nrt(void);
 
+__attribute__((__deprecated__))
 void assert_nrt_fast(void);
 
 #ifdef __cplusplus
diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c
index da5f2b0..2085953 100644
--- a/lib/cobalt/assert_context.c
+++ b/lib/cobalt/assert_context.c
@@ -45,21 +45,13 @@ static void assert_nrt_inner(void)
 
 void assert_nrt(void)
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
assert_nrt_inner();
 }
 
-/*
- * Note: Works without syscalls but may not catch all errors when used inside
- * TSD destructors (as registered via pthread_key_create) when TLS support
- * (__thread) is disabled.
- */
-void assert_nrt_fast(void)
+void assert_nrt_fast(void) /* OBSOLETE */
 {
-   if (cobalt_get_current_fast() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
-   assert_nrt_inner();
+   assert_nrt();
 }
 
 /* Memory allocation services */
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 9220237..5b89db5 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -54,9 +54,7 @@ void cobalt_thread_harden(void)
 
 void cobalt_thread_relax(void)
 {
-   int status = cobalt_get_current_mode();
-
-   if ((status & XNRELAX) == 0)
+   if (!cobalt_is_relaxed())
XENOMAI_SYSCALL1(sc_cobalt_migrate, COBALT_SECONDARY);
 }
 
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 69ec7d1..fee3fe1 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -27,7 +27,10 @@ extern void *cobalt_umm_private;
 
 extern void *cobalt_umm_shared;
 
-void cobalt_sigshadow_install_once(void);
+static inline int cobalt_is_relaxed(void)
+{
+   return cobalt_get_current_mode() & XNRELAX;
+}
 
 static inline
 struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
@@ -43,6 +46,8 @@ static inline atomic_t *mutex_get_ownerp(struct 
cobalt_mutex_shadow *shadow)
return _get_state(shadow)->owner;
 }
 
+void cobalt_sigshadow_install_once(void);
+
 void cobalt_thread_init(void);
 
 int cobalt_thread_probe(pid_t pid);
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index 797a9b5..87cd5e2 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -730,8 +730,7 @@ done:
 
 COBALT_IMPL(int, vfprintf, (FILE *stream, const char *fmt, va_list args))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_vfprintf(stream, fmt, args);
else {
rt_print_flush_buffers();
@@ -770,8 +769,7 @@ COBALT_IMPL(int, printf, (const char *fmt, ...))
 
 COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_fputs(s, stream);
else {
rt_print_flush_buffers();
@@ -781,8 +779,7 @@ COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 
 COBALT_IMPL(int, puts, (const char *s))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_puts(s);
else {
rt_print_flush_buffers();
@@ -794,8 +791,7 @@ COBALT_IMPL(int, puts, (const char *s))
 
 COBALT_IMPL(int, fputc, (int c, FILE *stream))
 {
-   if 

[Xenomai-git] Philippe Gerum : utils/autotune: protect against SIGHUP in background mode

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 20d6ae1796c510ab0494962f4c65b8a2c1df9015
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=20d6ae1796c510ab0494962f4c65b8a2c1df9015

Author: Philippe Gerum 
Date:   Sat Mar 19 08:44:34 2016 +0100

utils/autotune: protect against SIGHUP in background mode

---

 utils/autotune/autotune.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index 5c3e0fe..f52733b 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -285,6 +286,7 @@ int main(int argc, char *const argv[])
error(1, errno, "cannot set CPU affinity");
 
if (background) {
+   signal(SIGHUP, SIG_IGN);
ret = daemon(0, 0);
if (ret)
error(1, errno, "cannot daemonize");


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/thread: fix join request handling from non-Xenomai context

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 57fa6d9c669528adcbe21b7b8760b9c70e13cd5a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=57fa6d9c669528adcbe21b7b8760b9c70e13cd5a

Author: Philippe Gerum 
Date:   Fri Mar 18 18:20:50 2016 +0100

cobalt/thread: fix join request handling from non-Xenomai context

---

 kernel/cobalt/thread.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 7983165..e5580b5 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1678,7 +1678,7 @@ int xnthread_join(struct xnthread *thread, bool 
uninterruptible)
xnthread_set_state(thread, XNJOINED);
tpid = xnthread_host_pid(thread);

-   if (!xnthread_test_state(curr, XNRELAX|XNROOT)) {
+   if (curr && !xnthread_test_state(curr, XNRELAX)) {
xnlock_put_irqrestore(, s);
xnthread_relax(0, 0);
switched = 1;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Jan Kiszka : smokey/posix-mutex: Fix test case /wrt mutex object reuse

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: d138f8c918cebfefa51acfa41f4d6ae60942a76a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d138f8c918cebfefa51acfa41f4d6ae60942a76a

Author: Jan Kiszka 
Date:   Thu Feb 25 11:29:00 2016 +0100

smokey/posix-mutex: Fix test case /wrt mutex object reuse

Mutex objects created on the stack must be properly destroyed after use.
Otherwise, succeeding tests that use the same stack layout will consider
them busy and refuse to recreate the mutexes.

Signed-off-by: Jan Kiszka 

---

 testsuite/smokey/posix-mutex/posix-mutex.c |   26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ae82fc1..151c2f3 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -623,7 +623,10 @@ static int protect_raise(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -651,7 +654,10 @@ static int protect_lower(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -699,7 +705,10 @@ static int protect_weak(void)
if (!__T(ret, pthread_setschedparam(pthread_self(),
old_policy, _param)))
return ret;
-   
+
+   if (!__T(ret, pthread_mutex_destroy()))
+   return ret;
+
return 0;
 }
 
@@ -745,7 +754,11 @@ static int protect_nesting_protect(void)
 
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy(_high)) ||
+   !__T(ret, pthread_mutex_destroy(_very_high)))
+   return ret;
+
return 0;
 }
 
@@ -782,7 +795,10 @@ static int protect_nesting_pi(void)
/* PP boost just dropped: HIGH -> MEDIUM. */
if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
return -EINVAL;
-   
+
+   if (!__T(ret, pthread_mutex_destroy(_pp)))
+   return ret;
+
return 0;
 }
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/blackfin: upgrade I-pipe support

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 945eb01b4883284f54c199bea91690e85ed03999
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=945eb01b4883284f54c199bea91690e85ed03999

Author: Philippe Gerum 
Date:   Sun Mar 13 12:11:01 2016 +0100

cobalt/blackfin: upgrade I-pipe support

---

 ...5.patch => ipipe-core-3.10.32-blackfin-6.patch} |  118 ++
 ...7.patch => ipipe-core-3.14.44-blackfin-9.patch} |  242 +---
 ...3.patch => ipipe-core-3.18.20-blackfin-5.patch} |   43 +++-
 3 files changed, 259 insertions(+), 144 deletions(-)

diff --git 
a/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.10.32-blackfin-5.patch 
b/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.10.32-blackfin-6.patch
similarity index 99%
rename from 
kernel/cobalt/arch/blackfin/patches/ipipe-core-3.10.32-blackfin-5.patch
rename to 
kernel/cobalt/arch/blackfin/patches/ipipe-core-3.10.32-blackfin-6.patch
index 9081fc3..d07d514 100644
--- a/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.10.32-blackfin-5.patch
+++ b/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.10.32-blackfin-6.patch
@@ -12,7 +12,7 @@ index a117652..c5d277d1 100644
  
  comment "Processor and Board Settings"
 diff --git a/arch/blackfin/include/asm/ipipe.h 
b/arch/blackfin/include/asm/ipipe.h
-index 17b5e92..90c5be8 100644
+index 17b5e92..c8d1a8a 100644
 --- a/arch/blackfin/include/asm/ipipe.h
 +++ b/arch/blackfin/include/asm/ipipe.h
 @@ -28,7 +28,7 @@
@@ -32,7 +32,7 @@ index 17b5e92..90c5be8 100644
 -#define IPIPE_MAJOR_NUMBER1
 -#define IPIPE_MINOR_NUMBER16
 -#define IPIPE_PATCH_NUMBER1
-+#define IPIPE_CORE_RELEASE5
++#define IPIPE_CORE_RELEASE6
  
  #ifdef CONFIG_SMP
  #error "I-pipe/blackfin: SMP not implemented"
@@ -1982,10 +1982,10 @@ index e6bb36a..898a91a 100644
  
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 000..525f3cf
+index 000..4ef7e3d
 --- /dev/null
 +++ b/include/linux/ipipe.h
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,449 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe.h
 + *
@@ -2392,6 +2392,12 @@ index 000..525f3cf
 +#define __ipipe_uaccess_might_fault() might_fault()
 +#endif
 +
++#ifdef CONFIG_IPIPE_TRACE
++void __ipipe_tracer_hrclock_initialized(void);
++#else /* !CONFIG_IPIPE_TRACE */
++#define __ipipe_tracer_hrclock_initialized()  do { } while(0)
++#endif /* !CONFIG_IPIPE_TRACE */
++
 +#include 
 +
 +#else /* !CONFIG_IPIPE */
@@ -2431,10 +2437,10 @@ index 000..525f3cf
 +#endif/* !__LINUX_IPIPE_H */
 diff --git a/include/linux/ipipe_base.h b/include/linux/ipipe_base.h
 new file mode 100644
-index 000..fc88b2e
+index 000..c8fed98
 --- /dev/null
 +++ b/include/linux/ipipe_base.h
-@@ -0,0 +1,392 @@
+@@ -0,0 +1,394 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe_base.h
 + *
@@ -2617,9 +2623,6 @@ index 000..fc88b2e
 +
 +void __ipipe_flush_printk(unsigned int irq, void *cookie);
 +
-+void __ipipe_pin_range_globally(unsigned long start,
-+  unsigned long end);
-+
 +#define hard_preempt_disable()\
 +  ({  \
 +  unsigned long __flags__;\
@@ -2787,10 +2790,6 @@ index 000..fc88b2e
 +
 +static inline void __ipipe_clear_taskflags(struct task_struct *p) { }
 +
-+static inline void __ipipe_pin_range_globally(unsigned long start,
-+unsigned long end)
-+{ }
-+
 +#define hard_preempt_disable()({ preempt_disable(); 0; })
 +#define hard_preempt_enable(flags)({ preempt_enable(); (void)(flags); })
 +
@@ -2817,6 +2816,15 @@ index 000..fc88b2e
 +
 +#endif/* !CONFIG_IPIPE */
 +
++#ifdef CONFIG_IPIPE_WANT_PTE_PINNING
++void __ipipe_pin_mapping_globally(unsigned long start,
++unsigned long end);
++#else
++static inline void __ipipe_pin_mapping_globally(unsigned long start,
++  unsigned long end)
++{ }
++#endif
++
 +static inline void ipipe_preempt_root_only(void)
 +{
 +#if defined(CONFIG_IPIPE_DEBUG_CONTEXT) && \
@@ -4968,10 +4976,10 @@ index ff7be9d..1e80528 100644
trace_task_newtask(p, clone_flags);
 diff --git a/kernel/ipipe/Kconfig b/kernel/ipipe/Kconfig
 new file mode 100644
-index 000..da17b04
+index 000..218f51da
 --- /dev/null
 +++ b/kernel/ipipe/Kconfig
-@@ -0,0 +1,62 @@
+@@ -0,0 +1,65 @@
 +config IPIPE
 +  bool "Interrupt pipeline"
 +  default y
@@ -4992,6 +5000,9 @@ index 000..da17b04
 +config IPIPE_WANT_CLOCKSOURCE
 +   bool
 +
++config IPIPE_WANT_PTE_PINNING
++   bool
++
 +config IPIPE_CORE_APIREV
 +   int
 +   depends on IPIPE
@@ -7767,10 +7778,10 @@ index 000..0c9b908
 +#endif /* CONFIG_IPIPE_HAVE_HOSTRT */
 diff --git a/kernel/ipipe/tracer.c b/kernel/ipipe/tracer.c
 new file mode 100644
-index 000..5cce0bc
+index 000..8388671
 --- /dev/null
 +++ b/kernel/ipipe/tracer.c
-@@ 

[Xenomai-git] Philippe Gerum : cobalt/synch: add support for priority ceiling protocol

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 1d7ebd9240031e3214eb55ca0d20b999f39d43bc
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1d7ebd9240031e3214eb55ca0d20b999f39d43bc

Author: Philippe Gerum 
Date:   Tue Feb 16 10:12:55 2016 +0100

cobalt/synch: add support for priority ceiling protocol

---

 include/cobalt/kernel/heap.h   |   11 +
 include/cobalt/kernel/sched-idle.h |   12 +-
 include/cobalt/kernel/sched-rt.h   |   55 ++-
 include/cobalt/kernel/sched.h  |   94 +++-
 include/cobalt/kernel/synch.h  |   51 ++-
 include/cobalt/kernel/thread.h |   54 ++-
 include/cobalt/uapi/asm-generic/features.h |   27 +-
 include/cobalt/uapi/kernel/synch.h |8 +-
 include/cobalt/uapi/kernel/thread.h|3 +-
 include/cobalt/uapi/kernel/types.h |5 +-
 include/cobalt/uapi/mutex.h|1 +
 include/cobalt/uapi/thread.h   |1 +
 kernel/cobalt/posix/cond.c |2 +-
 kernel/cobalt/posix/memory.h   |6 +
 kernel/cobalt/posix/monitor.c  |   29 +-
 kernel/cobalt/posix/mqueue.c   |4 +-
 kernel/cobalt/posix/mutex.c|  103 +++--
 kernel/cobalt/posix/process.c  |   21 +-
 kernel/cobalt/posix/process.h  |3 +-
 kernel/cobalt/posix/syscall.c  |6 +-
 kernel/cobalt/posix/timerfd.c  |2 +-
 kernel/cobalt/rtdm/drvlib.c|2 +-
 kernel/cobalt/sched-idle.c |   12 +-
 kernel/cobalt/sched-quota.c|   24 +-
 kernel/cobalt/sched-rt.c   |   14 +-
 kernel/cobalt/sched-sporadic.c |   35 +-
 kernel/cobalt/sched-tp.c   |   42 +-
 kernel/cobalt/sched-weak.c |   16 +-
 kernel/cobalt/sched.c  |  126 +-
 kernel/cobalt/synch.c  |  636 +++-
 kernel/cobalt/thread.c |  115 ++---
 31 files changed, 1038 insertions(+), 482 deletions(-)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index a1cea69..d89f25d 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -147,6 +147,17 @@ void xnheap_free(struct xnheap *heap, void *block);
 
 int xnheap_check_block(struct xnheap *heap, void *block);
 
+static inline void *xnheap_zalloc(struct xnheap *heap, u32 size)
+{
+   void *p;
+
+   p = xnheap_alloc(heap, size);
+   if (p)
+   memset(p, 0, size);
+
+   return p;
+}
+
 static inline char *xnstrdup(const char *s)
 {
char *p;
diff --git a/include/cobalt/kernel/sched-idle.h 
b/include/cobalt/kernel/sched-idle.h
index 732ff84..75efdec 100644
--- a/include/cobalt/kernel/sched-idle.h
+++ b/include/cobalt/kernel/sched-idle.h
@@ -33,11 +33,11 @@
 
 extern struct xnsched_class xnsched_class_idle;
 
-static inline void __xnsched_idle_setparam(struct xnthread *thread,
+static inline bool __xnsched_idle_setparam(struct xnthread *thread,
   const union xnsched_policy_param *p)
 {
xnthread_clear_state(thread, XNWEAK);
-   thread->cprio = p->idle.prio;
+   return xnsched_set_effective_priority(thread, p->idle.prio);
 }
 
 static inline void __xnsched_idle_getparam(struct xnthread *thread,
@@ -50,11 +50,17 @@ static inline void __xnsched_idle_trackprio(struct xnthread 
*thread,
const union xnsched_policy_param *p)
 {
if (p)
-   __xnsched_idle_setparam(thread, p);
+   /* Inheriting a priority-less class makes no sense. */
+   XENO_WARN_ON_ONCE(COBALT, 1);
else
thread->cprio = XNSCHED_IDLE_PRIO;
 }
 
+static inline void __xnsched_idle_protectprio(struct xnthread *thread, int 
prio)
+{
+   XENO_WARN_ON_ONCE(COBALT, 1);
+}
+
 static inline int xnsched_idle_init_thread(struct xnthread *thread)
 {
return 0;
diff --git a/include/cobalt/kernel/sched-rt.h b/include/cobalt/kernel/sched-rt.h
index ffb7223..992a5ba 100644
--- a/include/cobalt/kernel/sched-rt.h
+++ b/include/cobalt/kernel/sched-rt.h
@@ -67,20 +67,33 @@ static inline void __xnsched_rt_dequeue(struct xnthread 
*thread)
xnsched_delq(>sched->rt.runnable, thread);
 }
 
-static inline void __xnsched_rt_setparam(struct xnthread *thread,
-const union xnsched_policy_param *p)
+static inline void __xnsched_rt_track_weakness(struct xnthread *thread)
 {
-   thread->cprio = p->rt.prio;
-   if (!xnthread_test_state(thread, XNBOOST)) {
-#ifdef CONFIG_XENO_OPT_SCHED_WEAK
+   /*
+* We have to track threads exiting weak scheduling, i.e. any
+* thread leaving the WEAK class code if compiled in, or
+* assigned a zero priority if weak threads are hosted by the
+* RT class.
+*
+* CAUTION: since we 

[Xenomai-git] Philippe Gerum : config: bump version code

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: 09413e26bec6cfae6c0b5aaa7cb61b288f0a397a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=09413e26bec6cfae6c0b5aaa7cb61b288f0a397a

Author: Philippe Gerum 
Date:   Wed Mar  2 17:05:17 2016 +0100

config: bump version code

---

 config/version-code  |2 +-
 config/version-label |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/version-code b/config/version-code
index cb2b00e..b502146 100644
--- a/config/version-code
+++ b/config/version-code
@@ -1 +1 @@
-3.0.1
+3.0.2
diff --git a/config/version-label b/config/version-label
index cb2b00e..b502146 100644
--- a/config/version-label
+++ b/config/version-label
@@ -1 +1 @@
-3.0.1
+3.0.2


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/thread: fix join request handling from non-Xenomai context

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/prioceil
Commit: f65293cf7c5cc5adae11fed6315623120f56a238
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f65293cf7c5cc5adae11fed6315623120f56a238

Author: Philippe Gerum 
Date:   Fri Mar 18 18:20:50 2016 +0100

cobalt/thread: fix join request handling from non-Xenomai context

---

 kernel/cobalt/thread.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index a13ecaf..e16f7a3 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1682,7 +1682,7 @@ int xnthread_join(struct xnthread *thread, bool 
uninterruptible)
xnthread_set_state(thread, XNJOINED);
tpid = xnthread_host_pid(thread);

-   if (!xnthread_test_state(curr, XNRELAX|XNROOT)) {
+   if (curr && !xnthread_test_state(curr, XNRELAX)) {
xnlock_put_irqrestore(, s);
xnthread_relax(0, 0);
switched = 1;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/thread: fix join request handling from non-Xenomai context

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: f65293cf7c5cc5adae11fed6315623120f56a238
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f65293cf7c5cc5adae11fed6315623120f56a238

Author: Philippe Gerum 
Date:   Fri Mar 18 18:20:50 2016 +0100

cobalt/thread: fix join request handling from non-Xenomai context

---

 kernel/cobalt/thread.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index a13ecaf..e16f7a3 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1682,7 +1682,7 @@ int xnthread_join(struct xnthread *thread, bool 
uninterruptible)
xnthread_set_state(thread, XNJOINED);
tpid = xnthread_host_pid(thread);

-   if (!xnthread_test_state(curr, XNRELAX|XNROOT)) {
+   if (curr && !xnthread_test_state(curr, XNRELAX)) {
xnlock_put_irqrestore(, s);
xnthread_relax(0, 0);
switched = 1;


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: simplify checks for secondary mode

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: d054cdb53e73832c292cb28a9b043d6b9eae3c5e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d054cdb53e73832c292cb28a9b043d6b9eae3c5e

Author: Philippe Gerum 
Date:   Fri Mar 18 12:00:55 2016 +0100

lib/cobalt: simplify checks for secondary mode

Whether a current thread is currently running in primary/secondary
mode can be checked by inspecting the status of the XNRELAX bit in the
thread's u_window. The lack of u_window denotes a non-Xenomai, regular
thread which for which the current mode is always relaxed.

A thread's handle and its u_window area are tightly coupled: the
latter has to be valid for any thread with a valid handle.

Introduce cobalt_is_relaxed() for testing the current mode, and fixup
all open coded versions of this routine.

In addition, assert_nrt_fast() is marked as deprecated, since
assert_nrt() is not a slow call anymore.

---

 include/cobalt/stdio.h  |1 +
 lib/cobalt/assert_context.c |   14 +++---
 lib/cobalt/internal.c   |4 +---
 lib/cobalt/internal.h   |7 ++-
 lib/cobalt/printf.c |   27 +--
 5 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h
index f0c289d..0d97b83 100644
--- a/include/cobalt/stdio.h
+++ b/include/cobalt/stdio.h
@@ -114,6 +114,7 @@ void rt_print_flush_buffers(void);
 
 void assert_nrt(void);
 
+__attribute__((__deprecated__))
 void assert_nrt_fast(void);
 
 #ifdef __cplusplus
diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c
index da5f2b0..2085953 100644
--- a/lib/cobalt/assert_context.c
+++ b/lib/cobalt/assert_context.c
@@ -45,21 +45,13 @@ static void assert_nrt_inner(void)
 
 void assert_nrt(void)
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
assert_nrt_inner();
 }
 
-/*
- * Note: Works without syscalls but may not catch all errors when used inside
- * TSD destructors (as registered via pthread_key_create) when TLS support
- * (__thread) is disabled.
- */
-void assert_nrt_fast(void)
+void assert_nrt_fast(void) /* OBSOLETE */
 {
-   if (cobalt_get_current_fast() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
-   assert_nrt_inner();
+   assert_nrt();
 }
 
 /* Memory allocation services */
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 9220237..5b89db5 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -54,9 +54,7 @@ void cobalt_thread_harden(void)
 
 void cobalt_thread_relax(void)
 {
-   int status = cobalt_get_current_mode();
-
-   if ((status & XNRELAX) == 0)
+   if (!cobalt_is_relaxed())
XENOMAI_SYSCALL1(sc_cobalt_migrate, COBALT_SECONDARY);
 }
 
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 69ec7d1..fee3fe1 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -27,7 +27,10 @@ extern void *cobalt_umm_private;
 
 extern void *cobalt_umm_shared;
 
-void cobalt_sigshadow_install_once(void);
+static inline int cobalt_is_relaxed(void)
+{
+   return cobalt_get_current_mode() & XNRELAX;
+}
 
 static inline
 struct cobalt_mutex_state *mutex_get_state(struct cobalt_mutex_shadow *shadow)
@@ -43,6 +46,8 @@ static inline atomic_t *mutex_get_ownerp(struct 
cobalt_mutex_shadow *shadow)
return _get_state(shadow)->owner;
 }
 
+void cobalt_sigshadow_install_once(void);
+
 void cobalt_thread_init(void);
 
 int cobalt_thread_probe(pid_t pid);
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index 797a9b5..87cd5e2 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -730,8 +730,7 @@ done:
 
 COBALT_IMPL(int, vfprintf, (FILE *stream, const char *fmt, va_list args))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_vfprintf(stream, fmt, args);
else {
rt_print_flush_buffers();
@@ -770,8 +769,7 @@ COBALT_IMPL(int, printf, (const char *fmt, ...))
 
 COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_fputs(s, stream);
else {
rt_print_flush_buffers();
@@ -781,8 +779,7 @@ COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 
 COBALT_IMPL(int, puts, (const char *s))
 {
-   if (cobalt_get_current() != XN_NO_HANDLE &&
-!(cobalt_get_current_mode() & XNRELAX))
+   if (!cobalt_is_relaxed())
return rt_puts(s);
else {
rt_print_flush_buffers();
@@ -794,8 +791,7 @@ COBALT_IMPL(int, puts, (const char *s))
 
 COBALT_IMPL(int, fputc, (int c, FILE *stream))
 {
-   if 

[Xenomai-git] Philippe Gerum : utils/autotune: protect against SIGHUP in background mode

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: e95e7563c02aa86b438677f8a38427634c7d49c9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e95e7563c02aa86b438677f8a38427634c7d49c9

Author: Philippe Gerum 
Date:   Sat Mar 19 08:44:34 2016 +0100

utils/autotune: protect against SIGHUP in background mode

---

 utils/autotune/autotune.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index 5c3e0fe..f52733b 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -285,6 +286,7 @@ int main(int argc, char *const argv[])
error(1, errno, "cannot set CPU affinity");
 
if (background) {
+   signal(SIGHUP, SIG_IGN);
ret = daemon(0, 0);
if (ret)
error(1, errno, "cannot daemonize");


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : include/boilerplate: add shorthand for deprecated calls

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e0b71cfaa084e8ea784cab2ab1425761f52a56fa
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e0b71cfaa084e8ea784cab2ab1425761f52a56fa

Author: Philippe Gerum 
Date:   Fri Mar 18 13:01:38 2016 +0100

include/boilerplate: add shorthand for deprecated calls

---

 include/boilerplate/compiler.h |4 
 include/cobalt/stdio.h |3 +--
 include/cobalt/wrappers.h  |2 ++
 include/trank/native/misc.h|4 ++--
 include/trank/native/task.h|2 +-
 include/trank/native/timer.h   |2 +-
 include/trank/trank.h  |4 ++--
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/include/boilerplate/compiler.h b/include/boilerplate/compiler.h
index e27d165..e558f73 100644
--- a/include/boilerplate/compiler.h
+++ b/include/boilerplate/compiler.h
@@ -54,4 +54,8 @@
 #define __aligned(__n) __attribute__((aligned (__n)))
 #endif
 
+#ifndef __deprecated
+#define __deprecated   __attribute__((__deprecated__))
+#endif
+
 #endif /* _BOILERPLATE_COMPILER_H */
diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h
index 0d97b83..81486d5 100644
--- a/include/cobalt/stdio.h
+++ b/include/cobalt/stdio.h
@@ -114,8 +114,7 @@ void rt_print_flush_buffers(void);
 
 void assert_nrt(void);
 
-__attribute__((__deprecated__))
-void assert_nrt_fast(void);
+__deprecated void assert_nrt_fast(void);
 
 #ifdef __cplusplus
 }
diff --git a/include/cobalt/wrappers.h b/include/cobalt/wrappers.h
index 975f7a3..7e061ca 100644
--- a/include/cobalt/wrappers.h
+++ b/include/cobalt/wrappers.h
@@ -18,6 +18,8 @@
 #ifndef _COBALT_WRAPPERS_H
 #define _COBALT_WRAPPERS_H
 
+#include 
+
 #define __stringify_1(x...)#x
 #define __stringify(x...)  __stringify_1(x)
 
diff --git a/include/trank/native/misc.h b/include/trank/native/misc.h
index bf0ed17..ea242d2 100644
--- a/include/trank/native/misc.h
+++ b/include/trank/native/misc.h
@@ -32,7 +32,7 @@ typedef struct rt_ioregion {
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_io_get_region(RT_IOREGION *iorn,
   const char *name,
   uint64_t start,
@@ -43,7 +43,7 @@ static inline int rt_io_get_region(RT_IOREGION *iorn,
return -ENOSYS;
 }
 
-__attribute__((__deprecated__))
+__deprecated
 int rt_io_put_region(RT_IOREGION *iorn)
 {
trank_warning("service should be provided by a RTDM driver");
diff --git a/include/trank/native/task.h b/include/trank/native/task.h
index 5c4d354..85c3cd4 100644
--- a/include/trank/native/task.h
+++ b/include/trank/native/task.h
@@ -35,7 +35,7 @@
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_task_notify(RT_TASK *task, rt_sigset_t sigs)
 {
trank_warning("in-kernel native API is gone, rebase over RTDM");
diff --git a/include/trank/native/timer.h b/include/trank/native/timer.h
index 7ccba1c..9cb606d 100644
--- a/include/trank/native/timer.h
+++ b/include/trank/native/timer.h
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-__attribute__((__deprecated__))
+__deprecated
 static inline int rt_timer_set_mode(RTIME nstick)
 {
 #ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
diff --git a/include/trank/trank.h b/include/trank/trank.h
index 693c015..2477d45 100644
--- a/include/trank/trank.h
+++ b/include/trank/trank.h
@@ -18,6 +18,8 @@
 #ifndef _XENOMAI_TRANK_TRANK_H
 #define _XENOMAI_TRANK_TRANK_H
 
+#include 
+
 #ifdef __XENO_COMPAT__
 
 void warning(const char *fmt, ...);
@@ -32,8 +34,6 @@ void warning(const char *fmt, ...);
 
 #else /* !__XENO_COMPAT__ */
 
-#include 
-
 #define __CURRENT(call)call
 
 #define COMPAT_DECL(T, P)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt/mutex: add support for priority ceiling protocol

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2eb540f0cd221e3c341e5b1fb9d3571b0560794d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2eb540f0cd221e3c341e5b1fb9d3571b0560794d

Author: Philippe Gerum 
Date:   Tue Feb 16 10:13:03 2016 +0100

lib/cobalt/mutex: add support for priority ceiling protocol

---

 configure.ac   |2 +
 include/boilerplate/libc.h |   19 +++
 include/cobalt/pthread.h   |7 ++
 lib/cobalt/cobalt.wrappers |2 +
 lib/cobalt/init.c  |1 +
 lib/cobalt/internal.h  |8 ++
 lib/cobalt/mutex.c |  301 +++-
 lib/cobalt/sched.c |   33 -
 lib/cobalt/thread.c|7 +-
 9 files changed, 311 insertions(+), 69 deletions(-)

diff --git a/configure.ac b/configure.ac
index d71aa38..18f3be0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -508,6 +508,8 @@ save_LIBS="$LIBS"
 LIBS="$LIBS -lrt -lpthread"
 AC_CHECK_FUNCS([pthread_mutexattr_setprotocol  \
pthread_mutexattr_getprotocol   \
+   pthread_mutexattr_getprioceiling \
+   pthread_mutexattr_setprioceiling \
pthread_mutexattr_setrobust_np  \
pthread_condattr_getclock   \
pthread_condattr_setclock   \
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 0e51b86..3a5af8c 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -108,6 +108,25 @@ int pthread_mutexattr_getprotocol(const 
pthread_mutexattr_t *
 }
 #endif /* !HAVE_PTHREAD_MUTEXATTR_GETPROTOCOL */
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING
+static inline
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
+int prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING */
+
+#ifndef HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING
+static inline
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *
+ __restrict attr,
+int *__restrict prioceiling)
+{
+   return ENOSYS;
+}
+#endif /* !HAVE_PTHREAD_MUTEXATTR_GETPRIOCEILING */
+
 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
 #include 
 static inline
diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index 386c337..f1b1c8a 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -67,6 +67,13 @@ COBALT_DECL(int, pthread_mutex_trylock(pthread_mutex_t 
*mutex));
 
 COBALT_DECL(int, pthread_mutex_unlock(pthread_mutex_t *mutex));
 
+COBALT_DECL(int, pthread_mutex_setprioceiling(pthread_mutex_t *__restrict 
mutex,
+ int prioceiling,
+ int *__restrict old_ceiling));
+  
+COBALT_DECL(int, pthread_mutex_getprioceiling(pthread_mutex_t *__restrict 
mutex,
+ int *__restrict old_ceiling));
+
 COBALT_DECL(int, pthread_cond_init (pthread_cond_t *cond,
const pthread_condattr_t *attr));
 
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 9480f34..75f29d6 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -32,6 +32,8 @@
 --wrap pthread_mutex_trylock
 --wrap pthread_mutex_timedlock
 --wrap pthread_mutex_unlock
+--wrap pthread_mutex_setprioceiling
+--wrap pthread_mutex_getprioceiling
 --wrap pthread_cond_init
 --wrap pthread_cond_destroy
 --wrap pthread_cond_wait
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index f260744..69d4763 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -177,6 +177,7 @@ static void __cobalt_init(void)
sizeof(struct cobalt_sem_shadow));
 
cobalt_mutex_init();
+   cobalt_sched_init();
cobalt_thread_init();
cobalt_print_init();
 }
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index fee3fe1..4b8252b 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -52,6 +52,8 @@ void cobalt_thread_init(void);
 
 int cobalt_thread_probe(pid_t pid);
 
+void cobalt_sched_init(void);
+
 void cobalt_print_init(void);
 
 void cobalt_print_init_atfork(void);
@@ -73,4 +75,10 @@ void cobalt_check_features(struct cobalt_featinfo *finfo);
 
 extern struct sigaction __cobalt_orig_sigdebug;
 
+extern int __cobalt_std_fifo_minpri,
+  __cobalt_std_fifo_maxpri;
+
+extern int __cobalt_std_rr_minpri,
+  __cobalt_std_rr_maxpri;
+
 #endif /* _LIB_COBALT_INTERNAL_H */
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 9d8a914..1456099 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -99,6 +99,9 @@ void cobalt_mutex_init(void)
  *   mutex, increase CONFIG_XENO_OPT_SHARED_HEAPSZ for a process-shared
  *   mutex, or CONFIG_XENO_OPT_PRIVATE_HEAPSZ for a process-private mutex.
  * - EAGAIN, no registry slot available, check/raise 
CONFIG_XENO_OPT_REGISTRY_NRSLOTS.
+ * - ENOSYS, @a attr mentions 

[Xenomai-git] Philippe Gerum : cobalt/synch: add support for priority ceiling protocol

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 2e1dc6e9221201b592061a2b323a669ca1707f28
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2e1dc6e9221201b592061a2b323a669ca1707f28

Author: Philippe Gerum 
Date:   Tue Feb 16 10:12:55 2016 +0100

cobalt/synch: add support for priority ceiling protocol

---

 include/cobalt/kernel/heap.h   |   11 +
 include/cobalt/kernel/sched-idle.h |   12 +-
 include/cobalt/kernel/sched-rt.h   |   55 ++-
 include/cobalt/kernel/sched.h  |   94 +++-
 include/cobalt/kernel/synch.h  |   51 ++-
 include/cobalt/kernel/thread.h |   54 ++-
 include/cobalt/uapi/asm-generic/features.h |   27 +-
 include/cobalt/uapi/kernel/synch.h |8 +-
 include/cobalt/uapi/kernel/thread.h|3 +-
 include/cobalt/uapi/kernel/types.h |5 +-
 include/cobalt/uapi/mutex.h|1 +
 include/cobalt/uapi/thread.h   |1 +
 kernel/cobalt/posix/cond.c |2 +-
 kernel/cobalt/posix/memory.h   |6 +
 kernel/cobalt/posix/monitor.c  |   29 +-
 kernel/cobalt/posix/mqueue.c   |4 +-
 kernel/cobalt/posix/mutex.c|  103 +++--
 kernel/cobalt/posix/process.c  |   21 +-
 kernel/cobalt/posix/process.h  |3 +-
 kernel/cobalt/posix/syscall.c  |6 +-
 kernel/cobalt/posix/timerfd.c  |2 +-
 kernel/cobalt/rtdm/drvlib.c|2 +-
 kernel/cobalt/sched-idle.c |   12 +-
 kernel/cobalt/sched-quota.c|   24 +-
 kernel/cobalt/sched-rt.c   |   14 +-
 kernel/cobalt/sched-sporadic.c |   35 +-
 kernel/cobalt/sched-tp.c   |   42 +-
 kernel/cobalt/sched-weak.c |   16 +-
 kernel/cobalt/sched.c  |  126 +-
 kernel/cobalt/synch.c  |  636 +++-
 kernel/cobalt/thread.c |  115 ++---
 31 files changed, 1038 insertions(+), 482 deletions(-)

diff --git a/include/cobalt/kernel/heap.h b/include/cobalt/kernel/heap.h
index a1cea69..d89f25d 100644
--- a/include/cobalt/kernel/heap.h
+++ b/include/cobalt/kernel/heap.h
@@ -147,6 +147,17 @@ void xnheap_free(struct xnheap *heap, void *block);
 
 int xnheap_check_block(struct xnheap *heap, void *block);
 
+static inline void *xnheap_zalloc(struct xnheap *heap, u32 size)
+{
+   void *p;
+
+   p = xnheap_alloc(heap, size);
+   if (p)
+   memset(p, 0, size);
+
+   return p;
+}
+
 static inline char *xnstrdup(const char *s)
 {
char *p;
diff --git a/include/cobalt/kernel/sched-idle.h 
b/include/cobalt/kernel/sched-idle.h
index 732ff84..75efdec 100644
--- a/include/cobalt/kernel/sched-idle.h
+++ b/include/cobalt/kernel/sched-idle.h
@@ -33,11 +33,11 @@
 
 extern struct xnsched_class xnsched_class_idle;
 
-static inline void __xnsched_idle_setparam(struct xnthread *thread,
+static inline bool __xnsched_idle_setparam(struct xnthread *thread,
   const union xnsched_policy_param *p)
 {
xnthread_clear_state(thread, XNWEAK);
-   thread->cprio = p->idle.prio;
+   return xnsched_set_effective_priority(thread, p->idle.prio);
 }
 
 static inline void __xnsched_idle_getparam(struct xnthread *thread,
@@ -50,11 +50,17 @@ static inline void __xnsched_idle_trackprio(struct xnthread 
*thread,
const union xnsched_policy_param *p)
 {
if (p)
-   __xnsched_idle_setparam(thread, p);
+   /* Inheriting a priority-less class makes no sense. */
+   XENO_WARN_ON_ONCE(COBALT, 1);
else
thread->cprio = XNSCHED_IDLE_PRIO;
 }
 
+static inline void __xnsched_idle_protectprio(struct xnthread *thread, int 
prio)
+{
+   XENO_WARN_ON_ONCE(COBALT, 1);
+}
+
 static inline int xnsched_idle_init_thread(struct xnthread *thread)
 {
return 0;
diff --git a/include/cobalt/kernel/sched-rt.h b/include/cobalt/kernel/sched-rt.h
index ffb7223..992a5ba 100644
--- a/include/cobalt/kernel/sched-rt.h
+++ b/include/cobalt/kernel/sched-rt.h
@@ -67,20 +67,33 @@ static inline void __xnsched_rt_dequeue(struct xnthread 
*thread)
xnsched_delq(>sched->rt.runnable, thread);
 }
 
-static inline void __xnsched_rt_setparam(struct xnthread *thread,
-const union xnsched_policy_param *p)
+static inline void __xnsched_rt_track_weakness(struct xnthread *thread)
 {
-   thread->cprio = p->rt.prio;
-   if (!xnthread_test_state(thread, XNBOOST)) {
-#ifdef CONFIG_XENO_OPT_SCHED_WEAK
+   /*
+* We have to track threads exiting weak scheduling, i.e. any
+* thread leaving the WEAK class code if compiled in, or
+* assigned a zero priority if weak threads are hosted by the
+* RT class.
+*
+* CAUTION: since we need to 

[Xenomai-git] Philippe Gerum : lib/cobalt: use lazy schedparam propagation

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 3fbb01e1e0bbf0dd479f8905912fdf4bcc770dd2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3fbb01e1e0bbf0dd479f8905912fdf4bcc770dd2

Author: Philippe Gerum 
Date:   Fri Mar 18 12:12:27 2016 +0100

lib/cobalt: use lazy schedparam propagation

Do not switch to secondary mode upon schedparam updates for
propagating changes to the regular kernel, if the caller runs in
primary mode when entering pthread_setschedparam*() or
sched_setscheduler(). In such a case, the update request to the
regular kernel is left pending until the target thread resumes
execution in relaxed mode, at which point it is committed.

CAUTION: This mechanism won't update the schedparams cached by the
glibc for the caller in user-space, but this is the deal: we don't
relax threads which issue pthread_setschedparam[_ex]() from primary
mode anymore, but then only the kernel side (Cobalt and the host
kernel) will be aware of the change, and glibc might cache obsolete
information.

If the caller already runs in relaxed mode on entry to these services,
the update request takes place immediately, via the regular (g)libc
calls.

In any case, the new scheduling parameters for the target thread are
immediately applied by Cobalt, regardless of the update path followed
for the regular kernel.

---

 lib/cobalt/internal.c  |   44 ++
 lib/cobalt/sched.c |   13 
 lib/cobalt/sigshadow.c |8 +
 lib/cobalt/thread.c|   80 +---
 4 files changed, 87 insertions(+), 58 deletions(-)

diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 5b89db5..cb1d53b 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -514,3 +514,47 @@ int cobalt_sched_weighted_prio(int policy,
 {
return XENOMAI_SYSCALL2(sc_cobalt_sched_weightprio, policy, param_ex);
 }
+
+int cobalt_xlate_schedparam(int policy,
+   const struct sched_param_ex *param_ex,
+   struct sched_param *param)
+{
+   int std_policy, priority;
+
+   /*
+* Translates Cobalt scheduling parameters to native ones,
+* based on a best approximation for Cobalt policies which are
+* not available from the host kernel.
+*/
+   std_policy = policy;
+   priority = param_ex->sched_priority;
+
+   switch (policy) {
+   case SCHED_WEAK:
+   std_policy = priority ? SCHED_FIFO : SCHED_OTHER;
+   break;
+   default:
+   std_policy = SCHED_FIFO;
+   /* falldown wanted. */
+   case SCHED_OTHER:
+   case SCHED_FIFO:
+   case SCHED_RR:
+   /*
+* The Cobalt priority range is larger than those of
+* the native SCHED_FIFO/RR classes, so we have to cap
+* the priority value accordingly.  We also remap
+* "weak" (negative) priorities - which are only
+* meaningful for the Cobalt core - to regular values.
+*/
+   if (priority > __cobalt_std_fifo_maxpri)
+   priority = __cobalt_std_fifo_maxpri;
+   }
+
+   if (priority < 0)
+   priority = -priority;
+   
+   memset(param, 0, sizeof(*param));
+   param->sched_priority = priority;
+
+   return std_policy;
+}
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index b0292b5..87b9235 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include "current.h"
 #include "internal.h"
 
 /**
@@ -297,11 +296,13 @@ int sched_setscheduler_ex(pid_t pid,
return EINVAL;
 
/* See pthread_setschedparam_ex(). */
-   
-   std_policy = cobalt_xlate_schedparam(policy, param_ex, _param);
-   ret = __STD(sched_setscheduler(pid, std_policy, _param));
-   if (ret)
-   return errno;
+
+   if (cobalt_is_relaxed()) {
+   std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
+   ret = __STD(sched_setscheduler(pid, std_policy, _param));
+   if (ret)
+   return errno;
+   }
 
ret = -XENOMAI_SYSCALL5(sc_cobalt_sched_setscheduler_ex,
pid, policy, param_ex,
diff --git a/lib/cobalt/sigshadow.c b/lib/cobalt/sigshadow.c
index 3f4e9c5..48d5a81 100644
--- a/lib/cobalt/sigshadow.c
+++ b/lib/cobalt/sigshadow.c
@@ -59,6 +59,14 @@ int cobalt_sigshadow_handler(int sig, siginfo_t *si, void 
*ctxt)
skip = nr > 3 ? 3 : 0;
XENOMAI_SYSCALL3(sc_cobalt_backtrace, nr - skip, frames + skip, 
arg);
break;
+   case SIGSHADOW_ACTION_HOME:
+   /*
+* We have been asked to call home from the current
+* context: sending a query for retrieving our handle
+* will just do this.
+*/
+   

[Xenomai-git] Philippe Gerum : lib/cobalt: clear u_window when releasing TSD

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 0f7aa5af11a345d3226e53660595bbee2db1cf94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0f7aa5af11a345d3226e53660595bbee2db1cf94

Author: Philippe Gerum 
Date:   Fri Mar 18 21:33:36 2016 +0100

lib/cobalt: clear u_window when releasing TSD

---

 lib/cobalt/current.c |2 ++
 lib/cobalt/umm.c |2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/cobalt/current.c b/lib/cobalt/current.c
index a085456..7d6ee9f 100644
--- a/lib/cobalt/current.c
+++ b/lib/cobalt/current.c
@@ -47,6 +47,7 @@ static inline void __cobalt_set_tsd(xnhandle_t current, __u32 
u_winoff)
 static inline void __cobalt_clear_tsd(void)
 {
cobalt_current = XN_NO_HANDLE;
+   cobalt_current_window = NULL;
 }
 
 static void init_current_keys(void)
@@ -75,6 +76,7 @@ static inline void __cobalt_set_tsd(xnhandle_t current,
 static inline void __cobalt_clear_tsd(void)
 {
pthread_setspecific(cobalt_current_key, NULL);
+   pthread_setspecific(cobalt_current_window_key, NULL);
 }
 
 static void init_current_keys(void)
diff --git a/lib/cobalt/umm.c b/lib/cobalt/umm.c
index 5772256..944620f 100644
--- a/lib/cobalt/umm.c
+++ b/lib/cobalt/umm.c
@@ -88,7 +88,7 @@ void cobalt_unmap_umm(void)
 * On machines without an MMU, there is no such thing as fork.
 *
 * We replace former mappings with an invalid one, to detect
-* any spuriously late access from the fastsync code.
+* any spurious late access.
 */
addr = __STD(mmap(cobalt_umm_private,
  private_size, PROT_NONE,


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/cobalt: use lazy schedparam propagation

2016-03-19 Thread git repository hosting
Module: xenomai-3
Branch: wip/setsched-norelax
Commit: 543545735d384a7b9e9e0dcc39a372225c5700b2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=543545735d384a7b9e9e0dcc39a372225c5700b2

Author: Philippe Gerum 
Date:   Fri Mar 18 12:12:27 2016 +0100

lib/cobalt: use lazy schedparam propagation

Do not switch to secondary mode upon schedparam updates for
propagating changes to the regular kernel, if the caller runs in
primary mode when entering pthread_setschedparam*() or
sched_setscheduler(). In such a case, the update request to the
regular kernel is left pending until the target thread resumes
execution in relaxed mode, at which point it is committed.

CAUTION: This mechanism won't update the schedparams cached by the
glibc for the caller in user-space, but this is the deal: we don't
relax threads which issue pthread_setschedparam[_ex]() from primary
mode anymore, but then only the kernel side (Cobalt and the host
kernel) will be aware of the change, and glibc might cache obsolete
information.

If the caller already runs in relaxed mode on entry to these services,
the update request takes place immediately, via the regular (g)libc
calls.

In any case, the new scheduling parameters for the target thread are
immediately applied by Cobalt, regardless of the update path followed
for the regular kernel.

---

 lib/cobalt/internal.c  |   44 ++
 lib/cobalt/sched.c |   13 
 lib/cobalt/sigshadow.c |8 +
 lib/cobalt/thread.c|   80 +---
 4 files changed, 87 insertions(+), 58 deletions(-)

diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 5b89db5..cb1d53b 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -514,3 +514,47 @@ int cobalt_sched_weighted_prio(int policy,
 {
return XENOMAI_SYSCALL2(sc_cobalt_sched_weightprio, policy, param_ex);
 }
+
+int cobalt_xlate_schedparam(int policy,
+   const struct sched_param_ex *param_ex,
+   struct sched_param *param)
+{
+   int std_policy, priority;
+
+   /*
+* Translates Cobalt scheduling parameters to native ones,
+* based on a best approximation for Cobalt policies which are
+* not available from the host kernel.
+*/
+   std_policy = policy;
+   priority = param_ex->sched_priority;
+
+   switch (policy) {
+   case SCHED_WEAK:
+   std_policy = priority ? SCHED_FIFO : SCHED_OTHER;
+   break;
+   default:
+   std_policy = SCHED_FIFO;
+   /* falldown wanted. */
+   case SCHED_OTHER:
+   case SCHED_FIFO:
+   case SCHED_RR:
+   /*
+* The Cobalt priority range is larger than those of
+* the native SCHED_FIFO/RR classes, so we have to cap
+* the priority value accordingly.  We also remap
+* "weak" (negative) priorities - which are only
+* meaningful for the Cobalt core - to regular values.
+*/
+   if (priority > __cobalt_std_fifo_maxpri)
+   priority = __cobalt_std_fifo_maxpri;
+   }
+
+   if (priority < 0)
+   priority = -priority;
+   
+   memset(param, 0, sizeof(*param));
+   param->sched_priority = priority;
+
+   return std_policy;
+}
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index b0292b5..87b9235 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include "current.h"
 #include "internal.h"
 
 /**
@@ -297,11 +296,13 @@ int sched_setscheduler_ex(pid_t pid,
return EINVAL;
 
/* See pthread_setschedparam_ex(). */
-   
-   std_policy = cobalt_xlate_schedparam(policy, param_ex, _param);
-   ret = __STD(sched_setscheduler(pid, std_policy, _param));
-   if (ret)
-   return errno;
+
+   if (cobalt_is_relaxed()) {
+   std_policy = cobalt_xlate_schedparam(policy, param_ex, 
_param);
+   ret = __STD(sched_setscheduler(pid, std_policy, _param));
+   if (ret)
+   return errno;
+   }
 
ret = -XENOMAI_SYSCALL5(sc_cobalt_sched_setscheduler_ex,
pid, policy, param_ex,
diff --git a/lib/cobalt/sigshadow.c b/lib/cobalt/sigshadow.c
index 3f4e9c5..48d5a81 100644
--- a/lib/cobalt/sigshadow.c
+++ b/lib/cobalt/sigshadow.c
@@ -59,6 +59,14 @@ int cobalt_sigshadow_handler(int sig, siginfo_t *si, void 
*ctxt)
skip = nr > 3 ? 3 : 0;
XENOMAI_SYSCALL3(sc_cobalt_backtrace, nr - skip, frames + skip, 
arg);
break;
+   case SIGSHADOW_ACTION_HOME:
+   /*
+* We have been asked to call home from the current
+* context: sending a query for retrieving our handle
+* will just do this.
+