[Xenomai-git] Philippe Gerum : cobalt/rtdm: fix default minor assignation

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: fec4f73dab365b9e3328e88c5b230610cd0f6316
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fec4f73dab365b9e3328e88c5b230610cd0f6316

Author: Philippe Gerum 
Date:   Sat Oct  3 19:04:30 2015 +0200

cobalt/rtdm: fix default minor assignation

Devices may come and go, so using the device reference count
maintained in the driver descriptor is not a particularly bright
idea from /me.

Replace this by a bitmap, allowing for proper dynamic minor
registration/deregistration.

---

 include/cobalt/kernel/rtdm/driver.h |4 
 kernel/cobalt/rtdm/device.c |   33 +
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index 541fb04..b0a37c4 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -93,6 +93,9 @@ enum rtdm_selecttype;
 #define RTDM_SECURE_DEVICE 0x8000
 /** @} Device Flags */
 
+/** Maximum number of named devices per driver. */
+#define RTDM_MAX_MINOR 256
+
 /** @} rtdm_device_register */
 
 /*!
@@ -279,6 +282,7 @@ struct rtdm_driver {
};
atomic_t refcount;
struct notifier_block nb_statechange;
+   DECLARE_BITMAP(minor_map, RTDM_MAX_MINOR);
};
 };
 
diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 9af2221..4943be4 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -303,6 +303,7 @@ static int register_driver(struct rtdm_driver *drv)
 
drv->named.major = MAJOR(rdev);
atomic_set(&drv->refcount, 1);
+   bitmap_zero(drv->minor_map, RTDM_MAX_MINOR);
 
 done:
drv->nb_statechange.notifier_call = state_change_notifier;
@@ -354,9 +355,9 @@ static void unregister_driver(struct rtdm_driver *drv)
  */
 int rtdm_dev_register(struct rtdm_device *dev)
 {
-   int ret, pos, major, minor;
struct device *kdev = NULL;
struct rtdm_driver *drv;
+   int ret, major, minor;
xnkey_t id;
dev_t rdev;
 
@@ -369,7 +370,6 @@ int rtdm_dev_register(struct rtdm_device *dev)
 
dev->name = NULL;
drv = dev->driver;
-   pos = atomic_read(&drv->refcount);
ret = register_driver(drv);
if (ret) {
mutex_unlock(®ister_lock);
@@ -386,16 +386,22 @@ int rtdm_dev_register(struct rtdm_device *dev)
dev->ops.close = __rtdm_dev_close; /* Interpose on driver's handler. */
atomic_set(&dev->refcount, 0);
 
-   if (drv->device_flags & RTDM_FIXED_MINOR) {
-   minor = dev->minor;
-   if (minor < 0 || minor >= drv->device_count) {
-   ret = -EINVAL;
-   goto fail;
+   if (drv->device_flags & RTDM_NAMED_DEVICE) {
+   if (drv->device_flags & RTDM_FIXED_MINOR) {
+   minor = dev->minor;
+   if (minor < 0 || minor >= drv->device_count) {
+   ret = -ENXIO;
+   goto fail;
+   }
+   } else {
+   minor = find_first_zero_bit(drv->minor_map, 
RTDM_MAX_MINOR);
+   if (minor >= RTDM_MAX_MINOR) {
+   ret = -ENXIO;
+   goto fail;
+   }
+   dev->minor = minor;
}
-   } else
-   dev->minor = minor = pos;
 
-   if (drv->device_flags & RTDM_NAMED_DEVICE) {
major = drv->named.major;
dev->name = kasformat(dev->label, minor);
if (dev->name == NULL) {
@@ -416,7 +422,9 @@ int rtdm_dev_register(struct rtdm_device *dev)
ret = PTR_ERR(kdev);
goto fail;
}
+   __set_bit(minor, drv->minor_map);
} else {
+   dev->minor = -1;
dev->name = kstrdup(dev->label, GFP_KERNEL);
if (dev->name == NULL) {
ret = -ENOMEM;
@@ -489,9 +497,10 @@ void rtdm_dev_unregister(struct rtdm_device *dev)
 
mutex_lock(®ister_lock);
 
-   if (drv->device_flags & RTDM_NAMED_DEVICE)
+   if (drv->device_flags & RTDM_NAMED_DEVICE) {
xnregistry_remove(dev->named.handle);
-   else
+   __clear_bit(dev->minor, drv->minor_map);
+   } else
xnid_remove(&protocol_devices, &dev->proto.id);
 
device_destroy(rtdm_class, dev->rdev);


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 80e3a077cc38321785fa6d47976696dc424a321e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=80e3a077cc38321785fa6d47976696dc424a321e

Author: Philippe Gerum 
Date:   Tue Sep 15 11:24:05 2015 +0200

cobalt/powerpc: upgrade I-pipe support

---

 ...-1.patch => ipipe-core-3.18.20-powerpc-2.patch} | 2247 +++-
 1 file changed, 281 insertions(+), 1966 deletions(-)

diff --git 
a/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.18.12-powerpc-1.patch 
b/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.18.20-powerpc-2.patch
similarity index 89%
rename from 
kernel/cobalt/arch/powerpc/patches/ipipe-core-3.18.12-powerpc-1.patch
rename to kernel/cobalt/arch/powerpc/patches/ipipe-core-3.18.20-powerpc-2.patch
index cf75e7e..d29f803 100644
--- a/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.18.12-powerpc-1.patch
+++ b/kernel/cobalt/arch/powerpc/patches/ipipe-core-3.18.20-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..824fa82
+index 000..ac0d5fb
 --- /dev/null
 +++ b/arch/powerpc/include/asm/ipipe.h
 @@ -0,0 +1,157 @@
@@ -349,7 +349,7 @@ index 000..824fa82
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE1
++#define IPIPE_CORE_RELEASE2
 +
 +struct ipipe_domain;
 +
@@ -1375,6 +1375,45 @@ index 502cf69..0e29ef7 100644
  obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
  obj-$(CONFIG_PPC_P7_NAP)  += idle_power7.o
  obj-$(CONFIG_PPC_OF)  += of_platform.o prom_parse.o
+diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
+index 34f5552..8ffb7f2 100644
+--- a/arch/powerpc/kernel/align.c
 b/arch/powerpc/kernel/align.c
+@@ -739,7 +739,7 @@ int fix_alignment(struct pt_regs *regs)
+   unsigned int reg, areg;
+   unsigned int dsisr;
+   unsigned char __user *addr;
+-  unsigned long p, swiz;
++  unsigned long p, swiz, irqflags __maybe_unused;
+   int ret, i;
+   union data {
+   u64 ll;
+@@ -957,10 +957,10 @@ int fix_alignment(struct pt_regs *regs)
+   if (flags & S) {
+   /* Single-precision FP store requires conversion... */
+ #ifdef CONFIG_PPC_FPU
+-  preempt_disable();
++  irqflags = hard_preempt_disable();
+   enable_kernel_fp();
+   cvt_df(&data.dd, (float *)&data.x32.low32);
+-  preempt_enable();
++  hard_preempt_enable(irqflags);
+ #else
+   return 0;
+ #endif
+@@ -997,10 +997,10 @@ int fix_alignment(struct pt_regs *regs)
+   /* Single-precision FP load requires conversion... */
+   case LD+F+S:
+ #ifdef CONFIG_PPC_FPU
+-  preempt_disable();
++  irqflags = hard_preempt_disable();
+   enable_kernel_fp();
+   cvt_fd((float *)&data.x32.low32, &data.dd);
+-  preempt_enable();
++  hard_preempt_enable(irqflags);
+ #else
+   return 0;
+ #endif
 diff --git a/arch/powerpc/kernel/asm-offsets.c 
b/arch/powerpc/kernel/asm-offsets.c
 index 9d7dede..aad5e9d 100644
 --- a/arch/powerpc/kernel/asm-offsets.c
@@ -1919,7 +1958,7 @@ index 5e01984..6f68eff 100644
  #ifdef CONFIG_PPC_DOORBELL
STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, doorbell_exception)
 diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
-index 9ad236e..65b8f7c 100644
+index 9ad236e..76482dc 100644
 --- a/arch/powerpc/kernel/fpu.S
 +++ b/arch/powerpc/kernel/fpu.S
 @@ -195,7 +195,17 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
@@ -1927,12 +1966,12 @@ index 9ad236e..65b8f7c 100644
   */
  _GLOBAL(giveup_fpu)
 +#ifdef CONFIG_IPIPE
-+  mfmsr   r6
++  mfmsr   r10
 +#ifdef CONFIG_PPC64   
-+  rldicl  r5,r6,48,1  /* clear MSR_EE */
++  rldicl  r5,r10,48,1 /* clear MSR_EE */
 +  rotldi  r5,r5,16
 +#else
-+  rlwinm  r5,r6,0,17,15   /* clear MSR_EE */
++  rlwinm  r5,r10,0,17,15  /* clear MSR_EE */
 +#endif
 +#else 
mfmsr   r5
@@ -1955,7 +1994,7 @@ index 9ad236e..65b8f7c 100644
  #endif /* CONFIG_SMP */
 +2:
 +#ifdef CONFIG_IPIPE   /* restore interrupt state */
-+  andi.   r6,r6,MSR_EE
++  andi.   r10,r10,MSR_EE
 +  beqlr
 +  mfmsr   r5
 +  ori r5,r5,MSR_EE
@@ -2250,7 +2289,7 @@ index a620203..a67bb7c 100644
  #define FP_UNAVAILABLE_EXCEPTION\
START_EXCEPTION(FloatingPointUnavailable) \
 diff --git a/arch/powerpc/kernel/head_fsl_booke.S 
b/arch/powerpc/kernel/head_fsl_booke.S
-index fffd1f9..7d82b1f 100644
+index fffd1f9..66425e9 100644
 --- a/arch/powerpc/kernel/head_fsl_booke.S
 +++ b/arch/powerpc/kernel/head_fsl_booke.S
 @@ -390,7 +390,11 @@ interrupt_base:
@@ -2265,6 

[Xenomai-git] Gilles Chanteperdrix : posix/mutex: fix autoinit

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: dfa9ad71e481c70069cce539b462806ab2abee6c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dfa9ad71e481c70069cce539b462806ab2abee6c

Author: Gilles Chanteperdrix 
Date:   Fri Oct  2 23:07:16 2015 +0200

posix/mutex: fix autoinit

If several threads call simultaneously pthread_mutex_lock() on a mutex
initialized with PTHREAD_MUTEX_INITIALIZER, the current automatic
intialization may result in several initializations of the mutex.
Serialize the automatic initialization with a global mutex to avoid
that.

This can be done only for automatic initialization, as
pthread_mutex_init() may be called from a non Xenomai thread, which
could not sleep on a cobalt mutex, and serializing with a plain Linux
mutex would cause a switch to secondary mode for pthread_mutex_lock() in
case of automatic initialization.

Using a condition variable would create a cancellation point, whereas
pthread_mutex_lock() and pthread_mutex_unlock() can not be cancellation
points.

---

 lib/cobalt/init.c |2 +-
 lib/cobalt/internal.h |2 +-
 lib/cobalt/mutex.c|   26 +++---
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 2910f6e..9d1674d 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -172,6 +172,7 @@ static void __cobalt_init(void)
sizeof(sem_t),
sizeof(struct cobalt_sem_shadow));
 
+   cobalt_mutex_init();
cobalt_thread_init();
cobalt_print_init();
 }
@@ -189,7 +190,6 @@ int cobalt_init(void)
int policy, ret;
 
commit_stack_memory();  /* We only need this for the main thread */
-   cobalt_default_mutexattr_init();
cobalt_default_condattr_init();
__cobalt_init();
 
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 540c286..4f03cf0 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -51,7 +51,7 @@ void cobalt_print_init_atfork(void);
 
 void cobalt_ticks_init(unsigned long long freq);
 
-void cobalt_default_mutexattr_init(void);
+void cobalt_mutex_init(void);
 
 void cobalt_default_condattr_init(void);
 
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index e4024e3..f613478 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -56,10 +56,21 @@
  */
 
 static pthread_mutexattr_t cobalt_default_mutexattr;
+static pthread_mutex_t cobalt_autoinit_mutex;
 
-void cobalt_default_mutexattr_init(void)
+void cobalt_mutex_init(void)
 {
+   pthread_mutexattr_t rt_init_mattr;
+   int err __attribute__((unused));
+
pthread_mutexattr_init(&cobalt_default_mutexattr);
+
+   pthread_mutexattr_init(&rt_init_mattr);
+   pthread_mutexattr_setprotocol(&rt_init_mattr, PTHREAD_PRIO_INHERIT);
+   err = __COBALT(pthread_mutex_init(&cobalt_autoinit_mutex,
+   &rt_init_mattr));
+   assert(err == 0);
+   pthread_mutexattr_destroy(&rt_init_mattr);
 }
 
 /**
@@ -176,12 +187,15 @@ COBALT_IMPL(int, pthread_mutex_destroy, (pthread_mutex_t 
*mutex))
 static int __attribute__((cold)) cobalt_mutex_autoinit(pthread_mutex_t *mutex)
 {
static pthread_mutex_t uninit_normal_mutex = PTHREAD_MUTEX_INITIALIZER;
+   struct cobalt_mutex_shadow *_mutex =
+   &((union cobalt_mutex_union *)mutex)->shadow_mutex;
static pthread_mutex_t uninit_recursive_mutex =
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static pthread_mutex_t uninit_errorcheck_mutex =
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+   int err __attribute__((unused));
pthread_mutexattr_t mattr;
-   int ret, type;
+   int ret = 0, type;
 
if (memcmp(mutex, &uninit_normal_mutex, sizeof(*mutex)) == 0)
type = PTHREAD_MUTEX_DEFAULT;
@@ -194,7 +208,13 @@ static int __attribute__((cold)) 
cobalt_mutex_autoinit(pthread_mutex_t *mutex)
 
pthread_mutexattr_init(&mattr);
pthread_mutexattr_settype(&mattr, type);
-   ret = __COBALT(pthread_mutex_init(mutex, &mattr));
+   err = __COBALT(pthread_mutex_lock(&cobalt_autoinit_mutex));
+   assert(err = 0);
+   if (_mutex->magic != COBALT_MUTEX_MAGIC)
+   ret = __COBALT(pthread_mutex_init(mutex, &mattr));
+   err = __COBALT(pthread_mutex_unlock(&cobalt_autoinit_mutex));
+   assert(err == 0);
+
pthread_mutexattr_destroy(&mattr);
 
return ret;


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


[Xenomai-git] Philippe Gerum : cobalt/posix/sched: add support for sched_setscheduler(2)

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 507c4d17abef6feeeb1538c6e28b442fb27c57c4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=507c4d17abef6feeeb1538c6e28b442fb27c57c4

Author: Philippe Gerum 
Date:   Thu Sep 17 00:30:06 2015 +0200

cobalt/posix/sched: add support for sched_setscheduler(2)

---

 .../arch/x86/include/asm/xenomai/syscall32-table.h |1 +
 kernel/cobalt/posix/sched.c|   54 
 kernel/cobalt/posix/sched.h|   13 +
 kernel/cobalt/posix/syscall32.c|   22 +++-
 kernel/cobalt/posix/syscall32.h|7 +++
 kernel/cobalt/posix/thread.c   |   42 ++-
 kernel/cobalt/posix/thread.h   |   13 +++--
 kernel/cobalt/trace/cobalt-posix.h |   32 
 8 files changed, 152 insertions(+), 32 deletions(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
index 1dce4e7..53aa131 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -48,6 +48,7 @@ __COBALT_CALL32x_THUNK(mq_notify)
 __COBALT_CALL32emu_THUNK(sched_weightprio)
 __COBALT_CALL32emu_THUNK(sched_setconfig_np)
 __COBALT_CALL32emu_THUNK(sched_getconfig_np)
+__COBALT_CALL32emu_THUNK(sched_setscheduler_ex)
 __COBALT_CALL32emu_THUNK(timer_create)
 __COBALT_CALL32x_THUNK(timer_create)
 __COBALT_CALL32emu_THUNK(timer_settime)
diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c
index be2e441..ff4fdc9 100644
--- a/kernel/cobalt/posix/sched.c
+++ b/kernel/cobalt/posix/sched.c
@@ -731,6 +731,60 @@ COBALT_SYSCALL(sched_weightprio, current,
return __cobalt_sched_weightprio(policy, ¶m_ex);
 }
 
+int cobalt_sched_setscheduler_ex(pid_t pid,
+int policy,
+const struct sched_param_ex *param_ex,
+__u32 __user *u_winoff,
+int __user *u_promoted)
+{
+   struct cobalt_local_hkey hkey;
+   struct cobalt_thread *thread;
+   int ret, promoted = 0;
+   spl_t s;
+
+   trace_cobalt_sched_setscheduler(pid, policy, param_ex);
+
+   if (pid) {
+   xnlock_get_irqsave(&nklock, s);
+   thread = cobalt_thread_find(pid);
+   xnlock_put_irqrestore(&nklock, s);
+   } else
+   thread = cobalt_current_thread();
+
+   if (thread == NULL) {
+   if (u_winoff == NULL)
+   return -ESRCH;
+   
+   thread = cobalt_thread_shadow(current, &hkey, u_winoff);
+   if (IS_ERR(thread))
+   return PTR_ERR(thread);
+
+   promoted = 1;
+   }
+
+   ret = __cobalt_thread_setschedparam_ex(thread, policy, param_ex);
+   if (ret)
+   return ret;
+
+   return cobalt_copy_to_user(u_promoted, &promoted, sizeof(promoted));
+}
+
+COBALT_SYSCALL(sched_setscheduler_ex, conforming,
+  (pid_t pid,
+   int policy,
+   const struct sched_param_ex __user *u_param,
+   __u32 __user *u_winoff,
+   int __user *u_promoted))
+{
+   struct sched_param_ex param_ex;
+
+   if (cobalt_copy_from_user(¶m_ex, u_param, sizeof(param_ex)))
+   return -EFAULT;
+
+   return cobalt_sched_setscheduler_ex(pid, policy, ¶m_ex,
+   u_winoff, u_promoted);
+}
+
 void cobalt_sched_reclaim(struct cobalt_process *process)
 {
struct cobalt_resources *p = &process->resources;
diff --git a/kernel/cobalt/posix/sched.h b/kernel/cobalt/posix/sched.h
index ae7b618..4ccef3c 100644
--- a/kernel/cobalt/posix/sched.h
+++ b/kernel/cobalt/posix/sched.h
@@ -57,6 +57,12 @@ ssize_t __cobalt_sched_getconfig_np(int cpu, int policy,
  void __user 
*u_config, size_t u_len,
  const union 
sched_config *config,
  size_t len));
+int cobalt_sched_setscheduler_ex(pid_t pid,
+int policy,
+const struct sched_param_ex *param_ex,
+__u32 __user *u_winoff,
+int __user *u_promoted);
+
 struct xnsched_class *
 cobalt_sched_policy_param(union xnsched_policy_param *param,
  int u_policy, const struct sched_param_ex *param_ex,
@@ -82,6 +88,13 @@ COBALT_SYSCALL_DECL(sched_getconfig_np,
 union sched_config __user *u_config,
 size_t len));
 
+COBALT_SYSCALL_DECL(sched_setscheduler_ex,
+   (pid_t pid,
+int policy,
+con

[Xenomai-git] Philippe Gerum : lib/cobalt: add API context tags

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b0cf167b7e9b181967eb5c618296729c03990db5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b0cf167b7e9b181967eb5c618296729c03990db5

Author: Philippe Gerum 
Date:   Thu Oct  1 21:27:40 2015 +0200

lib/cobalt: add API context tags

---

 lib/cobalt/clock.c |   11 +++
 lib/cobalt/cond.c  |   15 ++-
 lib/cobalt/mq.c|   11 +++
 lib/cobalt/mutex.c |   14 ++
 lib/cobalt/sched.c |   17 -
 lib/cobalt/semaphore.c |   19 +++
 lib/cobalt/thread.c|   15 ++-
 lib/cobalt/timer.c |8 
 lib/copperplate/init.c |   44 +++-
 9 files changed, 134 insertions(+), 20 deletions(-)

diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index 3fe6658..0450019 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -95,6 +95,7 @@
  * http://www.opengroup.org/onlinepubs/95399/functions/clock_getres.html";>
  * Specification.
  *
+ * @apitags{unrestricted}
  */
 COBALT_IMPL(int, clock_getres, (clockid_t clock_id, struct timespec *tp))
 {
@@ -175,6 +176,7 @@ static int __do_clock_host_realtime(struct timespec *ts)
  * http://www.opengroup.org/onlinepubs/95399/functions/clock_gettime.html";>
  * Specification.
  *
+ * @apitags{unrestricted}
  */
 COBALT_IMPL(int, clock_gettime, (clockid_t clock_id, struct timespec *tp))
 {
@@ -229,6 +231,7 @@ COBALT_IMPL(int, clock_gettime, (clockid_t clock_id, struct 
timespec *tp))
  * http://www.opengroup.org/onlinepubs/95399/functions/clock_settime.html";>
  * Specification.
  *
+ * @apitags{unrestricted}
  */
 COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec 
*tp))
 {
@@ -281,6 +284,7 @@ COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const 
struct timespec *tp))
  * http://www.opengroup.org/onlinepubs/95399/functions/clock_nanosleep.html";>
  * Specification.
  *
+ * @apitags{xthread-only, switch-primary}
  */
 COBALT_IMPL(int, clock_nanosleep, (clockid_t clock_id,
   int flags,
@@ -326,6 +330,7 @@ COBALT_IMPL(int, clock_nanosleep, (clockid_t clock_id,
  * http://www.opengroup.org/onlinepubs/95399/functions/nanosleep.html";>
  * Specification.
  *
+ * @apitags{xthread-only, switch-primary}
  */
 COBALT_IMPL(int, nanosleep, (const struct timespec *rqtp, struct timespec 
*rmtp))
 {
@@ -340,6 +345,8 @@ COBALT_IMPL(int, nanosleep, (const struct timespec *rqtp, 
struct timespec *rmtp)
return 0;
 }
 
+/* @apitags{thread-unrestricted, switch-primary} */
+
 COBALT_IMPL(unsigned int, sleep, (unsigned int seconds))
 {
struct timespec rqt, rem;
@@ -357,6 +364,8 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds))
return 0;
 }
 
+/* @apitags{unrestricted} */
+
 COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz))
 {
struct timespec ts;
@@ -368,6 +377,8 @@ COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct 
timezone *tz))
return ret;
 }
 
+/* @apitags{unrestricted} */
+
 COBALT_IMPL(time_t, time, (time_t *t))
 {
struct timespec ts;
diff --git a/lib/cobalt/cond.c b/lib/cobalt/cond.c
index bb9e84c..19ef372 100644
--- a/lib/cobalt/cond.c
+++ b/lib/cobalt/cond.c
@@ -107,6 +107,8 @@ void cobalt_default_condattr_init(void)
  * @see
  * http://www.opengroup.org/onlinepubs/95399/functions/pthread_cond_init.html";>
  * Specification.
+ *
+ * @apitags{thread-unrestricted}
  */
 COBALT_IMPL(int, pthread_cond_init, (pthread_cond_t *cond,
 const pthread_condattr_t * attr))
@@ -161,6 +163,7 @@ COBALT_IMPL(int, pthread_cond_init, (pthread_cond_t *cond,
  * http://www.opengroup.org/onlinepubs/95399/functions/pthread_cond_destroy.html";>
  * Specification.
  *
+ * @apitags{thread-unrestricted}
  */
 COBALT_IMPL(int, pthread_cond_destroy, (pthread_cond_t *cond))
 {
@@ -245,6 +248,7 @@ static int __attribute__((cold)) 
cobalt_cond_autoinit(pthread_cond_t *cond)
  * http://www.opengroup.org/onlinepubs/95399/functions/pthread_cond_wait.html";>
  * Specification.
  *
+ * @apitags{xthread-only, switch-primary}
  */
 COBALT_IMPL(int, pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t 
*mutex))
 {
@@ -338,6 +342,7 @@ COBALT_IMPL(int, pthread_cond_wait, (pthread_cond_t *cond, 
pthread_mutex_t *mute
  * http://www.opengroup.org/onlinepubs/95399/functions/pthread_cond_timedwait.html";>
  * Specification.
  *
+ * @apitags{xthread-only, switch-primary}
  */
 COBALT_IMPL(int, pthread_cond_timedwait, (pthread_cond_t *cond,
  pthread_mutex_t *mutex,
@@ -418,7 +423,8 @@ COBALT_IMPL(int, pthread_cond_timedwait, (pthread_cond_t 
*cond,
  * http://www.opengroup.org/onlinepubs/95399/functions/pthread_cond_signal.html.";>
  * Specification.
  *
- */
+  * @apitags{xthread-only}
+*/
 COBALT_IMPL(int, pthread_cond_signal, (pthread_cond_t *cond))
 {
struct cobalt

[Xenomai-git] Philippe Gerum : cobalt/rtdm: display path of wrongly accessed file

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: bc30c3d719ed39f1864e66144e5ff18031f4a8dd
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bc30c3d719ed39f1864e66144e5ff18031f4a8dd

Author: Philippe Gerum 
Date:   Sat Oct  3 18:11:45 2015 +0200

cobalt/rtdm: display path of wrongly accessed file

---

 kernel/cobalt/rtdm/fd.c |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/kernel/cobalt/rtdm/fd.c b/kernel/cobalt/rtdm/fd.c
index 4d1e597..aeb494b 100644
--- a/kernel/cobalt/rtdm/fd.c
+++ b/kernel/cobalt/rtdm/fd.c
@@ -730,37 +730,39 @@ void rtdm_fd_init(void)
kthread_run(fd_cleanup_thread, NULL, "rtdm_fd");
 }
 
-static inline void warn_user(const char *name)
+static inline void warn_user(struct file *file, const char *call)
 {
+   struct dentry *dentry = file->f_path.dentry;
+   
printk(XENO_WARNING
-  "%s[%d] called regular %s() with RTDM file/socket\n",
-  current->comm, current->pid, name + 5);
+  "%s[%d] called regular %s() on /dev/rtdm/%s\n",
+  current->comm, current->pid, call + 5, dentry->d_name.name);
 }
 
 static ssize_t dumb_read(struct file *file, char  __user *buf,
 size_t count, loff_t __user *ppos)
 {
-   warn_user(__func__);
+   warn_user(file, __func__);
return -EINVAL;
 }
 
 static ssize_t dumb_write(struct file *file,  const char __user *buf,
  size_t count, loff_t __user *ppos)
 {
-   warn_user(__func__);
+   warn_user(file, __func__);
return -EINVAL;
 }
 
 static unsigned int dumb_poll(struct file *file, poll_table *pt)
 {
-   warn_user(__func__);
+   warn_user(file, __func__);
return -EINVAL;
 }
 
 static long dumb_ioctl(struct file *file, unsigned int cmd,
   unsigned long arg)
 {
-   warn_user(__func__);
+   warn_user(file, __func__);
return -EINVAL;
 }
 


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


[Xenomai-git] Gilles Chanteperdrix : rtnet/icmp: reference socket in icmp_dest_socket()

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 51258eccf7e4d650e5e86816e1c2592fa01a51f9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=51258eccf7e4d650e5e86816e1c2592fa01a51f9

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 23:09:31 2015 +0200

rtnet/icmp: reference socket in icmp_dest_socket()

Otherwise when rt_ip_rcv() dereferences the socket, its fake reference
count reaches 0, which causes a destruction of the nonexistent file
descriptor associated with this fake icmp socket. Ending up with a
kernel oops in fd_cleanup_thread().

---

 kernel/drivers/net/stack/ipv4/icmp.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/drivers/net/stack/ipv4/icmp.c 
b/kernel/drivers/net/stack/ipv4/icmp.c
index 4b83942..b6ae736 100644
--- a/kernel/drivers/net/stack/ipv4/icmp.c
+++ b/kernel/drivers/net/stack/ipv4/icmp.c
@@ -446,8 +446,7 @@ static struct rt_icmp_control 
rt_icmp_pointers[NR_ICMP_TYPES+1] =
  */
 struct rtsocket *rt_icmp_dest_socket(struct rtskb *skb)
 {
-/* Note that the socket's refcount is not used by this protocol.
- * The socket returned here is static and not part of the global pool. */
+rt_socket_reference(icmp_socket);
 return icmp_socket;
 }
 


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


[Xenomai-git] Gilles Chanteperdrix : rtnet/rt2500: fix rtwlan dependency

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4f89d73a8dd6ebe660b89dfe0ab7262f3057ee94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4f89d73a8dd6ebe660b89dfe0ab7262f3057ee94

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 01:18:05 2015 +0200

rtnet/rt2500: fix rtwlan dependency

---

 kernel/drivers/net/drivers/experimental/rt2500/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/drivers/net/drivers/experimental/rt2500/Kconfig 
b/kernel/drivers/net/drivers/experimental/rt2500/Kconfig
index da13f30..0544128 100644
--- a/kernel/drivers/net/drivers/experimental/rt2500/Kconfig
+++ b/kernel/drivers/net/drivers/experimental/rt2500/Kconfig
@@ -1,4 +1,4 @@
 config XENO_DRIVERS_NET_DRV_RT2500
 depends on XENO_DRIVERS_NET && PCI
 tristate "Ralink 2500 WLAN"
-select RTNET_RTWLAN
+select XENO_DRIVERS_NET_RTWLAN


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


[Xenomai-git] Philippe Gerum : cobalt/posix/memory: use fixed minors for UMM devices

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 411605d4fac651577d932f51f7a978d92f09d074
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=411605d4fac651577d932f51f7a978d92f09d074

Author: Philippe Gerum 
Date:   Sun Oct  4 10:17:52 2015 +0200

cobalt/posix/memory: use fixed minors for UMM devices

---

 kernel/cobalt/posix/memory.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/posix/memory.c b/kernel/cobalt/posix/memory.c
index 9e4d093..5304272 100644
--- a/kernel/cobalt/posix/memory.c
+++ b/kernel/cobalt/posix/memory.c
@@ -210,9 +210,8 @@ static struct rtdm_driver umm_driver = {
  RTDM_CLASS_MEMORY,
  RTDM_SUBCLASS_GENERIC,
  0),
-   .device_flags   =   RTDM_NAMED_DEVICE,
+   .device_flags   =   RTDM_NAMED_DEVICE|RTDM_FIXED_MINOR,
.device_count   =   2,
-   .context_size   =   0,
.ops = {
.ioctl_rt   =   umm_ioctl_rt,
.ioctl_nrt  =   umm_ioctl_nrt,
@@ -225,10 +224,12 @@ static struct rtdm_device umm_devices[] = {
[ UMM_PRIVATE ] = {
.driver = &umm_driver,
.label = COBALT_MEMDEV_PRIVATE,
+   .minor = UMM_PRIVATE,
},
[ UMM_SHARED ] = {
.driver = &umm_driver,
.label = COBALT_MEMDEV_SHARED,
+   .minor = UMM_SHARED,
},
 };
 
@@ -239,7 +240,6 @@ static struct rtdm_driver sysmem_driver = {
  0),
.device_flags   =   RTDM_NAMED_DEVICE,
.device_count   =   1,
-   .context_size   =   0,
.ops = {
.open   =   sysmem_open,
.ioctl_rt   =   sysmem_ioctl_rt,


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


[Xenomai-git] Gilles Chanteperdrix : rtnet/socket: rework reference counting

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 45474093d65bfa43968815520059dd530b4d9b78
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=45474093d65bfa43968815520059dd530b4d9b78

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 23:17:18 2015 +0200

rtnet/socket: rework reference counting

With socket pools allocations locking sockets, when a received packet
switches from the device pool to the socket pool and is queued in a
socket incoming queue, the socket is locked preventing its destruction
until all packets have been received. This is probably the reason for
this bug report:
http://xenomai.org/pipermail/xenomai/2015-June/034345.html

Furthermore, when looking at the code in af_packet.c when a packet has
been acquired by the socket pool, but is not yet queued, the socket is
locked, so, the socket can not disappear and the packet leak, so the
locking is redundant. The case of ip_input.c is a bit different as there
is a small window where a packet is in flight and a socket can be
closed, but this can been fixed.

What can happen however, is that a module can be removed in the middle
of the packet reception, causing all sorts of trouble.

So, this commit:
- suppresses the locking of sockets by the socket pool allocation;
- gets sockets creation to lock the module in which they are created;
- fixes packet delivery in ip_input.c to lock the destination socket as
long as the packet has not been delivered.

---

 kernel/drivers/net/stack/include/rtnet_socket.h |   16 +--
 kernel/drivers/net/stack/ipv4/icmp.c|8 ++--
 kernel/drivers/net/stack/ipv4/ip_fragment.c |   19 ++--
 kernel/drivers/net/stack/ipv4/ip_input.c|   10 ++--
 kernel/drivers/net/stack/packet/af_packet.c |4 --
 kernel/drivers/net/stack/rtmac/rtmac_vnic.c |   17 +--
 kernel/drivers/net/stack/rtskb.c|   17 ++-
 kernel/drivers/net/stack/socket.c   |   58 +++
 8 files changed, 82 insertions(+), 67 deletions(-)

diff --git a/kernel/drivers/net/stack/include/rtnet_socket.h 
b/kernel/drivers/net/stack/include/rtnet_socket.h
index 363267e..cddf328 100644
--- a/kernel/drivers/net/stack/include/rtnet_socket.h
+++ b/kernel/drivers/net/stack/include/rtnet_socket.h
@@ -78,6 +78,8 @@ struct rtsocket {
int  ifindex;
} packet;
 } prot;
+
+struct module *owner;
 };
 
 
@@ -91,7 +93,11 @@ static inline struct rtdm_fd *rt_socket_fd(struct rtsocket 
*sock)
 #define rt_socket_dereference(sock) \
 rtdm_fd_unlock(rt_socket_fd(sock))
 
-int rt_socket_init(struct rtdm_fd *fd, unsigned short protocol);
+int __rt_socket_init(struct rtdm_fd *fd, unsigned short protocol,
+   struct module *module);
+#define rt_socket_init(fd, proto) \
+__rt_socket_init(fd, proto, THIS_MODULE)
+
 void rt_socket_cleanup(struct rtdm_fd *fd);
 int rt_socket_common_ioctl(struct rtdm_fd *fd, int request, void *arg);
 int rt_socket_if_ioctl(struct rtdm_fd *fd, int request, void *arg);
@@ -100,12 +106,16 @@ int rt_socket_select_bind(struct rtdm_fd *fd,
  enum rtdm_selecttype type,
  unsigned fd_index);
 
-int rt_bare_socket_init(struct rtdm_fd *fd, unsigned short protocol,
-   unsigned int priority, unsigned int pool_size);
+int __rt_bare_socket_init(struct rtdm_fd *fd, unsigned short protocol,
+   unsigned int priority, unsigned int pool_size,
+   struct module *module);
+#define rt_bare_socket_init(fd, proto, prio, pool_sz) \
+__rt_bare_socket_init(fd, proto, prio, pool_sz, THIS_MODULE)
 
 static inline void rt_bare_socket_cleanup(struct rtsocket *sock)
 {
 rtskb_pool_release(&sock->skb_pool);
+module_put(sock->owner);
 }
 
 #endif  /* __RTNET_SOCKET_H_ */
diff --git a/kernel/drivers/net/stack/ipv4/icmp.c 
b/kernel/drivers/net/stack/ipv4/icmp.c
index b6ae736..58d97cd 100644
--- a/kernel/drivers/net/stack/ipv4/icmp.c
+++ b/kernel/drivers/net/stack/ipv4/icmp.c
@@ -524,11 +524,11 @@ static struct rtinet_protocol icmp_protocol = {
  */
 void __init rt_icmp_init(void)
 {
-unsigned int skbs;
+int skbs;
 
-
-skbs = rt_bare_socket_init(icmp_fd, IPPROTO_ICMP, RT_ICMP_PRIO,
-   ICMP_REPLY_POOL_SIZE);
+skbs = __rt_bare_socket_init(icmp_fd, IPPROTO_ICMP, RT_ICMP_PRIO,
+   ICMP_REPLY_POOL_SIZE, NULL);
+BUG_ON(skbs < 0);
 if (skbs < ICMP_REPLY_POOL_SIZE)
printk("RTnet: allocated only %d icmp rtskbs\n", skbs);
 
diff --git a/kernel/drivers/net/stack/ipv4/ip_fragment.c 
b/kernel/drivers/net/stack/ipv4/ip_fragment.c
index 31f3e0a..593aec2 100644
--- a/kernel/drivers/net/stack/ipv4/ip_fragment.c
+++ b/kernel/drivers/net/stack/ipv4/ip_fragment.c
@@ -112,7 +112,7 @@ static void alloc_collector(struct rtskb *skb, struct 
rtsocket *sock)
  * */
 static struct rtskb *add_to_collector(struct rtskb *skb, unsigned int offset, 
int more_frags)
 {
-int

[Xenomai-git] Philippe Gerum : copperplate/heapobj: fix unused_result warning

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: cb582eeb1dc8c35bf720c52755cbfb198330626d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cb582eeb1dc8c35bf720c52755cbfb198330626d

Author: Philippe Gerum 
Date:   Thu Oct  1 09:32:14 2015 +0200

copperplate/heapobj: fix unused_result warning

---

 lib/copperplate/heapobj-pshared.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/copperplate/heapobj-pshared.c 
b/lib/copperplate/heapobj-pshared.c
index 38b4bca..8c5dac6 100644
--- a/lib/copperplate/heapobj-pshared.c
+++ b/lib/copperplate/heapobj-pshared.c
@@ -706,7 +706,8 @@ reset:
 * former session with more permissive access rules, such as
 * group-controlled access.
 */
-   fchown(fd, geteuid(), getegid());
+   ret = fchown(fd, geteuid(), getegid());
+   (void)ret;
 init:
ret = ftruncate(fd, 0);  /* Clear all previous contents if any. */
if (__bterrno(ret))


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


[Xenomai-git] Philippe Gerum : lib/cobalt: group process scheduling calls

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 2d6661e832ec83298ced89fcb71febfc6836b410
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2d6661e832ec83298ced89fcb71febfc6836b410

Author: Philippe Gerum 
Date:   Thu Sep 17 00:46:13 2015 +0200

lib/cobalt: group process scheduling calls

---

 lib/cobalt/Makefile.am |1 +
 lib/cobalt/sched.c |  390 
 lib/cobalt/thread.c|  345 --
 3 files changed, 391 insertions(+), 345 deletions(-)

diff --git a/lib/cobalt/Makefile.am b/lib/cobalt/Makefile.am
index 2bfc3e3..576122d 100644
--- a/lib/cobalt/Makefile.am
+++ b/lib/cobalt/Makefile.am
@@ -25,6 +25,7 @@ libcobalt_la_SOURCES =\
mutex.c \
printf.c\
rtdm.c  \
+   sched.c \
select.c\
semaphore.c \
signal.c\
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
new file mode 100644
index 000..b0be725
--- /dev/null
+++ b/lib/cobalt/sched.c
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2005-2015 Philippe Gerum .
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "current.h"
+#include "internal.h"
+
+/**
+ * @ingroup cobalt_api
+ * @defgroup cobalt_api_scheduler Process scheduling
+ *
+ * Cobalt/POSIX process scheduling
+ *
+ * @see
+ * http://pubs.opengroup.org/onlinepubs/95399/functions/xsh_chap02_08.html#tag_02_08_04";>
+ * Specification.
+ *
+ *@{
+ */
+
+/**
+ * Yield the processor.
+ *
+ * This function move the current thread at the end of its priority group.
+ *
+ * @retval 0
+ *
+ * @see
+ * http://www.opengroup.org/onlinepubs/95399/functions/sched_yield.html";>
+ * Specification.
+ *
+ */
+COBALT_IMPL(int, sched_yield, (void))
+{
+   if (cobalt_get_current() == XN_NO_HANDLE ||
+   (cobalt_get_current_mode() & (XNWEAK|XNRELAX)) == (XNWEAK|XNRELAX))
+   return __STD(sched_yield());
+
+   return -XENOMAI_SYSCALL0(sc_cobalt_sched_yield);
+}
+
+/**
+ * Get minimum priority of the specified scheduling policy.
+ *
+ * This service returns the minimum priority of the scheduling policy @a
+ * policy.
+ *
+ * @param policy scheduling policy.
+ *
+ * @retval 0 on success;
+ * @retval -1 with @a errno set if:
+ * - EINVAL, @a policy is invalid.
+ *
+ * @see
+ * http://www.opengroup.org/onlinepubs/95399/functions/sched_get_priority_min.html";>
+ * Specification.
+ *
+ */
+COBALT_IMPL(int, sched_get_priority_min, (int policy))
+{
+   int ret;
+
+   switch (policy) {
+   case SCHED_FIFO:
+   case SCHED_RR:
+   break;
+   default:
+   ret = XENOMAI_SYSCALL1(sc_cobalt_sched_minprio, policy);
+   if (ret >= 0)
+   return ret;
+   if (ret != -EINVAL) {
+   errno = -ret;
+   return -1;
+   }
+   }
+
+   return __STD(sched_get_priority_min(policy));
+}
+
+/**
+ * Get extended minimum priority of the specified scheduling policy.
+ *
+ * This service returns the minimum priority of the scheduling policy
+ * @a policy, reflecting any Cobalt extension to the standard classes.
+ *
+ * @param policy scheduling policy.
+ *
+ * @retval 0 on success;
+ * @retval -1 with @a errno set if:
+ * - EINVAL, @a policy is invalid.
+ *
+ * @see
+ * http://www.opengroup.org/onlinepubs/95399/functions/sched_get_priority_min.html";>
+ * Specification.
+ *
+ */
+int sched_get_priority_min_ex(int policy)
+{
+   int ret;
+
+   ret = XENOMAI_SYSCALL1(sc_cobalt_sched_minprio, policy);
+   if (ret >= 0)
+   return ret;
+   if (ret != -EINVAL) {
+   errno = -ret;
+   return -1;
+   }
+
+   return __STD(sched_get_priority_min(policy));
+}
+
+/**
+ * Get maximum priority of the specified scheduling policy.
+ *
+ * This service returns the maximum priority of the scheduling policy @a
+ * policy.
+ *
+ * @param policy scheduling policy.
+ *
+ * @retval 0 on success;
+ * @retval -1 with @a errno set if:
+ * - EINVAL, @a policy is invalid.

[Xenomai-git] Gilles Chanteperdrix : rtnet/macb: add compatible string for sama5d3 gem

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 82bb96c63c8413f2e0d6cd050caeee676aaf6d77
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=82bb96c63c8413f2e0d6cd050caeee676aaf6d77

Author: Gilles Chanteperdrix 
Date:   Sat Oct  3 14:20:56 2015 +0200

rtnet/macb: add compatible string for sama5d3 gem

---

 kernel/drivers/net/drivers/macb.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/drivers/net/drivers/macb.c 
b/kernel/drivers/net/drivers/macb.c
index e166db9..04f4c77 100644
--- a/kernel/drivers/net/drivers/macb.c
+++ b/kernel/drivers/net/drivers/macb.c
@@ -1539,6 +1539,7 @@ static const struct of_device_id macb_dt_ids[] = {
{ .compatible = "cdns,macb" },
{ .compatible = "cdns,pc302-gem" },
{ .compatible = "cdns,gem" },
+   { .compatible = "atmel,sama5d3-gem" },
{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, macb_dt_ids);


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: d18d5aa14deb8c81cef820f88bae8a5004d360cf
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d18d5aa14deb8c81cef820f88bae8a5004d360cf

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:33 2015 +0200

cobalt/powerpc: upgrade I-pipe support

---

 .../patches/ipipe-core-3.16.7-powerpc-5.patch  |15596 
 ...-2.patch => ipipe-core-3.18.20-powerpc-3.patch} |   89 +-
 2 files changed, 56 insertions(+), 15629 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=d18d5aa14deb8c81cef820f88bae8a5004d360cf

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


[Xenomai-git] Philippe Gerum : copperplate/timerobj: use default stack size for the server thread

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: eca8bf3db696ba473fc2312d2279e866e60ef979
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=eca8bf3db696ba473fc2312d2279e866e60ef979

Author: Philippe Gerum 
Date:   Mon Aug 24 14:32:35 2015 +0200

copperplate/timerobj: use default stack size for the server thread

PTHREAD_STACK_MIN * 16 was preposterous : there is specific stack size
requirement for the timer server thread, compared to any application
thread traversing the Xenomai libraries. Use PTHREAD_STACK_DEFAULT
instead.

---

 lib/copperplate/timerobj.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/copperplate/timerobj.c b/lib/copperplate/timerobj.c
index bbfa8f2..cbfcda5 100644
--- a/lib/copperplate/timerobj.c
+++ b/lib/copperplate/timerobj.c
@@ -149,7 +149,7 @@ static void timerobj_spawn_server(void)
cta.prologue = server_prologue;
cta.run = timerobj_server;
cta.arg = NULL;
-   cta.stacksize = PTHREAD_STACK_MIN * 16;
+   cta.stacksize = PTHREAD_STACK_DEFAULT;
cta.detachstate = PTHREAD_CREATE_DETACHED;
 
__bt(copperplate_create_thread(&cta, &svthread));


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


[Xenomai-git] Philippe Gerum : copperplate: preserve error number in failure path

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 51ab58c067a0464b183f5a2fd318fcd9d97bc380
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=51ab58c067a0464b183f5a2fd318fcd9d97bc380

Author: Philippe Gerum 
Date:   Wed Sep 23 09:11:51 2015 +0200

copperplate: preserve error number in failure path

---

 lib/copperplate/init.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index a9b4efd..54b4276 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -152,6 +152,7 @@ static int get_session_label(const char *optarg)
char *session, *grpname, *p;
struct group *grp;
gid_t gid;
+   int ret;
 
session = strdup(optarg);
grpname = strrchr(session, '/');
@@ -172,8 +173,9 @@ static int get_session_label(const char *optarg)
}
 
if (grp == NULL) {
+   ret = errno ? -errno : -EINVAL;
warning("invalid group %s", grpname);
-   return errno ? -errno : -EINVAL;
+   return ret;
}
 
__copperplate_setup_data.session_gid = grp->gr_gid;


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


[Xenomai-git] Philippe Gerum : drivers/autotune: convert to new style rtdm_task_set_period()

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 78cc1d68bd8ede65b6a86186e899cb9ec8f70fe1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=78cc1d68bd8ede65b6a86186e899cb9ec8f70fe1

Author: Philippe Gerum 
Date:   Sun Sep 27 16:12:02 2015 +0200

drivers/autotune: convert to new style rtdm_task_set_period()

---

 kernel/cobalt/rtdm/drvlib.c|2 +-
 kernel/drivers/autotune/autotune.c |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index 7b3ab1a..05af769 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -211,7 +211,7 @@ void rtdm_task_set_priority(rtdm_task_t *task, int 
priority);
  * to @a period nanoseconds after the current date.
 
  * @param[in] period New period in nanoseconds of a cyclic task, zero
- * for non-cyclic mode.
+ * to disable cyclic mode for @a task.
  *
  * @coretags{task-unrestricted}
  *
diff --git a/kernel/drivers/autotune/autotune.c 
b/kernel/drivers/autotune/autotune.c
index 8060c3c..8d6cafe 100644
--- a/kernel/drivers/autotune/autotune.c
+++ b/kernel/drivers/autotune/autotune.c
@@ -244,8 +244,8 @@ void task_handler(void *arg)
if (ret)
break;
 
-   ret = xnthread_set_periodic(&k_tuner->task, k_tuner->start_time,
-   XN_ABSOLUTE, k_tuner->interval);
+   ret = rtdm_task_set_period(&k_tuner->task, k_tuner->start_time,
+  k_tuner->interval);
if (ret)
break;
 
@@ -256,7 +256,7 @@ void task_handler(void *arg)
 
now = xnclock_read_raw(&nkclock);
if (add_sample(&k_tuner->tuner, now)) {
-   rtdm_task_set_period(&k_tuner->task, 0);
+   rtdm_task_set_period(&k_tuner->task, 0, 0);
break;
}
}


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


[Xenomai-git] Gilles Chanteperdrix : demo/posix/cobalt: add RTnet eth_p_all demo

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 00ab5613729904ed7456fd9d8831ac33ff648c1f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=00ab5613729904ed7456fd9d8831ac33ff648c1f

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 23:07:17 2015 +0200

demo/posix/cobalt: add RTnet eth_p_all demo

---

 demo/posix/cobalt/Makefile.am |   20 +---
 demo/posix/cobalt/eth_p_all.c |  108 +
 2 files changed, 121 insertions(+), 7 deletions(-)

diff --git a/demo/posix/cobalt/Makefile.am b/demo/posix/cobalt/Makefile.am
index cb854f3..eedc346 100644
--- a/demo/posix/cobalt/Makefile.am
+++ b/demo/posix/cobalt/Makefile.am
@@ -5,12 +5,13 @@ CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
 demo_PROGRAMS =\
bufp-label  \
bufp-readwrite  \
+   can_rtt \
+   eth_p_all   \
iddp-label  \
iddp-sendrecv   \
xddp-echo   \
xddp-label  \
-   xddp-stream \
-   can_rtt
+   xddp-stream
 
 cppflags = \
$(XENO_USER_CFLAGS) \
@@ -33,6 +34,16 @@ bufp_readwrite_CPPFLAGS = $(cppflags)
 bufp_readwrite_LDFLAGS = $(ldflags)
 bufp_readwrite_LDADD = $(ldadd)
 
+can_rtt_SOURCES = can-rtt.c
+can_rtt_CPPFLAGS = $(cppflags)
+can_rtt_LDFLAGS = $(ldflags)
+can_rtt_LDADD = $(ldadd)
+
+eth_p_all_SOURCES = eth_p_all.c
+eth_p_all_CPPFLAGS = $(cppflags)
+eth_p_all_LDFLAGS = $(ldflags)
+eth_p_all_LDADD = $(ldadd)
+
 iddp_label_SOURCES = iddp-label.c
 iddp_label_CPPFLAGS = $(cppflags)
 iddp_label_LDFLAGS = $(ldflags)
@@ -57,8 +68,3 @@ xddp_stream_SOURCES = xddp-stream.c
 xddp_stream_CPPFLAGS = $(cppflags)
 xddp_stream_LDFLAGS = $(ldflags)
 xddp_stream_LDADD = $(ldadd)
-
-can_rtt_SOURCES = can-rtt.c
-can_rtt_CPPFLAGS = $(cppflags)
-can_rtt_LDFLAGS = $(ldflags)
-can_rtt_LDADD = $(ldadd)
diff --git a/demo/posix/cobalt/eth_p_all.c b/demo/posix/cobalt/eth_p_all.c
new file mode 100644
index 000..6ac12ab
--- /dev/null
+++ b/demo/posix/cobalt/eth_p_all.c
@@ -0,0 +1,108 @@
+/***
+ *
+ *  demo/posix/cobalt/rtnet-eth_p_all.c
+ *
+ *  ETH_P_ALL receiver - listens for all incoming packets and dumps them
+ *
+ *  Copyright (C) 2006 Jan Kiszka 
+ *
+ *  RTnet - real-time networking example
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+char buffer[10*1024];
+int sock;
+
+
+static void catch_signal(int sig)
+{
+   close(sock);
+}
+
+
+int main(int argc, char *argv[])
+{
+   struct sched_param param = { .sched_priority = 1 };
+   ssize_t len;
+   struct sockaddr_ll addr;
+   struct ether_header *eth = (struct ether_header *)buffer;
+
+
+   signal(SIGTERM, catch_signal);
+   signal(SIGINT, catch_signal);
+   signal(SIGHUP, catch_signal);
+   mlockall(MCL_CURRENT|MCL_FUTURE);
+
+   if ((sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
+   perror("socket cannot be created");
+   return EXIT_FAILURE;
+   }
+
+   if (argc > 1) {
+   struct ifreq ifr;
+
+   strncpy(ifr.ifr_name, argv[1], IFNAMSIZ);
+   if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0) {
+   perror("cannot get interface index");
+   close(sock);
+   return EXIT_FAILURE;
+   }
+
+   addr.sll_family   = AF_PACKET;
+   addr.sll_protocol = ETH_P_ALL;
+   addr.sll_ifindex  = ifr.ifr_ifindex;
+
+   if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+   perror("cannot bind to local ip/port");
+   close(sock);
+   return EXIT_FAILURE;
+   }
+   }
+
+   pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
+
+   while (1) {
+   len = recv(sock, buffer, sizeof(buffer), 0);
+   if (len < 0)
+   break;
+
+   printf("from: %s type: %04x length=%zd\n",
+   ether_ntoa((struct ether_addr *)eth->ether_shost),
+   ntohs(eth->ether_type), len);
+   }
+
+   printf("shutting down\n");

[Xenomai-git] Philippe Gerum : cobalt: bump ABI revision level

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b76ee0e0d0071f617355877b8ef5ae2f5eb6e31b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b76ee0e0d0071f617355877b8ef5ae2f5eb6e31b

Author: Philippe Gerum 
Date:   Thu Jul 30 14:20:45 2015 +0200

cobalt: bump ABI revision level

---

 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h  |2 +-
 kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h |2 +-
 kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h  |2 +-
 kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h  |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
index fe50182..44d 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
@@ -22,7 +22,7 @@
 #define _COBALT_ARM_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   15UL
+#define XENOMAI_ABI_REV   16UL
 
 #define XENOMAI_FEAT_DEP (__xn_feat_generic_mask)
 
diff --git a/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
index 1a86ee7..31c833e 100644
--- a/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/blackfin/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_BLACKFIN_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   15UL
+#define XENOMAI_ABI_REV   16UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
index 124c1de..cbc64f2 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_POWERPC_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   15UL
+#define XENOMAI_ABI_REV   16UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
index 723cc75..0a06d12 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
@@ -19,7 +19,7 @@
 #define _COBALT_X86_ASM_UAPI_FEATURES_H
 
 /* The ABI revision level we use on this arch. */
-#define XENOMAI_ABI_REV   15UL
+#define XENOMAI_ABI_REV   16UL
 
 #define XENOMAI_FEAT_DEP  __xn_feat_generic_mask
 


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


[Xenomai-git] Philippe Gerum : lib, utils: cleanup getopt_long option arrays

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 85110e10ea3a5965f46e55b53caa9fc60b751e91
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=85110e10ea3a5965f46e55b53caa9fc60b751e91

Author: Philippe Gerum 
Date:   Sun Oct  4 17:36:48 2015 +0200

lib, utils: cleanup getopt_long option arrays

---

 lib/alchemy/init.c|   11 ++-
 lib/boilerplate/setup.c   |   15 ++-
 lib/cobalt/init.c |   12 +---
 lib/copperplate/init.c|   12 ++--
 lib/copperplate/regd/regd.c   |   18 +++---
 lib/psos/init.c   |9 -
 lib/smokey/init.c |9 +
 lib/vxworks/init.c|   11 ++-
 utils/analogy/analogy_calibrate.c |   13 -
 utils/autotune/autotune.c |   12 
 utils/corectl/corectl.c   |4 +++-
 utils/hdb/hdb.c   |2 +-
 utils/slackspot/slackspot.c   |   31 +++
 13 files changed, 64 insertions(+), 95 deletions(-)

diff --git a/lib/alchemy/init.c b/lib/alchemy/init.c
index 14eb4d1..2efd138 100644
--- a/lib/alchemy/init.c
+++ b/lib/alchemy/init.c
@@ -49,16 +49,9 @@ static const struct option alchemy_options[] = {
{
 #define clock_resolution_opt   0
.name = "alchemy-clock-resolution",
-   .has_arg = 1,
-   .flag = NULL,
-   .val = 0
+   .has_arg = required_argument,
},
-   {
-   .name = NULL,
-   .has_arg = 0,
-   .flag = NULL,
-   .val = 0
-   }
+   { /* Sentinel */ }
 };
 
 static int alchemy_parse_option(int optnum, const char *optarg)
diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index 5273a5e..1cc66a7 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -56,55 +56,60 @@ static const struct option base_options[] = {
{
 #define affinity_opt   1
.name = "cpu-affinity",
-   .has_arg = 1,
+   .has_arg = required_argument,
},
{
 #define verbose_opt2
.name = "verbose",
-   .has_arg = 2,
+   .has_arg = optional_argument,
},
{
 #define silent_opt 3
.name = "silent",
+   .has_arg = no_argument,
.flag = &__base_setup_data.verbosity_level,
.val = 0,
},
{
 #define quiet_opt  4
.name = "quiet",
+   .has_arg = no_argument,
.flag = &__base_setup_data.verbosity_level,
.val = 0,
},
{
 #define version_opt5
.name = "version",
+   .has_arg = no_argument,
},
{
 #define dumpconfig_opt 6
.name = "dump-config",
+   .has_arg = no_argument,
},
{
 #define no_sanity_opt  7
.name = "no-sanity",
+   .has_arg = no_argument,
.flag = &__base_setup_data.no_sanity,
.val = 1
},
{
 #define sanity_opt 8
.name = "sanity",
+   .has_arg = no_argument,
.flag = &__base_setup_data.no_sanity,
},
{
 #define no_mlock_opt   9
 #ifdef CONFIG_XENO_MERCURY
.name = "no-mlock",
+   .has_arg = no_argument,
.flag = &__base_setup_data.no_mlock,
.val = 1
 #endif
},
-   {
-   /* sentinel */
-   }
+   { /* Sentinel */ }
 };
 
 void __weak application_version(void)
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 9d1674d..3e88d06 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -56,26 +56,24 @@ static const struct option cobalt_options[] = {
{
 #define main_prio_opt  0
.name = "main-prio",
-   .has_arg = 1,
+   .has_arg = required_argument,
},
{
 #define print_bufsz_opt1
.name = "print-buffer-size",
-   .has_arg = 1,
+   .has_arg = required_argument,
},
{
 #define print_bufcnt_opt   2
.name = "print-buffer-count",
-   .has_arg = 1,
+   .has_arg = required_argument,
},
{
 #define print_syncdelay_opt3
.name = "print-sync-delay",
-   .has_arg = 1,
+   .has_arg = required_argument,
},
-   {
-   /* sentinel */
-   }
+   { /* Sentinel */ }
 };
 
 static void sigill_handler(int sig)
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index f12bffc..3ce4584 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -51,33 +51,33 @@ static const struct option copperplate_options[] = {
{
 #define mempool_opt0
.name = "mem-pool-size",
-  

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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 52a2ed8549b5909cd1356986f5ff5ff591a0cfed
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=52a2ed8549b5909cd1356986f5ff5ff591a0cfed

Author: Philippe Gerum 
Date:   Tue Sep 15 11:24:28 2015 +0200

cobalt/blackfin: upgrade I-pipe support

---

 ...1.patch => ipipe-core-3.18.20-blackfin-2.patch} | 2117 ++--
 1 file changed, 187 insertions(+), 1930 deletions(-)

diff --git 
a/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.12-blackfin-1.patch 
b/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-2.patch
similarity index 85%
rename from 
kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.12-blackfin-1.patch
rename to 
kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-2.patch
index 3ec93af..b646b42 100644
--- a/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.12-blackfin-1.patch
+++ b/kernel/cobalt/arch/blackfin/patches/ipipe-core-3.18.20-blackfin-2.patch
@@ -12,7 +12,7 @@ index af76634..ebff376 100644
  
  comment "Processor and Board Settings"
 diff --git a/arch/blackfin/include/asm/ipipe.h 
b/arch/blackfin/include/asm/ipipe.h
-index fe1160f..2a486ff 100644
+index fe1160f..7e99af8 100644
 --- a/arch/blackfin/include/asm/ipipe.h
 +++ b/arch/blackfin/include/asm/ipipe.h
 @@ -28,7 +28,7 @@
@@ -32,7 +32,7 @@ index fe1160f..2a486ff 100644
 -#define IPIPE_MAJOR_NUMBER1
 -#define IPIPE_MINOR_NUMBER16
 -#define IPIPE_PATCH_NUMBER1
-+#define IPIPE_CORE_RELEASE1
++#define IPIPE_CORE_RELEASE2
  
  #ifdef CONFIG_SMP
  #error "I-pipe/blackfin: SMP not implemented"
@@ -636,7 +636,7 @@ index a017359..e6ad56f 100644
} \
  } \
 diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
-index f657b38..a34ef5b 100644
+index f657b38..4f8ff6d 100644
 --- a/arch/blackfin/kernel/ipipe.c
 +++ b/arch/blackfin/kernel/ipipe.c
 @@ -32,32 +32,29 @@
@@ -685,7 +685,7 @@ index f657b38..a34ef5b 100644
  
  /*
   * __ipipe_enable_pipeline() -- We are running on the boot CPU, hw
-@@ -71,214 +68,86 @@ void __ipipe_enable_pipeline(void)
+@@ -71,214 +68,76 @@ void __ipipe_enable_pipeline(void)
__ipipe_freq_scale = 10UL / __ipipe_core_clock;
  
for (irq = 0; irq < NR_IRQS; ++irq)
@@ -905,10 +905,9 @@ index f657b38..a34ef5b 100644
 - * works for virtual interrupts.
 - */
 -int ipipe_trigger_irq(unsigned irq)
-+void ipipe_raise_irq(unsigned int irq)
- {
-   unsigned long flags;
- 
+-{
+-  unsigned long flags;
+-
 -#ifdef CONFIG_IPIPE_DEBUG
 -  if (irq >= IPIPE_NR_IRQS ||
 -  (ipipe_virtual_irq_p(irq)
@@ -916,20 +915,19 @@ index f657b38..a34ef5b 100644
 -  return -EINVAL;
 -#endif
 -
-   flags = hard_local_irq_save();
-   __ipipe_handle_irq(irq, NULL);
-   hard_local_irq_restore(flags);
+-  flags = hard_local_irq_save();
+-  __ipipe_handle_irq(irq, NULL);
+-  hard_local_irq_restore(flags);
 -
 -  return 1;
- }
-+EXPORT_SYMBOL_GPL(ipipe_raise_irq);
- 
+-}
+-
 -asmlinkage void __ipipe_sync_root(void)
 +void __ipipe_sync_root(void)
  {
void (*irq_tail_hook)(void) = (void (*)(void))__ipipe_irq_tail_hook;
struct ipipe_percpu_domain_data *p;
-@@ -293,23 +162,14 @@ asmlinkage void __ipipe_sync_root(void)
+@@ -293,23 +152,14 @@ asmlinkage void __ipipe_sync_root(void)
  
clear_thread_flag(TIF_IRQ_SYNC);
  
@@ -956,7 +954,7 @@ index f657b38..a34ef5b 100644
  {
/*
 * This code is called by the ins{bwl} routines (see
-@@ -320,12 +180,15 @@ void __ipipe_disable_root_irqs_hw(void)
+@@ -320,12 +170,15 @@ void __ipipe_disable_root_irqs_hw(void)
 * the real-time domain.
 */
bfin_sti(__ipipe_irq_lvmask);
@@ -975,7 +973,7 @@ index f657b38..a34ef5b 100644
bfin_sti(bfin_irq_flags);
  }
  
-@@ -334,64 +197,155 @@ void __ipipe_enable_root_irqs_hw(void)
+@@ -334,64 +187,155 @@ void __ipipe_enable_root_irqs_hw(void)
   * manipulation routines, but let's prepare for SMP support in the
   * same move, preventing CPU migration as required.
   */
@@ -1884,10 +1882,10 @@ index e5c31ea..8dce875 100644
.probe  = serial8250_probe,
.remove = serial8250_remove,
 diff --git a/fs/exec.c b/fs/exec.c
-index 7302b75..e6035e6 100644
+index b7a5f46..0582bd6 100644
 --- a/fs/exec.c
 +++ b/fs/exec.c
-@@ -820,6 +820,7 @@ static int exec_mmap(struct mm_struct *mm)
+@@ -823,6 +823,7 @@ static int exec_mmap(struct mm_struct *mm)
  {
struct task_struct *tsk;
struct mm_struct *old_mm, *active_mm;
@@ -1895,7 +1893,7 @@ index 7302b75..e6035e6 100644
  
/* Notify parent that we're no longer interested in the old VM */
tsk = current;
-@@ -843,8 +844,10 @@ static int exec_mmap(struct mm_struct *mm)
+@@ -846,8 +847,10 @@ static int exec_mmap(struct mm_struct *mm)
task_lock(tsk);
active_mm = tsk->active_mm;
tsk->mm = mm;
@@ -2197,18 +2195,6 @@ index abcafaa..a8440e4 100644
  } cacheline_aligned;
  
  /*
-diff --git a/inc

[Xenomai-git] Gilles Chanteperdrix : rtnet/ip: reorder cleanup

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 851fa778d7b2bb41a4a5eeaa55f58f70eb2698af
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=851fa778d7b2bb41a4a5eeaa55f58f70eb2698af

Author: Gilles Chanteperdrix 
Date:   Wed Sep 30 22:27:52 2015 +0200

rtnet/ip: reorder cleanup

Unregistering the packet type must be done first, in order to avoid
receiving packets during cleanup.

---

 kernel/drivers/net/stack/ipv4/af_inet.c   |3 ++-
 kernel/drivers/net/stack/ipv4/ip_output.c |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/drivers/net/stack/ipv4/af_inet.c 
b/kernel/drivers/net/stack/ipv4/af_inet.c
index 84abbf1..3780ffd 100644
--- a/kernel/drivers/net/stack/ipv4/af_inet.c
+++ b/kernel/drivers/net/stack/ipv4/af_inet.c
@@ -342,6 +342,8 @@ static int __init rt_ipv4_proto_init(void)
 
 static void __exit rt_ipv4_proto_release(void)
 {
+rt_ip_release();
+
 rtdev_del_event_hook(&rtdev_hook);
 rtnet_unregister_ioctls(&ipv4_ioctls);
 rt_ip_routing_release();
@@ -355,7 +357,6 @@ static void __exit rt_ipv4_proto_release(void)
 
 /* Network-Layer */
 rt_arp_release();
-rt_ip_release();
 }
 
 
diff --git a/kernel/drivers/net/stack/ipv4/ip_output.c 
b/kernel/drivers/net/stack/ipv4/ip_output.c
index 996aae5..89ca085 100644
--- a/kernel/drivers/net/stack/ipv4/ip_output.c
+++ b/kernel/drivers/net/stack/ipv4/ip_output.c
@@ -275,10 +275,10 @@ void __init rt_ip_init(void)
  */
 void rt_ip_release(void)
 {
-rt_ip_fragment_cleanup();
 while (rtdev_remove_pack(&ip_packet_type) == -EAGAIN) {
printk("RTnet IP: waiting for protocol unregistration\n");
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1*HZ); /* wait a second */
 }
+rt_ip_fragment_cleanup();
 }


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


[Xenomai-git] Philippe Gerum : utils/autotune: use default stack size

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 1c7fdf668a941ddd265cf29dc18f6d2410cd4c41
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1c7fdf668a941ddd265cf29dc18f6d2410cd4c41

Author: Philippe Gerum 
Date:   Mon Aug 24 11:53:50 2015 +0200

utils/autotune: use default stack size

libcobalt sets a reasonable default stack size when initializing an
attribute descriptor, and autotune's stack requirements are
basic. Don't overwrite the default settings, use them.

---

 utils/autotune/autotune.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index 57a34f8..bbd16c7 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -159,7 +159,6 @@ static void create_sampler(pthread_t *tid, int fd)
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
param.sched_priority = 99;
pthread_attr_setschedparam(&attr, ¶m);
-   pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 4);
ret = pthread_create(tid, &attr, sampler_thread, (void *)(long)fd);
if (ret)
error(1, ret, "sampling thread");
@@ -180,7 +179,6 @@ static void create_load(pthread_t *tid)
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
param.sched_priority = 1;
pthread_attr_setschedparam(&attr, ¶m);
-   pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 8);
ret = pthread_create(tid, &attr, load_thread, NULL);
if (ret)
error(1, ret, "load thread");


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: afbe6d48c2a43daddabf5e20cb9c0f631e925098
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=afbe6d48c2a43daddabf5e20cb9c0f631e925098

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:37 2015 +0200

cobalt/x86: upgrade I-pipe support

---

 .../arch/x86/patches/ipipe-core-3.16.7-x86-5.patch |15377 
 ...-x86-2.patch => ipipe-core-3.18.20-x86-3.patch} |   89 +-
 2 files changed, 56 insertions(+), 15410 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=afbe6d48c2a43daddabf5e20cb9c0f631e925098

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


[Xenomai-git] Philippe Gerum : testsuite/smokey: use default stack size in Cobalt tests

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c0ce791ed24305b9d8ba8680b288ee98bbfb6eaa
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c0ce791ed24305b9d8ba8680b288ee98bbfb6eaa

Author: Philippe Gerum 
Date:   Mon Aug 24 11:57:17 2015 +0200

testsuite/smokey: use default stack size in Cobalt tests

See f10d08fd92127.

---

 testsuite/smokey/posix-cond/posix-cond.c   |1 -
 testsuite/smokey/posix-mutex/posix-mutex.c |1 -
 testsuite/smokey/sched-quota/sched-quota.c |2 --
 testsuite/smokey/sched-tp/sched-tp.c   |1 -
 4 files changed, 5 deletions(-)

diff --git a/testsuite/smokey/posix-cond/posix-cond.c 
b/testsuite/smokey/posix-cond/posix-cond.c
index cea2516..5429d1f 100644
--- a/testsuite/smokey/posix-cond/posix-cond.c
+++ b/testsuite/smokey/posix-cond/posix-cond.c
@@ -139,7 +139,6 @@ static int thread_spawn(pthread_t *thread, int prio,
param.sched_priority = prio;
pthread_attr_setschedparam(&tattr, ¶m);
pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE);
-   pthread_attr_setstacksize(&tattr, PTHREAD_STACK_MIN * 2);
 
err = pthread_create(thread, &tattr, handler, cookie);
 
diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index 173182f..8298351 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -220,7 +220,6 @@ static int dispatch(const char *service_name,
pthread_attr_setschedparam(&threadattr, ¶m);
pthread_attr_setinheritsched(&threadattr,
 PTHREAD_EXPLICIT_SCHED);
-   pthread_attr_setstacksize(&threadattr, PTHREAD_STACK_MIN * 2);
handler = va_arg(ap, void *);
status = pthread_create(thread, &threadattr, handler,
va_arg(ap, void *));
diff --git a/testsuite/smokey/sched-quota/sched-quota.c 
b/testsuite/smokey/sched-quota/sched-quota.c
index 3f7a8ea..574f971 100644
--- a/testsuite/smokey/sched-quota/sched-quota.c
+++ b/testsuite/smokey/sched-quota/sched-quota.c
@@ -121,7 +121,6 @@ static void __create_quota_thread(pthread_t *tid, const 
char *name,
param_ex.sched_priority = 1;
param_ex.sched_quota_group = tgid;
pthread_attr_setschedparam_ex(&attr_ex, ¶m_ex);
-   pthread_attr_setstacksize_ex(&attr_ex, PTHREAD_STACK_MIN * 2);
ret = pthread_create_ex(tid, &attr_ex, thread_body, count_r);
if (ret)
error(1, ret, "pthread_create_ex(SCHED_QUOTA)");
@@ -146,7 +145,6 @@ static void __create_fifo_thread(pthread_t *tid, const char 
*name,
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
param.sched_priority = 1;
pthread_attr_setschedparam(&attr, ¶m);
-   pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 2);
ret = pthread_create(tid, &attr, thread_body, count_r);
if (ret)
error(1, ret, "pthread_create(SCHED_FIFO)");
diff --git a/testsuite/smokey/sched-tp/sched-tp.c 
b/testsuite/smokey/sched-tp/sched-tp.c
index f28de54..c15b0d9 100644
--- a/testsuite/smokey/sched-tp/sched-tp.c
+++ b/testsuite/smokey/sched-tp/sched-tp.c
@@ -114,7 +114,6 @@ static void __create_thread(pthread_t *tid, const char 
*name, int seq)
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
pthread_attr_setschedparam(&attr, ¶m);
-   pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 2);
ret = pthread_create(tid, &attr, thread_body, (void *)(long)seq);
if (ret)
error(1, ret, "pthread_create");


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


[Xenomai-git] Philippe Gerum : demo/posix: add cyclictest from stock rt-tests

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 790836f392dfd2acae4ddbfd926d43a7fabfda08
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=790836f392dfd2acae4ddbfd926d43a7fabfda08

Author: Philippe Gerum 
Date:   Wed Sep 30 16:13:39 2015 +0200

demo/posix: add cyclictest from stock rt-tests

---

 configure.ac   |1 +
 demo/posix/Makefile.am |6 +-
 demo/posix/cyclictest/Makefile.am  |   34 +
 demo/posix/cyclictest/README   |5 +
 demo/posix/cyclictest/cyclictest.c | 2203 
 demo/posix/cyclictest/error.c  |   96 ++
 demo/posix/cyclictest/error.h  |   19 +
 demo/posix/cyclictest/rt-sched.h   |   76 ++
 demo/posix/cyclictest/rt-utils.c   |  319 ++
 demo/posix/cyclictest/rt-utils.h   |   27 +
 demo/posix/cyclictest/rt_numa.h|  277 +
 11 files changed, 3061 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8f2136e..b613515 100644
--- a/configure.ac
+++ b/configure.ac
@@ -904,6 +904,7 @@ AC_CONFIG_FILES([ \
utils/net/Makefile \
demo/Makefile \
demo/posix/Makefile \
+   demo/posix/cyclictest/Makefile \
demo/posix/cobalt/Makefile \
demo/alchemy/Makefile \
demo/alchemy/cobalt/Makefile \
diff --git a/demo/posix/Makefile.am b/demo/posix/Makefile.am
index aa0f7f7..0dd66a5 100644
--- a/demo/posix/Makefile.am
+++ b/demo/posix/Makefile.am
@@ -1,6 +1,8 @@
 
+SUBDIRS = cyclictest
+
 if XENO_COBALT
-SUBDIRS = cobalt
+SUBDIRS += cobalt
 endif
 
-DIST_SUBDIRS = cobalt
+DIST_SUBDIRS = cyclictest cobalt
diff --git a/demo/posix/cyclictest/Makefile.am 
b/demo/posix/cyclictest/Makefile.am
new file mode 100644
index 000..ff62b37
--- /dev/null
+++ b/demo/posix/cyclictest/Makefile.am
@@ -0,0 +1,34 @@
+demodir = @XENO_DEMO_DIR@
+
+CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
+
+VERSION_STRING = 0.92
+
+demo_PROGRAMS = cyclictest
+
+cyclictest_CPPFLAGS =  \
+   $(XENO_USER_CFLAGS) \
+   -I$(top_srcdir)/include \
+   -DVERSION_STRING=$(VERSION_STRING)  \
+   -Wno-strict-prototypes  \
+   -Wno-implicit-function-declaration  \
+   -Wno-missing-prototypes \
+   -Wno-nonnull\
+   -Wno-unused-function\
+   -Wno-unused-result
+
+cyclictest_SOURCES =   \
+   cyclictest.c\
+   error.c \
+   error.h \
+   rt_numa.h   \
+   rt-sched.h  \
+   rt-utils.c  \
+   rt-utils.h
+
+cyclictest_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ $(XENO_POSIX_WRAPPERS)
+
+cyclictest_LDADD = \
+   ../../../lib/@XENO_CORE_LIB@\
+@XENO_USER_LDADD@  \
+   -lpthread -lrt -lm
diff --git a/demo/posix/cyclictest/README b/demo/posix/cyclictest/README
new file mode 100644
index 000..8186b04
--- /dev/null
+++ b/demo/posix/cyclictest/README
@@ -0,0 +1,5 @@
+
+This is the original cyclictest program from the PREEMPT-RT test
+suite as of version 0.92.
+
+See git://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git
diff --git a/demo/posix/cyclictest/cyclictest.c 
b/demo/posix/cyclictest/cyclictest.c
new file mode 100644
index 000..92c7043
--- /dev/null
+++ b/demo/posix/cyclictest/cyclictest.c
@@ -0,0 +1,2203 @@
+/*
+ * High resolution timer test software
+ *
+ * (C) 2013  Clark Williams 
+ * (C) 2013  John Kacur 
+ * (C) 2008-2012 Clark Williams 
+ * (C) 2005-2007 Thomas Gleixner 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License Version
+ * 2 as published by the Free Software Foundation.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "rt_numa.h"
+
+#include "rt-utils.h"
+
+#define DEFAULT_INTERVAL 1000
+#define DEFAULT_DISTANCE 500
+
+#ifndef SCHED_IDLE
+#define SCHED_IDLE 5
+#endif
+#ifndef SCHED_NORMAL
+#define SCHED_NORMAL SCHED_OTHER
+#endif
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+/* Ugly, but  */
+#define gettid() syscall(__NR_gettid)
+#define sigev_notify_thread_id _sigev_un._tid
+
+#ifdef __UCLIBC__
+#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
+   ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
+#define CPUCLOCK_SCHED  2
+
+static int clock_nanosleep(clockid_t clock_id, int flags, const struct 
timespec *req,
+  struct timespec *rem)
+{
+   if (clock_id == CLOCK_THREAD_CPUTIME_ID)
+   return -EINVAL;
+   if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
+   clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
+
+   return syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
+}
+

[Xenomai-git] Philippe Gerum : cobalt/posix: reserve syscall slots for sched_*(2) services

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: f3e62fe78905e46f6c66958232827bf00a4b1cad
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f3e62fe78905e46f6c66958232827bf00a4b1cad

Author: Philippe Gerum 
Date:   Tue Sep 15 11:52:08 2015 +0200

cobalt/posix: reserve syscall slots for sched_*(2) services

The intent is to run the regular rt-tests unmodified over
Cobalt. Currently Cobalt has no implementation for
sched_setscheduler(2), which causes the common cyclictest to
experience severe latencies.

---

 include/cobalt/uapi/syscall.h |   96 +
 1 file changed, 49 insertions(+), 47 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 6ed9132..9c2ead1 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -68,53 +68,55 @@
 #define sc_cobalt_sched_maxprio45
 #define sc_cobalt_sched_weightprio 46
 #define sc_cobalt_sched_yield  47
-#define sc_cobalt_sched_setconfig_np   48
-#define sc_cobalt_sched_getconfig_np   49
-#define sc_cobalt_timer_create 50
-#define sc_cobalt_timer_delete 51
-#define sc_cobalt_timer_settime52
-#define sc_cobalt_timer_gettime53
-#define sc_cobalt_timer_getoverrun 54
-#define sc_cobalt_timerfd_create   55
-#define sc_cobalt_timerfd_settime  56
-#define sc_cobalt_timerfd_gettime  57
-#define sc_cobalt_sigwait  58
-#define sc_cobalt_sigwaitinfo  59
-#define sc_cobalt_sigtimedwait 60
-#define sc_cobalt_sigpending   61
-#define sc_cobalt_kill 62
-#define sc_cobalt_sigqueue 63
-#define sc_cobalt_monitor_init 64
-#define sc_cobalt_monitor_destroy  65
-#define sc_cobalt_monitor_enter66
-#define sc_cobalt_monitor_wait 67
-#define sc_cobalt_monitor_sync 68
-#define sc_cobalt_monitor_exit 69
-#define sc_cobalt_event_init   70
-#define sc_cobalt_event_wait   71
-#define sc_cobalt_event_sync   72
-#define sc_cobalt_event_destroy73
-#define sc_cobalt_event_inquire74
-#define sc_cobalt_open 75
-#define sc_cobalt_socket   76
-#define sc_cobalt_close77
-#define sc_cobalt_ioctl78
-#define sc_cobalt_read 79
-#define sc_cobalt_write80
-#define sc_cobalt_recvmsg  81
-#define sc_cobalt_sendmsg  82
-#define sc_cobalt_mmap 83
-#define sc_cobalt_select   84
-#define sc_cobalt_fcntl85
-#define sc_cobalt_migrate  86
-#define sc_cobalt_archcall 87
-#define sc_cobalt_trace88
-#define sc_cobalt_corectl  89
-#define sc_cobalt_get_current  90
-#define sc_cobalt_mayday   91
-#define sc_cobalt_backtrace92
-#define sc_cobalt_serialdbg93
-#define sc_cobalt_extend   94
+#define sc_cobalt_sched_setscheduler_ex48
+#define sc_cobalt_sched_getscheduler_ex49
+#define sc_cobalt_sched_setconfig_np   50
+#define sc_cobalt_sched_getconfig_np   51
+#define sc_cobalt_timer_create 52
+#define sc_cobalt_timer_delete 53
+#define sc_cobalt_timer_settime54
+#define sc_cobalt_timer_gettime55
+#define sc_cobalt_timer_getoverrun 56
+#define sc_cobalt_timerfd_create   57
+#define sc_cobalt_timerfd_settime  58
+#define sc_cobalt_timerfd_gettime  59
+#define sc_cobalt_sigwait  60
+#define sc_cobalt_sigwaitinfo  61
+#define sc_cobalt_sigtimedwait 62
+#define sc_cobalt_sigpending   63
+#define sc_cobalt_kill 64
+#define sc_cobalt_sigqueue 65
+#define sc_cobalt_monitor_init 66
+#define sc_cobalt_monitor_destroy  67
+#define sc_cobalt_monitor_enter68
+#define sc_cobalt_monitor_wait 69
+#define sc_cobalt_monitor_sync 70
+#define sc_cobalt_monitor_exit 71
+#define sc_cobalt_event_init   72
+#define sc_cobalt_event_wait   73
+#define sc_cobalt_event_sync   74
+#define sc_cobalt_event_destroy75
+#define sc_cobalt_event_inquire  

[Xenomai-git] Philippe Gerum : cobalt/rtdm: update API dealing with periodic tasks

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 1c8a4e81df26498e2408828ada7b6139ccc19790
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1c8a4e81df26498e2408828ada7b6139ccc19790

Author: Philippe Gerum 
Date:   Fri Sep 25 17:57:46 2015 +0200

cobalt/rtdm: update API dealing with periodic tasks

rtdm_task_set_period() is updated to accept an initial date for
delimiting the time line.

rtdm_task_wait_period() now accepts a parameter to retrieve the count
of overruns upon -ETIMEDOUT error.

In addition, using the periodic task API from a Cobalt thread is
now allowed.

This enables more sophisticated periodic task processing, and closely
matches the inner xnthread* interface those calls are based on.

---

 include/cobalt/kernel/rtdm/driver.h  |9 +---
 kernel/cobalt/rtdm/drvlib.c  |   29 +-
 kernel/cobalt/thread.c   |8 +++
 kernel/drivers/autotune/autotune.c   |2 +-
 kernel/drivers/net/stack/rtcfg/rtcfg_timer.c |2 +-
 5 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index 80308ca..541fb04 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -1033,12 +1033,15 @@ static inline void rtdm_task_set_priority(rtdm_task_t 
*task, int priority)
 }
 
 static inline int rtdm_task_set_period(rtdm_task_t *task,
+  nanosecs_abs_t start_date,
   nanosecs_rel_t period)
 {
if (period < 0)
period = 0;
+   if (start_date == 0)
+   start_date = XN_INFINITE;
 
-   return xnthread_set_periodic(task, XN_INFINITE, XN_RELATIVE, period);
+   return xnthread_set_periodic(task, start_date, XN_ABSOLUTE, period);
 }
 
 static inline int rtdm_task_unblock(rtdm_task_t *task)
@@ -1054,11 +1057,11 @@ static inline rtdm_task_t *rtdm_task_current(void)
return xnthread_current();
 }
 
-static inline int rtdm_task_wait_period(void)
+static inline int rtdm_task_wait_period(unsigned long *overruns_r)
 {
if (!XENO_ASSERT(COBALT, !xnsched_unblockable_p()))
return -EPERM;
-   return xnthread_wait_period(NULL);
+   return xnthread_wait_period(overruns_r);
 }
 
 static inline int rtdm_task_sleep(nanosecs_rel_t delay)
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index ca46531..7b3ab1a 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -200,17 +200,36 @@ void rtdm_task_set_priority(rtdm_task_t *task, int 
priority);
 /**
  * @brief Adjust real-time task period
  *
- * @param[in,out] task Task handle as returned by rtdm_task_init()
- * @param[in] period New period in nanoseconds of a cyclic task, 0 for
- * non-cyclic mode
+ * @param[in,out] task Task handle as returned by rtdm_task_init(), or
+ * NULL for referring to the current RTDM task or Cobalt thread (see
+ * note).
+ *
+ * @param[in] start_date The initial (absolute) date of the first
+ * release point, expressed in nanoseconds.  @a task will be delayed
+ * by the first call to rtdm_task_wait_period() until this point is
+ * reached. If @a start_date is zero, the first release point is set
+ * to @a period nanoseconds after the current date.
+
+ * @param[in] period New period in nanoseconds of a cyclic task, zero
+ * for non-cyclic mode.
  *
  * @coretags{task-unrestricted}
+ *
+ * @note Both RTDM tasks in kernel space and Cobalt threads in
+ * user-space are based on Xenomai core threads, which implement this
+ * service. For this reason, enabling periodic timing for a Cobalt
+ * thread via the RTDM interface is possible.
  */
-int rtdm_task_set_period(rtdm_task_t *task, nanosecs_rel_t period);
+int rtdm_task_set_period(rtdm_task_t *task, nanosecs_abs_t start_date,
+nanosecs_rel_t period);
 
 /**
  * @brief Wait on next real-time task period
  *
+ * @param[in] overrun_r Address of a long word receiving the count of
+ * overruns if -ETIMEDOUT is returned, or NULL if the caller don't
+ * need that information.
+ *
  * @return 0 on success, otherwise:
  *
  * - -EINVAL is returned if calling task is not in periodic mode.
@@ -220,7 +239,7 @@ int rtdm_task_set_period(rtdm_task_t *task, nanosecs_rel_t 
period);
  *
  * @coretags{primary-only, might-switch}
  */
-int rtdm_task_wait_period(void);
+int rtdm_task_wait_period(unsigned long *overruns_r);
 
 /**
  * @brief Activate a blocked real-time task
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 6a571af..508ed69 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1236,10 +1236,10 @@ EXPORT_SYMBOL_GPL(xnthread_unblock);
  * @param idate The initial (absolute) date of the first release
  * point, expressed in nanoseconds. The affected thread will be
  * delayed by the first call to xnthread_wait_period() until this
- * point is reached. If @a idate is equa

[Xenomai-git] Philippe Gerum : copperplate: parse group id in session label tunable

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 53012ce1610f95b106f2d3be872fa6378612da81
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=53012ce1610f95b106f2d3be872fa6378612da81

Author: Philippe Gerum 
Date:   Wed Sep 23 09:19:44 2015 +0200

copperplate: parse group id in session label tunable

---

 include/copperplate/tunables.h |5 +
 lib/copperplate/init.c |5 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/copperplate/tunables.h b/include/copperplate/tunables.h
index 640b8b4..7b45c51 100644
--- a/include/copperplate/tunables.h
+++ b/include/copperplate/tunables.h
@@ -36,10 +36,7 @@ extern "C" {
 
 extern struct copperplate_setup_data __copperplate_setup_data;
 
-static inline define_config_tunable(session_label, const char *, label)
-{
-   __copperplate_setup_data.session_label = label;
-}
+define_config_tunable(session_label, const char *, label);
 
 static inline read_config_tunable(session_label, const char *)
 {
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index 54b4276..f26b2db 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -185,6 +185,11 @@ no_group:
return 0;
 }
 
+define_config_tunable(session_label, const char *, label)
+{
+   get_session_label(label);
+}
+
 static int copperplate_init(void)
 {
int ret, regflags = 0;


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


[Xenomai-git] Philippe Gerum : demo/posix/cyclictest: drop conflicting definitions

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 8d2fb51e0cd41ee9ccfbc6a51acdbcf682172df8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8d2fb51e0cd41ee9ccfbc6a51acdbcf682172df8

Author: Philippe Gerum 
Date:   Sat Oct  3 11:18:18 2015 +0200

demo/posix/cyclictest: drop conflicting definitions

---

 demo/posix/cyclictest/rt-sched.h |   15 ---
 1 file changed, 15 deletions(-)

diff --git a/demo/posix/cyclictest/rt-sched.h b/demo/posix/cyclictest/rt-sched.h
index 6c45f7a..064e51c 100644
--- a/demo/posix/cyclictest/rt-sched.h
+++ b/demo/posix/cyclictest/rt-sched.h
@@ -32,21 +32,6 @@
 #define SCHED_DEADLINE 6
 #endif
 
-#ifdef __x86_64__
-#define __NR_sched_setattr 314
-#define __NR_sched_getattr 315
-#endif
-
-#ifdef __i386__
-#define __NR_sched_setattr 351
-#define __NR_sched_getattr 352
-#endif
-
-#ifdef __arm__
-#define __NR_sched_setattr 380
-#define __NR_sched_getattr 381
-#endif
-
 struct sched_attr {
uint32_t size;
uint32_t sched_policy;


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


[Xenomai-git] Philippe Gerum : cobalt/posix/sched: add support for sched_getscheduler(2)

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4beb554db716acad7f5998e56ce2c1350146d98b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4beb554db716acad7f5998e56ce2c1350146d98b

Author: Philippe Gerum 
Date:   Tue Sep 22 10:41:09 2015 +0200

cobalt/posix/sched: add support for sched_getscheduler(2)

---

 .../arch/x86/include/asm/xenomai/syscall32-table.h |1 +
 kernel/cobalt/posix/sched.c|   41 ++
 kernel/cobalt/posix/sched.h|   11 +++-
 kernel/cobalt/posix/syscall32.c|   29 --
 kernel/cobalt/posix/syscall32.h|5 ++
 kernel/cobalt/posix/thread.c   |   58 +---
 kernel/cobalt/posix/thread.h   |8 ++-
 kernel/cobalt/trace/cobalt-posix.h |5 ++
 8 files changed, 119 insertions(+), 39 deletions(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
index 53aa131..7484c3a 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -49,6 +49,7 @@ __COBALT_CALL32emu_THUNK(sched_weightprio)
 __COBALT_CALL32emu_THUNK(sched_setconfig_np)
 __COBALT_CALL32emu_THUNK(sched_getconfig_np)
 __COBALT_CALL32emu_THUNK(sched_setscheduler_ex)
+__COBALT_CALL32emu_THUNK(sched_getscheduler_ex)
 __COBALT_CALL32emu_THUNK(timer_create)
 __COBALT_CALL32x_THUNK(timer_create)
 __COBALT_CALL32emu_THUNK(timer_settime)
diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c
index ff4fdc9..b73d531 100644
--- a/kernel/cobalt/posix/sched.c
+++ b/kernel/cobalt/posix/sched.c
@@ -785,6 +785,47 @@ COBALT_SYSCALL(sched_setscheduler_ex, conforming,
u_winoff, u_promoted);
 }
 
+int cobalt_sched_getscheduler_ex(pid_t pid,
+int *policy_r,
+struct sched_param_ex *param_ex)
+{
+   struct cobalt_thread *thread;
+   spl_t s;
+
+   trace_cobalt_sched_getscheduler(pid);
+
+   if (pid) {
+   xnlock_get_irqsave(&nklock, s);
+   thread = cobalt_thread_find(pid);
+   xnlock_put_irqrestore(&nklock, s);
+   } else
+   thread = cobalt_current_thread();
+
+   if (thread == NULL)
+   return -ESRCH;
+
+   return __cobalt_thread_getschedparam_ex(thread, policy_r, param_ex);
+}
+
+COBALT_SYSCALL(sched_getscheduler_ex, current,
+  (pid_t pid,
+   int __user *u_policy,
+   struct sched_param_ex __user *u_param))
+{
+   struct sched_param_ex param_ex;
+   int ret, policy;
+
+   ret = cobalt_sched_getscheduler_ex(pid, &policy, ¶m_ex);
+   if (ret)
+   return ret;
+
+   if (cobalt_copy_to_user(u_param, ¶m_ex, sizeof(param_ex)) ||
+   cobalt_copy_to_user(u_policy, &policy, sizeof(policy)))
+   return -EFAULT;
+
+   return 0;
+}
+
 void cobalt_sched_reclaim(struct cobalt_process *process)
 {
struct cobalt_resources *p = &process->resources;
diff --git a/kernel/cobalt/posix/sched.h b/kernel/cobalt/posix/sched.h
index 4ccef3c..2b23be0 100644
--- a/kernel/cobalt/posix/sched.h
+++ b/kernel/cobalt/posix/sched.h
@@ -63,6 +63,10 @@ int cobalt_sched_setscheduler_ex(pid_t pid,
 __u32 __user *u_winoff,
 int __user *u_promoted);
 
+int cobalt_sched_getscheduler_ex(pid_t pid,
+int *policy_r,
+struct sched_param_ex *param_ex);
+
 struct xnsched_class *
 cobalt_sched_policy_param(union xnsched_policy_param *param,
  int u_policy, const struct sched_param_ex *param_ex,
@@ -91,10 +95,15 @@ COBALT_SYSCALL_DECL(sched_getconfig_np,
 COBALT_SYSCALL_DECL(sched_setscheduler_ex,
(pid_t pid,
 int policy,
-const struct sched_param_ex *param_ex,
+const struct sched_param_ex __user *u_param,
 __u32 __user *u_winoff,
 int __user *u_promoted));
 
+COBALT_SYSCALL_DECL(sched_getscheduler_ex,
+   (pid_t pid,
+int __user *u_policy,
+struct sched_param_ex __user *u_param));
+
 void cobalt_sched_reclaim(struct cobalt_process *process);
 
 #endif /* !_COBALT_POSIX_SCHED_H */
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index fda93a9..d0af2cc 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -77,13 +77,15 @@ COBALT_SYSCALL32emu(thread_getschedparam_ex, current,
 struct compat_sched_param_ex __user *u_param))
 {
struct sched_param_ex param_ex;
-   int policy;
+   int ret, policy;
 
-   policy = __cobalt_thread_getsch

[Xenomai-git] Gilles Chanteperdrix : boilerplate: declare missing libc functions when wrapping

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 13930956223dc740815b4c17c959b7f8b03293f4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=13930956223dc740815b4c17c959b7f8b03293f4

Author: Gilles Chanteperdrix 
Date:   Fri Aug 21 23:37:54 2015 +0200

boilerplate: declare missing libc functions when wrapping

When compiling with a toolchain which does not implement
pthread_setname_np or clock_nanosleep, these functions are not declared
as a result of including their respective header.

However, when passing --skin=posix to xeno-config, an application
expects these functions to be declared, since they are wrapped and
implemented by libcobalt.

Fix this by moving their declaration in boilerplate/libc.h out of the
ifdef __IN_XENO__ section, but making it depend on a __COBALT_WRAP__
symbol, set in xeno-config when --skin=posix is passed.

---

 include/boilerplate/libc.h|   32 +++-
 scripts/xeno-config-cobalt.in |1 +
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 4d85ee9..7dd305f 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -144,15 +144,7 @@ __weak inline int clock_nanosleep(clockid_t clock_id, int 
flags,
 
return nanosleep(&tmp, remain);
 }
-#else  /* HAVE_CLOCK_NANOSLEEP || COBALT */
-/*
- * Either libcobalt or the libc implements this, we only want the
- * possibly missing declaration from the libc headers.
- */
-int clock_nanosleep(clockid_t clock_id, int flags,
-   const struct timespec *request,
-   struct timespec *remain);
-#endif /* HAVE_CLOCK_NANOSLEEP || COBALT */
+#endif /* !HAVE_CLOCK_NANOSLEEP && MERCURY */
 
 #ifndef HAVE_SCHED_GETCPU
 /*
@@ -192,11 +184,25 @@ int pthread_setname_np(pthread_t thread, const char *name)
 {
return ENOSYS;
 }
-#else /* HAVE_PTHREAD_SETNAME_NP || COBALT */
-/* Same as clock_nanosleep() */
-int pthread_setname_np(pthread_t thread, const char *name);
-#endif /* HAVE_PTHREAD_SETNAME_NP || COBALT */
+#endif /* !HAVE_PTHREAD_SETNAME_NP && MERCURY */
 
 #endif /* __IN_XENO__ */
 
+#if defined(__COBALT_WRAP__) || defined(__IN_XENO__)
+/*
+ * clock_nanosleep() and pthread_setname_np() must be declared when the libc
+ * does not declare them, both for compiling xenomai, and for compiling
+ * applications wrapping these symbols to the libcobalt versions.
+ */
+#ifndef HAVE_CLOCK_NANOSLEEP
+int clock_nanosleep(clockid_t clock_id, int flags,
+   const struct timespec *request,
+   struct timespec *remain);
+#endif /* !HAVE_CLOCK_NANOSLEEP */
+
+#ifndef HAVE_PTHREAD_SETNAME_NP
+int pthread_setname_np(pthread_t thread, const char *name);
+#endif /* !HAVE_PTHREAD_SETNAME_NP */
+#endif /* __COBALT_WRAP__ || __IN_XENO__ */
+
 #endif /* _BOILERPLATE_LIBC_H */
diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index d0da716..eefc0d9 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -195,6 +195,7 @@ if test x$do_cflags = xy; then
case "$skin" in
posix|rtdm)
test x$compat = xy && cflags="$cflags 
-I$XENO_INCLUDE_DIR/trank/posix"
+   cflags="$cflags -D__COBALT_WRAP__"
;;
cobalt)
;;


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


[Xenomai-git] Philippe Gerum : copperplate: enable group-based access to sessions

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: cf21e806295981a9d0e342f683bfef419b6e3c68
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cf21e806295981a9d0e342f683bfef419b6e3c68

Author: Philippe Gerum 
Date:   Fri Sep 11 18:47:24 2015 +0200

copperplate: enable group-based access to sessions

Passing --session foo/ will allow the members of the designated
UNIX group to attach the shared heap and use the Copperplate services
within a particular session.

 may be a valid GID or group name from /etc/group.  With
Cobalt, such group would typically match the xenomai.allowed_group
parameter passed to the kernel.

To set up a shared session involving non-privileged users, all of them
must be members of a dedicated UNIX group, and the following
operations should be carried out:

1. if using Cobalt, pass xenomai.gid= on the kernel command
line accordingly

2. set udev rules to chown+chmod /dev/rtdm/* files with proper group
permissions (e.g. for user group "xenomai" => SUBSYSTEM=="rtdm",
MODE="0660", GROUP="xenomai")

3. create the registry root manually with proper permissions, 1777 is
recommended if non-privileged processes will belong to the session

4. if --shared-registry is required from a non-privileged session
initiator (i.e. the first process establishing the session), set
user_allow_other in /etc/fuse.conf

5. to start a session with group-based access control, suffix the
session name with the allowed group name or id separated with a slash
('/') when starting the session initiator, i.e. --session
name/.

For instance, with {user} a member of the "xenomai" group:

/* The initiator of session 'foo' is [root] */
[root] ./program --session foo/xenomai

/* Bind a non-privileged process from {user} to session 'foo' */
{user} ./program --session foo

Or, with {user1} and {user2} both members of the "xenomai" group:

/* The initiator of session 'foo' is {user1} */
{user1} ./program --session foo/xenomai

/* Bind a process from {user2} to session 'foo' */
{user2} ./program --session foo

---

 include/copperplate/heapobj.h |8 --
 include/copperplate/threadobj.h   |3 +-
 include/copperplate/tunables.h|   11 
 lib/copperplate/cluster.c |5 +++-
 lib/copperplate/heapobj-pshared.c |   55 -
 lib/copperplate/init.c|   47 +--
 lib/copperplate/internal.c|   10 +++
 lib/copperplate/internal.h|2 ++
 lib/copperplate/registry.c|5 ++--
 lib/copperplate/threadobj.c   |   50 +
 10 files changed, 150 insertions(+), 46 deletions(-)

diff --git a/include/copperplate/heapobj.h b/include/copperplate/heapobj.h
index c61cf3e..4cf947e 100644
--- a/include/copperplate/heapobj.h
+++ b/include/copperplate/heapobj.h
@@ -192,11 +192,6 @@ struct sysgroup_memspec {
struct holder next;
 };
 
-struct agent_memspec {
-   /** Agent pid in owner process. */
-   pid_t pid;
-};
-
 static inline void *mainheap_ptr(memoff_t off)
 {
return off ? (void *)__memptr(__main_heap, off) : NULL;
@@ -326,9 +321,6 @@ char *xnstrdup(const char *ptr);
 struct sysgroup_memspec {
 };
 
-struct agent_memspec {
-};
-
 /*
  * Whether an object is laid in some shared heap. Never if pshared
  * mode is disabled.
diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h
index 1d01709..f27c111 100644
--- a/include/copperplate/threadobj.h
+++ b/include/copperplate/threadobj.h
@@ -212,7 +212,6 @@ struct threadobj {
struct traceobj *tracer;
sem_t *cancel_sem;
struct sysgroup_memspec memspec;
-   struct agent_memspec agent;
struct backtrace_data btd;
 };
 
@@ -392,7 +391,7 @@ static inline int threadobj_local_p(struct threadobj *thobj)
 
 void threadobj_init_key(void);
 
-int threadobj_pkg_init(void);
+int threadobj_pkg_init(int anon_session);
 
 #ifdef __cplusplus
 }
diff --git a/include/copperplate/tunables.h b/include/copperplate/tunables.h
index 8428716..640b8b4 100644
--- a/include/copperplate/tunables.h
+++ b/include/copperplate/tunables.h
@@ -27,6 +27,7 @@ struct copperplate_setup_data {
int no_registry;
int shared_registry;
size_t mem_pool;
+   gid_t session_gid;
 };
 
 #ifdef __cplusplus
@@ -85,6 +86,16 @@ static inline read_config_tunable(mem_pool_size, size_t)
return __copperplate_setup_data.mem_pool;
 }
 
+static inline define_config_tunable(session_gid, gid_t, gid)
+{
+   __copperplate_setup_data.session_gid = gid;
+}
+
+static inline read_config_tunable(session_gid, gid_t)
+{
+   return __copperplate_setup_data.session_gid;
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c
index eac0afe..f0552f0 100644
--- a/lib/copperplate/cluster.c
+++ b/lib/copperplate/cluster.c
@@ -174,8 +174,11 @@ static int cluster_probe(struct hashobj *hobj)
 * we can send the latter a signal, the node is deemed activ

[Xenomai-git] Philippe Gerum : lib/cobalt: wrap sched_setscheduler(2)

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 08fde44697b24c0be0c40ea33a6d19d4e6049922
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=08fde44697b24c0be0c40ea33a6d19d4e6049922

Author: Philippe Gerum 
Date:   Thu Sep 17 01:30:52 2015 +0200

lib/cobalt: wrap sched_setscheduler(2)

---

 include/cobalt/sched.h |   12 +++-
 lib/cobalt/cobalt.wrappers |1 +
 lib/cobalt/init.c  |4 +-
 lib/cobalt/internal.h  |3 +
 lib/cobalt/sched.c |  157 
 lib/cobalt/thread.c|   45 -
 lib/cobalt/wrappers.c  |7 ++
 7 files changed, 206 insertions(+), 23 deletions(-)

diff --git a/include/cobalt/sched.h b/include/cobalt/sched.h
index d7c72ca..12c33e6 100644
--- a/include/cobalt/sched.h
+++ b/include/cobalt/sched.h
@@ -25,20 +25,26 @@
 #include 
 #include 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 COBALT_DECL(int, sched_yield(void));
 
 COBALT_DECL(int, sched_get_priority_min(int policy));
 
 COBALT_DECL(int, sched_get_priority_max(int policy));
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+COBALT_DECL(int, sched_setscheduler(pid_t pid, int policy,
+   const struct sched_param *param));
 
 int sched_get_priority_min_ex(int policy);
 
 int sched_get_priority_max_ex(int policy);
 
+int sched_setscheduler_ex(pid_t pid, int policy,
+ const struct sched_param_ex *param_ex);
+
 int sched_setconfig_np(int cpu, int policy,
   const union sched_config *config, size_t len);
 
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index 4968340..c8e24cb 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -6,6 +6,7 @@
 --wrap sched_yield
 --wrap sched_get_priority_min
 --wrap sched_get_priority_max
+--wrap sched_setscheduler
 --wrap pthread_kill
 --wrap pthread_join
 --wrap pthread_setname_np
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index acad534..8a48428 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -199,7 +199,7 @@ int cobalt_init(void)
ret = __STD(pthread_getschedparam(ptid, &policy, &parm));
if (ret) {
early_warning("pthread_getschedparam failed");
-   return ret;
+   return -ret;
}
 
/*
@@ -224,7 +224,7 @@ int cobalt_init(void)
if (ret) {
early_warning("pthread_setschedparam failed (prio=%d)",
__cobalt_main_prio);
-   return ret;
+   return -ret;
}
 
return 0;
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index df7d416..540c286 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -55,6 +55,9 @@ void cobalt_default_mutexattr_init(void);
 
 void cobalt_default_condattr_init(void);
 
+int cobalt_xlate_schedparam(int policy,
+   const struct sched_param_ex *param_ex,
+   struct sched_param *param);
 int cobalt_init(void);
 
 struct cobalt_featinfo;
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index b0be725..d1abed8 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -172,6 +172,163 @@ COBALT_IMPL(int, sched_get_priority_max, (int policy))
 }
 
 /**
+ * Set the scheduling policy and parameters of the specified process.
+ *
+ * This service set the scheduling policy of the Xenomai process
+ * identified by @a pid to the value @a pol, and its scheduling
+ * parameters (i.e. its priority) to the value pointed to by @a par.
+ *
+ * If the current Linux thread ID is passed (see gettid(2)), this
+ * service turns the current thread into a Xenomai thread. If @a pid
+ * is neither the identifier of the current thread nor the identifier
+ * of an existing Xenomai thread, this service falls back to the
+ * regular sched_setscheduler() service, causing a transition to
+ * secondary mode if the caller is a Xenomai thread.
+ *
+ * @param pid target process/thread;
+ *
+ * @param policy scheduling policy, one of SCHED_FIFO, SCHED_RR, or
+ * SCHED_OTHER;
+ *
+ * @param param scheduling parameters address.
+ *
+ * @return 0 on success;
+ * @return an error number if:
+ * - ESRCH, @a pid is invalid;
+ * - EINVAL, @a pol or @a par->sched_priority is invalid;
+ * - EFAULT, @a par is an invalid address;
+ *
+ * @see
+ * http://www.opengroup.org/onlinepubs/95399/functions/sched_setscheduler.html";>
+ * Specification.
+ *
+ * @note
+ *
+ * When creating or shadowing a Xenomai thread for the first time,
+ * libcobalt installs an internal handler for the SIGSHADOW signal. If
+ * you had previously installed a handler for such signal before that
+ * point, such handler will be exclusively called for any SIGSHADOW
+ * occurrence Xenomai did not send.
+ *
+ * If, however, an application-defined handler for SIGSHADOW is
+ * installed afterwards, overriding the libcobalt handler, the new
+ * handler is required to call cobalt_sigshadow_handler() on
+ * entry. This routine

[Xenomai-git] Gilles Chanteperdrix : rtnet/routes: fix unbalanced module reference count

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 19976ac08eaf03b48d7481cd33f1c1f16c9448c4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=19976ac08eaf03b48d7481cd33f1c1f16c9448c4

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 03:15:37 2015 +0200

rtnet/routes: fix unbalanced module reference count

Happening when accessing /proc/rtnet/host_route and /proc/rtnet/net_route

---

 kernel/drivers/net/stack/ipv4/route.c |   70 -
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/kernel/drivers/net/stack/ipv4/route.c 
b/kernel/drivers/net/stack/ipv4/route.c
index fa51cf0..221bbcc 100644
--- a/kernel/drivers/net/stack/ipv4/route.c
+++ b/kernel/drivers/net/stack/ipv4/route.c
@@ -183,37 +183,44 @@ struct rtnet_ipv4_host_route_priv {
 };
 
 struct rtnet_ipv4_host_route_data {
-unsigned key;
+int key;
 char name[IFNAMSIZ];
 struct dest_route dest_host;
 };
 
 struct xnvfile_rev_tag host_route_tag;
 
-static int rtnet_ipv4_host_route_rewind(struct xnvfile_snapshot_iterator *it)
+static void *rtnet_ipv4_host_route_begin(struct xnvfile_snapshot_iterator *it)
 {
 struct rtnet_ipv4_host_route_priv *priv = xnvfile_iterator_priv(it);
-struct host_route *entry_ptr;
-unsigned key;
+struct rtnet_ipv4_host_route_data *data;
+unsigned routes;
 int err;
 
-err = rtnet_ipv4_module_lock(NULL);
-if (err < 0)
-   return err;
+routes = allocated_host_routes;
+if (!routes)
+   return VFILE_SEQ_EMPTY;
+
+data = kmalloc(sizeof(*data) * routes, GFP_KERNEL);
+if (data == NULL)
+   return NULL;
 
-for (key = 0; key < HOST_HASH_TBL_SIZE; key++)
-   if ((entry_ptr = host_hash_tbl[key]))
-   break;
+err = rtnet_ipv4_module_lock(NULL);
+if (err < 0) {
+   kfree(data);
+   return VFILE_SEQ_EMPTY;
+}
 
-priv->key = key;
-priv->entry_ptr = entry_ptr;
-return allocated_host_routes;
+priv->key = -1;
+priv->entry_ptr = NULL;
+return data;
 }
 
 static void rtnet_ipv4_host_route_end(struct xnvfile_snapshot_iterator *it,
void *buf)
 {
 rtnet_ipv4_module_unlock(NULL);
+kfree(buf);
 }
 
 static int rtnet_ipv4_host_route_next(struct xnvfile_snapshot_iterator *it,
@@ -271,7 +278,7 @@ static int rtnet_ipv4_host_route_show(struct 
xnvfile_snapshot_iterator *it,
 }
 
 static struct xnvfile_snapshot_ops rtnet_ipv4_host_route_vfile_ops = {
-.rewind = rtnet_ipv4_host_route_rewind,
+.begin = rtnet_ipv4_host_route_begin,
 .end = rtnet_ipv4_host_route_end,
 .next = rtnet_ipv4_host_route_next,
 .show = rtnet_ipv4_host_route_show,
@@ -314,7 +321,7 @@ struct rtnet_ipv4_net_route_priv {
 };
 
 struct rtnet_ipv4_net_route_data {
-unsigned key;
+int key;
 u32 dest_net_ip;
 u32 dest_net_mask;
 u32 gw_ip;
@@ -322,30 +329,37 @@ struct rtnet_ipv4_net_route_data {
 
 struct xnvfile_rev_tag net_route_tag;
 
-static int rtnet_ipv4_net_route_rewind(struct xnvfile_snapshot_iterator *it)
+static void *rtnet_ipv4_net_route_begin(struct xnvfile_snapshot_iterator *it)
 {
 struct rtnet_ipv4_net_route_priv *priv = xnvfile_iterator_priv(it);
-struct net_route *entry_ptr;
-unsigned key;
+struct rtnet_ipv4_net_route_data *data;
+unsigned routes;
 int err;
 
-err = rtnet_ipv4_module_lock(NULL);
-if (err < 0)
-   return err;
+routes = allocated_net_routes;
+if (!routes)
+   return VFILE_SEQ_EMPTY;
+
+data = kmalloc(sizeof(*data) * routes, GFP_KERNEL);
+if (data == NULL)
+   return NULL;
 
-for (key = 0; key < NET_HASH_TBL_SIZE + 1; key++)
-   if ((entry_ptr = net_hash_tbl[key]))
-   break;
+err = rtnet_ipv4_module_lock(NULL);
+if (err < 0) {
+   kfree(data);
+   return VFILE_SEQ_EMPTY;
+}
 
-priv->key = key;
-priv->entry_ptr = entry_ptr;
-return allocated_net_routes;
+priv->key = -1;
+priv->entry_ptr = NULL;
+return data;
 }
 
 static void rtnet_ipv4_net_route_end(struct xnvfile_snapshot_iterator *it,
void *buf)
 {
 rtnet_ipv4_module_unlock(NULL);
+kfree(buf);
 }
 
 static int rtnet_ipv4_net_route_next(struct xnvfile_snapshot_iterator *it,
@@ -400,7 +414,7 @@ static int rtnet_ipv4_net_route_show(struct 
xnvfile_snapshot_iterator *it,
 }
 
 static struct xnvfile_snapshot_ops rtnet_ipv4_net_route_vfile_ops = {
-.rewind = rtnet_ipv4_net_route_rewind,
+.begin = rtnet_ipv4_net_route_begin,
 .end = rtnet_ipv4_net_route_end,
 .next = rtnet_ipv4_net_route_next,
 .show = rtnet_ipv4_net_route_show,


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


[Xenomai-git] Philippe Gerum : scripts/xeno-config: drop obsolete --kcflags switch

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 50f6cb5ac2386f3a52f22514600e934a55483f45
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=50f6cb5ac2386f3a52f22514600e934a55483f45

Author: Philippe Gerum 
Date:   Sat Aug 22 11:14:56 2015 +0200

scripts/xeno-config: drop obsolete --kcflags switch

There is no point in keeping this switch, since the Kbuild system is
patched to preset the proper include paths for reaching Xenomai kernel
headers when building a RTDM driver over Cobalt.

---

 doc/asciidoc/man1/xeno-config.adoc |8 +---
 scripts/xeno-config-cobalt.in  |   21 -
 scripts/xeno-config-mercury.in |   13 -
 3 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/doc/asciidoc/man1/xeno-config.adoc 
b/doc/asciidoc/man1/xeno-config.adoc
index 5aba121..2844352 100644
--- a/doc/asciidoc/man1/xeno-config.adoc
+++ b/doc/asciidoc/man1/xeno-config.adoc
@@ -35,7 +35,7 @@ SYNOPSIS
 
 *xeno-config* *--version*
 
-*xeno-config* [*--cc*] [*--ccld*] [*--arch*] [*--prefix*] 
[*--posix|alchemy|rtdm|psos|vxworks|smokey*] [*--compat*] 
[*--auto-init*|*no-auto-init*] [*--cflags*] [*--kcflags*] [*--ldflags*] 
[*--library-dir*|*--libdir*|*--user-libdir*]
+*xeno-config* [*--cc*] [*--ccld*] [*--arch*] [*--prefix*] 
[*--posix|alchemy|rtdm|psos|vxworks|smokey*] [*--compat*] 
[*--auto-init*|*no-auto-init*] [*--cflags*] [*--ldflags*] 
[*--library-dir*|*--libdir*|*--user-libdir*]
 
 DESCRIPTION
 
@@ -107,12 +107,6 @@ with POSIX symbol wrapping.
 Output the C compiler command-line options (_CFLAGS_) which are required
 to compile applications based on the selected Xenomai API/skin.
 
-*--kcflags*::
-Output the C compiler command-line options (_CFLAGS_) which are
-required to compile a kernel driver based on the RTDM
-interface. *--rtdm* must appear on the command line before
-*--kcflags*.
-
 *--ldflags*::
 Output the C compiler command-line options (_LDFLAGS_) which are
 required to link applications based on the selected Xenomai API/skin.
diff --git a/scripts/xeno-config-cobalt.in b/scripts/xeno-config-cobalt.in
index 7b623db..d0da716 100644
--- a/scripts/xeno-config-cobalt.in
+++ b/scripts/xeno-config-cobalt.in
@@ -55,7 +55,6 @@ Options :
 --[skin=]posix|vxworks|psos|alchemy|rtdm|smokey|cobalt
 --auto-init|no-auto-init
 --cflags
---kcflags
 --ldflags
 --lib*-dir,--libdir,--user-libdir
 --core
@@ -109,7 +108,6 @@ fi
 
 do_ldflags=
 do_cflags=
-do_kcflags=
 
 while test $# -gt 0; do
 case "$1" in
@@ -164,9 +162,6 @@ while test $# -gt 0; do
--cflags)
do_cflags=y
;;
-   --kcflags)
-   do_kcflags=y
-   ;;
--ldflags)
do_ldflags=y
;;
@@ -215,22 +210,6 @@ if test x$do_cflags = xy; then
 echo $cflags
 fi
 
-if test x$do_kcflags = xy; then
-test -z "$skin_list" && skin_list=rtdm
-for skin in $skin_list; do
-   case "$skin" in
-   rtdm)
-   kcflags='-Iarch/$(SRCARCH)/xenomai/include -Iinclude/xenomai'
-   ;;
-   *)
-   echo "$skin is not a kernel API (maybe --cflags?)" 1>&2
-   exit 1
-   ;;
-   esac
-done
-echo $kcflags
-fi
-
 if test x$do_ldflags = xy; then
 if test -z "$skin_list"; then
echo "no API specified, missing --skin before --ldflags" 1>&2
diff --git a/scripts/xeno-config-mercury.in b/scripts/xeno-config-mercury.in
index 2145182..77cf89c 100644
--- a/scripts/xeno-config-mercury.in
+++ b/scripts/xeno-config-mercury.in
@@ -79,7 +79,6 @@ fi
 
 do_ldflags=
 do_cflags=
-do_kcflags=
 
 while test $# -gt 0; do
 case "$1" in
@@ -129,9 +128,6 @@ while test $# -gt 0; do
--cflags)
do_cflags=y
;;
-   --kcflags)
-   do_kcflags=y
-   ;;
--ldflags)
do_ldflags=y
;;
@@ -171,15 +167,6 @@ if test x$do_cflags = xy; then
 echo $cflags
 fi
 
-if test x$do_kcflags = xy; then
-for skin in $skin_list; do
-   if test \! "$skin" = rtdm; then
-   echo "$skin is not a kernel API (maybe --cflags?)" 1>&2
-   exit 1
-   fi
-done
-fi
-
 if test x$do_ldflags = xy; then
 test -z "$skin_list" && skin_list=posix
 ldflags=


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


[Xenomai-git] Philippe Gerum : cobalt/rtdm: drop useless doc details

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 3636ea08c9f15979a83fbe726d755b94b905dee7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3636ea08c9f15979a83fbe726d755b94b905dee7

Author: Philippe Gerum 
Date:   Fri Oct  2 17:50:21 2015 +0200

cobalt/rtdm: drop useless doc details

---

 kernel/cobalt/rtdm/drvlib.c |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index 81a59c1..0ea344d 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -201,8 +201,7 @@ void rtdm_task_set_priority(rtdm_task_t *task, int 
priority);
  * @brief Adjust real-time task period
  *
  * @param[in,out] task Task handle as returned by rtdm_task_init(), or
- * NULL for referring to the current RTDM task or Cobalt thread (see
- * note).
+ * NULL for referring to the current RTDM task or Cobalt thread.
  *
  * @param[in] start_date The initial (absolute) date of the first
  * release point, expressed in nanoseconds.  @a task will be delayed
@@ -214,11 +213,6 @@ void rtdm_task_set_priority(rtdm_task_t *task, int 
priority);
  * to disable cyclic mode for @a task.
  *
  * @coretags{task-unrestricted}
- *
- * @note Both RTDM tasks in kernel space and Cobalt threads in
- * user-space are based on Xenomai core threads, which implement this
- * service. For this reason, enabling periodic timing for a Cobalt
- * thread via the RTDM interface is possible.
  */
 int rtdm_task_set_period(rtdm_task_t *task, nanosecs_abs_t start_date,
 nanosecs_rel_t period);


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


[Xenomai-git] Philippe Gerum : copperplate: drop useless membars

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 37b043b12a50ef7980cd8a3afecd853fac8b4148
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=37b043b12a50ef7980cd8a3afecd853fac8b4148

Author: Philippe Gerum 
Date:   Mon Sep 21 15:59:27 2015 +0200

copperplate: drop useless membars

---

 lib/copperplate/threadobj.c |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index 2f25992..cc64caa 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -359,8 +359,6 @@ static inline int threadobj_unblocked_corespec(struct 
threadobj *current)
 
 int __threadobj_lock_sched(struct threadobj *current)
 {
-   smp_rmb();
-
if (current->schedlock_depth++ > 0)
return 0;
 
@@ -388,8 +386,6 @@ int __threadobj_unlock_sched(struct threadobj *current)
 * gracefully handle unbalanced calls here, and let them
 * decide of the outcome in case of error.
 */
-   smp_rmb();
-
if (current->schedlock_depth == 0)
return __bt(-EINVAL);
 
@@ -912,7 +908,7 @@ static void __threadobj_boost(void)
current->core.policy_unboosted = current->policy;
current->core.schedparam_unboosted = current->schedparam;
}
-   smp_mb();
+   barrier();
 
ret = pthread_setschedparam(current->ptid, SCHED_FIFO, ¶m);
if (ret) {
@@ -932,7 +928,6 @@ static void __threadobj_unboost(void)
return;
 
param.sched_priority = 
current->core.schedparam_unboosted.sched_priority;
-   smp_mb();
 
ret = pthread_setschedparam(current->ptid,
current->core.policy_unboosted, ¶m);


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


[Xenomai-git] Gilles Chanteperdrix : rtdm/devices: avoid incomplete device cleanup

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 96e85548a56c8c7fbd6d64c079701483a8e5da27
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=96e85548a56c8c7fbd6d64c079701483a8e5da27

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 01:41:26 2015 +0200

rtdm/devices: avoid incomplete device cleanup

when unregister_driver() is called from rtdm_dev_unregister(),
__rtdm_put_device() has already decreased the driver reference count, so
the result of atomic_dec_and_test() is always false and unregister_driver()
does not finish the cleanup. Fix this by moving the atomic_dec_and_test()
test to the only other call site of unregister_driver():
the rtdm_dev_regiter() error path.

---

 kernel/cobalt/rtdm/device.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 1c602c2..9af2221 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -303,6 +303,7 @@ static int register_driver(struct rtdm_driver *drv)
 
drv->named.major = MAJOR(rdev);
atomic_set(&drv->refcount, 1);
+
 done:
drv->nb_statechange.notifier_call = state_change_notifier;
drv->nb_statechange.priority = 0;
@@ -321,9 +322,6 @@ static void unregister_driver(struct rtdm_driver *drv)
 {
XENO_BUG_ON(COBALT, drv->profile_info.magic != RTDM_CLASS_MAGIC);
 
-   if (!atomic_dec_and_test(&drv->refcount))
-   return;
-
cobalt_remove_notifier_chain(&drv->nb_statechange);

if (drv->device_flags & RTDM_NAMED_DEVICE) {
@@ -452,7 +450,8 @@ fail:
if (kdev)
device_destroy(rtdm_class, rdev);
 
-   unregister_driver(drv);
+   if (atomic_dec_and_test(&drv->refcount))
+   unregister_driver(drv);
 
mutex_unlock(®ister_lock);
 


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c6eeea0d6be757f09e14671e515d62314ba2b39c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c6eeea0d6be757f09e14671e515d62314ba2b39c

Author: Philippe Gerum 
Date:   Tue Sep 15 11:23:39 2015 +0200

cobalt/x86: upgrade I-pipe support

---

 ...-x86-1.patch => ipipe-core-3.18.20-x86-2.patch} | 2320 +++-
 1 file changed, 292 insertions(+), 2028 deletions(-)

diff --git a/kernel/cobalt/arch/x86/patches/ipipe-core-3.18.12-x86-1.patch 
b/kernel/cobalt/arch/x86/patches/ipipe-core-3.18.20-x86-2.patch
similarity index 88%
rename from kernel/cobalt/arch/x86/patches/ipipe-core-3.18.12-x86-1.patch
rename to kernel/cobalt/arch/x86/patches/ipipe-core-3.18.20-x86-2.patch
index a309054..597cf51 100644
--- a/kernel/cobalt/arch/x86/patches/ipipe-core-3.18.12-x86-1.patch
+++ b/kernel/cobalt/arch/x86/patches/ipipe-core-3.18.20-x86-2.patch
@@ -1,5 +1,5 @@
 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index 3635fff..0f362ca 100644
+index c9148e2..8460d93 100644
 --- a/arch/x86/Kconfig
 +++ b/arch/x86/Kconfig
 @@ -9,6 +9,7 @@ config 64BIT
@@ -10,17 +10,18 @@ index 3635fff..0f362ca 100644
select CLKSRC_I8253
select HAVE_UID16
  
-@@ -21,6 +22,9 @@ config X86_64
+@@ -21,6 +22,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_MIGHT_HAVE_ACPI_PDC if ACPI
select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
select ARCH_HAS_FAST_MULTIPLIER
-@@ -115,7 +119,7 @@ config X86
+@@ -115,7 +120,7 @@ config X86
select GENERIC_TIME_VSYSCALL
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
@@ -29,7 +30,7 @@ index 3635fff..0f362ca 100644
select HAVE_IRQ_TIME_ACCOUNTING
select VIRT_TO_BUS
select MODULES_USE_ELF_REL if X86_32
-@@ -612,6 +616,7 @@ if HYPERVISOR_GUEST
+@@ -612,6 +617,7 @@ if HYPERVISOR_GUEST
  
  config PARAVIRT
bool "Enable paravirtualization code"
@@ -37,7 +38,7 @@ index 3635fff..0f362ca 100644
---help---
  This changes the kernel so it can modify itself when it is run
  under a hypervisor, potentially improving performance significantly
-@@ -854,6 +859,8 @@ config SCHED_MC
+@@ -854,6 +860,8 @@ config SCHED_MC
  
  source "kernel/Kconfig.preempt"
  
@@ -437,7 +438,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..c875c46
+index 000..7145c10
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,118 @@
@@ -467,7 +468,7 @@ index 000..c875c46
 +
 +#ifdef CONFIG_IPIPE
 +
-+#define IPIPE_CORE_RELEASE1
++#define IPIPE_CORE_RELEASE2
 +
 +struct ipipe_domain;
 +struct pt_regs;
@@ -762,7 +763,7 @@ index 000..d000d7e
 +#endif/* !__X86_IPIPE_64_H */
 diff --git a/arch/x86/include/asm/ipipe_base.h 
b/arch/x86/include/asm/ipipe_base.h
 new file mode 100644
-index 000..f940d4b
+index 000..a0a7391
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe_base.h
 @@ -0,0 +1,206 @@
@@ -849,7 +850,7 @@ index 000..f940d4b
 +#endif
 +}
 +
-+void __ipipe_halt_root(void);
++void __ipipe_halt_root(int use_mwait);
 +
 +void ipipe_hrtimer_interrupt(void);
 +
@@ -1002,7 +1003,7 @@ index 5702d7e..dd61aa6 100644
  
  #define FPU_IRQ 13
 diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
-index 0a8b519..0d052b7 100644
+index 0a8b519..c52d5e0 100644
 --- a/arch/x86/include/asm/irqflags.h
 +++ b/arch/x86/include/asm/irqflags.h
 @@ -4,6 +4,11 @@
@@ -1083,7 +1084,7 @@ index 0a8b519..0d052b7 100644
  {
 +#ifdef CONFIG_IPIPE
 +  barrier();
-+  __ipipe_halt_root();
++  __ipipe_halt_root(0);
 +#else
native_safe_halt();
 +#endif
@@ -1331,7 +1332,7 @@ index 4008734..33fc4b9 100644
  }
  
 diff --git a/arch/x86/include/asm/processor.h 
b/arch/x86/include/asm/processor.h
-index eb71ec7..2e63f86 100644
+index ddd8d13..d40d320 100644
 --- a/arch/x86/include/asm/processor.h
 +++ b/arch/x86/include/asm/processor.h
 @@ -478,6 +478,7 @@ struct thread_struct {
@@ -1343,7 +1344,7 @@ index eb71ec7..2e63f86 100644
  #ifdef CONFIG_X86_32
unsigned long   ip;
 diff --git a/arch/x86/include/asm/special_insns.h 
b/arch/x86/include/asm/special_insns.h
-index e820c08..a213f2b 100644
+index 6a4b00f..449a847 100644
 --- a/arch/x86/include/asm/special_insns.h
 +++ b/arch/x86/include/asm/special_insns.h
 @@ -4,6 +4,10 @@
@@ -2311,10 +2312,10 @@ index 9f6b934..ef8626a 100644
BLANK();
OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
 diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
-index cfa9b5b..ba1d33b 100644
+index 7bc49c3..5c01e59

[Xenomai-git] Gilles Chanteperdrix : smokey/posix-cond: add testcase for autoinit

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: a675f686d9a0b97a4cf397b11a6362787ee8a471
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a675f686d9a0b97a4cf397b11a6362787ee8a471

Author: Gilles Chanteperdrix 
Date:   Fri Oct  2 23:06:14 2015 +0200

smokey/posix-cond: add testcase for autoinit

---

 testsuite/smokey/posix-cond/posix-cond.c |   53 ++
 1 file changed, 53 insertions(+)

diff --git a/testsuite/smokey/posix-cond/posix-cond.c 
b/testsuite/smokey/posix-cond/posix-cond.c
index 5429d1f..6c9a458 100644
--- a/testsuite/smokey/posix-cond/posix-cond.c
+++ b/testsuite/smokey/posix-cond/posix-cond.c
@@ -204,6 +204,35 @@ static void *cond_signaler(void *cookie)
return NULL;
 }
 
+static void autoinit_simple_condwait(void)
+{
+   pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+   unsigned long long start;
+   pthread_mutex_t mutex;
+   struct cond_mutex cm = {
+   .mutex = &mutex,
+   .cond = &cond,
+   };
+   pthread_t cond_signaler_tid;
+
+   smokey_trace("%s", __func__);
+
+   check("mutex_init", mutex_init(&mutex, PTHREAD_MUTEX_DEFAULT, 0), 0);
+   check("mutex_lock", mutex_lock(&mutex), 0);
+   check("thread_spawn",
+ thread_spawn(&cond_signaler_tid, 2, cond_signaler, &cm), 0);
+   thread_msleep(11);
+
+   start = timer_get_tsc();
+   check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
+   check_sleep("cond_wait", start);
+   thread_msleep(10);
+   check("mutex_unlock", mutex_unlock(&mutex), 0);
+   check("thread_join", thread_join(cond_signaler_tid), 0);
+   check("mutex_destroy", mutex_destroy(&mutex), 0);
+   check("cond_destroy", cond_destroy(&cond), 0);
+}
+
 static void simple_condwait(void)
 {
unsigned long long start;
@@ -257,6 +286,28 @@ static void relative_condwait(void)
check("cond_destroy", cond_destroy(&cond), 0);
 }
 
+static void autoinit_absolute_condwait(void)
+{
+   pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+   unsigned long long start;
+   pthread_mutex_t mutex;
+
+   smokey_trace("%s", __func__);
+
+   check("mutex_init", mutex_init(&mutex, PTHREAD_MUTEX_DEFAULT, 0), 0);
+   check("mutex_lock", mutex_lock(&mutex), 0);
+
+   start = timer_get_tsc();
+   check("cond_wait",
+ cond_wait_until(&cond, &mutex, timer_read() + 10 * NS_PER_MS),
+ -ETIMEDOUT);
+   check_sleep("cond_wait", start);
+
+   check("mutex_unlock", mutex_unlock(&mutex), 0);
+   check("mutex_destroy", mutex_destroy(&mutex), 0);
+   check("cond_destroy", cond_destroy(&cond), 0);
+}
+
 static void absolute_condwait(void)
 {
unsigned long long start;
@@ -633,8 +684,10 @@ int run_posix_cond(struct smokey_test *t, int argc, char 
*const argv[])
sparam.sched_priority = 2;
pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
 
+   autoinit_simple_condwait();
simple_condwait();
relative_condwait();
+   autoinit_absolute_condwait();
absolute_condwait();
sig_norestart_condwait();
sig_restart_condwait();


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: sched-tp: don' t check for sequence with --vm

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4938afd7cc865fcead40cc55ca9ac671f326db85
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4938afd7cc865fcead40cc55ca9ac671f326db85

Author: Philippe Gerum 
Date:   Wed Aug 26 17:14:49 2015 +0200

testsuite/smokey: sched-tp: don't check for sequence with --vm

---

 testsuite/smokey/sched-tp/sched-tp.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/testsuite/smokey/sched-tp/sched-tp.c 
b/testsuite/smokey/sched-tp/sched-tp.c
index c15b0d9..8705eed 100644
--- a/testsuite/smokey/sched-tp/sched-tp.c
+++ b/testsuite/smokey/sched-tp/sched-tp.c
@@ -223,6 +223,9 @@ static int run_sched_tp(struct smokey_test *t, int argc, 
char *const argv[])
sem_destroy(&barrier);
free(p);
 
+   if (smokey_on_vm)
+   return 0;
+
if (overflow) {
smokey_warning("schedule overflowed");
return -EPROTO;


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


[Xenomai-git] Philippe Gerum : copperplate/registry: use default stack size for the fs thread

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 1b40e50049ff12b26f0e89614ae7b1586a58ec4b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1b40e50049ff12b26f0e89614ae7b1586a58ec4b

Author: Philippe Gerum 
Date:   Mon Aug 24 11:53:50 2015 +0200

copperplate/registry: use default stack size for the fs thread

---

 lib/copperplate/registry.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/copperplate/registry.c b/lib/copperplate/registry.c
index c379f15..52c0f64 100644
--- a/lib/copperplate/registry.c
+++ b/lib/copperplate/registry.c
@@ -780,7 +780,7 @@ int __registry_pkg_init(const char *arg0, char *mountpt, 
int flags)
 * smaller stack size for the fs thread than the default 8mb
 * set by the Glibc.
 */
-   pthread_attr_setstacksize(&thattr, PTHREAD_STACK_MIN * 4);
+   pthread_attr_setstacksize(&thattr, PTHREAD_STACK_DEFAULT);
pthread_attr_setscope(&thattr, PTHREAD_SCOPE_PROCESS);
p->arg0 = arg0;
p->mountpt = mountpt;


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


[Xenomai-git] Philippe Gerum : cobalt/init: delay memory locking after binding

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 48d54b272b0d8053200418659a6691d47c278265
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=48d54b272b0d8053200418659a6691d47c278265

Author: Philippe Gerum 
Date:   Sun Sep 13 15:46:17 2015 +0200

cobalt/init: delay memory locking after binding

Non-supervisor members of the allowed group (xenomai.allowed_group)
are given the IPC_LOCK capability by the Cobalt binding syscall. So
make sure the binding takes place before the process eventually
attempts to lock its virtual address space to RAM.

---

 lib/cobalt/init.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 074d563..acad534 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -93,9 +93,6 @@ static void low_init(void)
struct cobalt_featinfo *f;
int ret;
 
-   if (mlockall(MCL_CURRENT | MCL_FUTURE))
-   early_panic("mlockall: %s", strerror(errno));
-
old_sigill_handler = signal(SIGILL, sigill_handler);
if (old_sigill_handler == SIG_ERR)
early_panic("signal(SIGILL): %s", strerror(errno));
@@ -121,6 +118,9 @@ static void low_init(void)
early_panic("binding failed: %s", strerror(-ret));
}
 
+   if (mlockall(MCL_CURRENT | MCL_FUTURE))
+   early_panic("mlockall: %s", strerror(errno));
+
cobalt_check_features(f);
cobalt_init_umm(f->vdso_offset);
cobalt_init_current_keys();


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


[Xenomai-git] Philippe Gerum : drivers/can/raw: force all ioctl handling in secondary mode

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: f2f8376b082ac73ea96f126daa262b9bdeab9f2e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f2f8376b082ac73ea96f126daa262b9bdeab9f2e

Author: Philippe Gerum 
Date:   Wed Sep  9 09:27:10 2015 +0200

drivers/can/raw: force all ioctl handling in secondary mode

RTDM/ioctl is defined as a "probing" syscall by Xenomai 3, which means
that we don't want to provide a rt-specific handler for routing to
rtcan_raw_ioctl(), as some CAN drivers have to execute their ioctl
helpers from secondary mode exclusively (e.g. flexscan's set_mode).

All CAN ioctl helpers are deemed compatible with secondary mode
already, so we may safely route all requests to rtcan_raw_ioctl() from
this context.

---

 kernel/drivers/can/rtcan_flexcan.c |   15 ++-
 kernel/drivers/can/rtcan_raw.c |1 -
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/drivers/can/rtcan_flexcan.c 
b/kernel/drivers/can/rtcan_flexcan.c
index adfbef8..27c856d 100644
--- a/kernel/drivers/can/rtcan_flexcan.c
+++ b/kernel/drivers/can/rtcan_flexcan.c
@@ -836,6 +836,13 @@ static int flexcan_mode_stop(struct rtcan_device *dev, 
rtdm_lockctx_t *lock_ctx)
if (!CAN_STATE_OPERATING(state))
goto out;
 
+   /*
+* Drop the device lock early, we should not need it and we
+* may not hold it for calling the regular kernel
+* infrastructure.
+*/
+   rtdm_lock_put_irqrestore(&dev->device_lock, *lock_ctx);
+
flexcan_chip_stop(dev);
 
/* Wake up waiting senders */
@@ -845,6 +852,7 @@ static int flexcan_mode_stop(struct rtcan_device *dev, 
rtdm_lockctx_t *lock_ctx)
 
flexcan_clk_disable(priv);
 
+   rtdm_lock_get_irqsave(&dev->device_lock, *lock_ctx);
 out:
return 0;
 }
@@ -855,6 +863,8 @@ static int flexcan_mode_start(struct rtcan_device *dev,
struct flexcan_priv *priv = rtcan_priv(dev);
int err = 0;
 
+   rtdm_lock_put_irqrestore(&dev->device_lock, *lock_ctx);
+
switch (dev->state) {
 
case CAN_STATE_ACTIVE:
@@ -897,16 +907,19 @@ static int flexcan_mode_start(struct rtcan_device *dev,
case CAN_STATE_SLEEPING:
default:
/* Never reached, but we don't want nasty compiler warnings ... 
*/
+   err = 0;
break;
}
 
-   return 0;
+   goto out;
 
 out_irq_free:
rtdm_irq_free(&dev->irq_handle);
 out_clk_disable:
flexcan_clk_disable(priv);
 out:
+   rtdm_lock_get_irqsave(&dev->device_lock, *lock_ctx);
+
return err;
 }
 
diff --git a/kernel/drivers/can/rtcan_raw.c b/kernel/drivers/can/rtcan_raw.c
index 20e554c..9eb8531 100644
--- a/kernel/drivers/can/rtcan_raw.c
+++ b/kernel/drivers/can/rtcan_raw.c
@@ -978,7 +978,6 @@ static struct rtdm_driver rtcan_driver = {
.ops = {
.socket = rtcan_raw_socket,
.close  = rtcan_raw_close,
-   .ioctl_rt   = rtcan_raw_ioctl,
.ioctl_nrt  = rtcan_raw_ioctl,
.recvmsg_rt = rtcan_raw_recvmsg,
.sendmsg_rt = rtcan_raw_sendmsg,


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


[Xenomai-git] Philippe Gerum : lib/cobalt: wrap sched_getscheduler(2)

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 178eb4fc18c16d84b8ad46f4d0d0559eb2893888
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=178eb4fc18c16d84b8ad46f4d0d0559eb2893888

Author: Philippe Gerum 
Date:   Tue Sep 22 10:02:05 2015 +0200

lib/cobalt: wrap sched_getscheduler(2)

---

 include/cobalt/sched.h |5 +++
 lib/cobalt/cobalt.wrappers |1 +
 lib/cobalt/sched.c |   79 
 lib/cobalt/wrappers.c  |6 
 4 files changed, 91 insertions(+)

diff --git a/include/cobalt/sched.h b/include/cobalt/sched.h
index 12c33e6..7c5b26e 100644
--- a/include/cobalt/sched.h
+++ b/include/cobalt/sched.h
@@ -38,6 +38,8 @@ COBALT_DECL(int, sched_get_priority_max(int policy));
 COBALT_DECL(int, sched_setscheduler(pid_t pid, int policy,
const struct sched_param *param));
 
+COBALT_DECL(int, sched_getscheduler(pid_t pid));
+
 int sched_get_priority_min_ex(int policy);
 
 int sched_get_priority_max_ex(int policy);
@@ -45,6 +47,9 @@ int sched_get_priority_max_ex(int policy);
 int sched_setscheduler_ex(pid_t pid, int policy,
  const struct sched_param_ex *param_ex);
 
+int sched_getscheduler_ex(pid_t pid, int *policy_r,
+ struct sched_param_ex *param_ex);
+ 
 int sched_setconfig_np(int cpu, int policy,
   const union sched_config *config, size_t len);
 
diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers
index c8e24cb..9480f34 100644
--- a/lib/cobalt/cobalt.wrappers
+++ b/lib/cobalt/cobalt.wrappers
@@ -7,6 +7,7 @@
 --wrap sched_get_priority_min
 --wrap sched_get_priority_max
 --wrap sched_setscheduler
+--wrap sched_getscheduler
 --wrap pthread_kill
 --wrap pthread_join
 --wrap pthread_setname_np
diff --git a/lib/cobalt/sched.c b/lib/cobalt/sched.c
index d1abed8..7886a8e 100644
--- a/lib/cobalt/sched.c
+++ b/lib/cobalt/sched.c
@@ -329,6 +329,85 @@ int sched_setscheduler_ex(pid_t pid,
 }
 
 /**
+ * Get the scheduling policy of the specified process.
+ *
+ * This service retrieves the scheduling policy of the Xenomai process
+ * identified by @a pid.
+ *
+ * If @a pid does not identify an existing Xenomai thread/process, this
+ * service falls back to the regular sched_getscheduler() service.
+ *
+ * @param pid target process/thread;
+ *
+ * @return 0 on success;
+ * @return an error number if:
+ * - ESRCH, @a pid is not found;
+ * - EINVAL, @a pid is negative
+ * - EFAULT, @a param_ex is an invalid address;
+ *
+ * @see
+ * http://www.opengroup.org/onlinepubs/95399/functions/sched_getscheduler.html";>
+ * Specification.
+ */
+COBALT_IMPL(int, sched_getscheduler, (pid_t pid))
+{
+   struct sched_param_ex param_ex;
+   int ret, policy;
+
+   if (pid < 0) {
+   errno = EINVAL;
+   return -1;
+   }
+
+   ret = XENOMAI_SYSCALL3(sc_cobalt_sched_getscheduler_ex,
+  pid, &policy, ¶m_ex);
+   if (ret == -ESRCH)
+   return __STD(sched_getscheduler(pid));
+
+   if (ret) {
+   errno = -ret;
+   return -1;
+   }
+   
+   return policy;
+}
+
+/**
+ * Get extended scheduling policy of a process
+ *
+ * This service is an extended version of the sched_getscheduler()
+ * service, which supports Xenomai-specific and/or additional
+ * scheduling policies, not available with the host Linux environment.
+ * It retrieves the scheduling policy of the Xenomai process/thread
+ * identified by @a pid, and the associated scheduling parameters
+ * (e.g. the priority).
+ *
+ * @param pid queried process/thread. If zero, the current thread is
+ * assumed.
+ *
+ * @param policy_r a pointer to a variable receiving the current
+ * scheduling policy of @a pid.
+ *
+ * @param param_ex a pointer to a structure receiving the current
+ * scheduling parameters of @a pid.
+ *
+ * @return 0 on success;
+ * @return an error number if:
+ * - ESRCH, @a pid is not a Cobalt thread;
+ * - EINVAL, @a pid is negative or @a param_ex is NULL;
+ * - EFAULT, @a param_ex is an invalid address;
+ */
+int sched_getscheduler_ex(pid_t pid, int *policy_r,
+ struct sched_param_ex *param_ex)
+{
+   if (pid < 0 || param_ex == NULL)
+   return EINVAL;
+
+   return -XENOMAI_SYSCALL3(sc_cobalt_sched_getscheduler_ex,
+pid, policy_r, param_ex);
+}
+
+/**
  * Get extended maximum priority of the specified scheduling policy.
  *
  * This service returns the maximum priority of the scheduling policy
diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c
index e5c9d2f..09c74e5 100644
--- a/lib/cobalt/wrappers.c
+++ b/lib/cobalt/wrappers.c
@@ -84,6 +84,12 @@ int __real_sched_setscheduler(pid_t pid, int policy,
return sched_setscheduler(pid, policy, param);
 }
 
+__weak
+int __real_sched_getscheduler(pid_t pid)
+{
+   return sched_getscheduler(pid);
+}
+
 /* pthread */
 __weak
 int __rea

[Xenomai-git] Philippe Gerum : alchemy/task: fix RT_MUTEX_INFO documentation

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 55782a91d522c7ca47327bed4a505d48595ed423
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=55782a91d522c7ca47327bed4a505d48595ed423

Author: Philippe Gerum 
Date:   Mon Sep 14 14:13:33 2015 +0200

alchemy/task: fix RT_MUTEX_INFO documentation

---

 include/alchemy/mutex.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/alchemy/mutex.h b/include/alchemy/mutex.h
index 9cb0472..2c4212f 100644
--- a/include/alchemy/mutex.h
+++ b/include/alchemy/mutex.h
@@ -42,9 +42,9 @@ typedef struct RT_MUTEX RT_MUTEX;
  */
 struct RT_MUTEX_INFO {
/**
-* Current mutex owner, or null if unlocked. This information
-* is in essence transient, and may not be valid anymore once
-* used by the caller.
+* Current mutex owner, or NO_ALCHEMY_TASK if unlocked. This
+* information is in essence transient, and may not be valid
+* anymore once used by the caller.
 */
RT_TASK owner;
/**


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: cdd4d58892b456cf18a122329f21a5bd6d40c54e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cdd4d58892b456cf18a122329f21a5bd6d40c54e

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:27 2015 +0200

cobalt/arm: upgrade I-pipe support

---

 ...-arm-5.patch => ipipe-core-3.18.20-arm-6.patch} |  134 +---
 1 file changed, 86 insertions(+), 48 deletions(-)

diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
index 6bded0c..073b2a7 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
@@ -159,17 +159,18 @@ index 38c89ca..7c954bc 100644
  
  # Keep at91 dtb files sorted alphabetically for each SoC
 diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
-index 9596ed5..3e7a4a3 100644
+index 9596ed5..8957633e 100644
 --- a/arch/arm/boot/dts/imx6qdl.dtsi
 +++ b/arch/arm/boot/dts/imx6qdl.dtsi
-@@ -125,6 +125,12 @@
+@@ -125,6 +125,13 @@
clocks = <&clks IMX6QDL_CLK_TWD>;
};
  
 +  timer@00a00200 {
 +  compatible = "arm,cortex-a9-global-timer";
 +  reg = <0x00a00200 0x20>;
-+  clocks = <&clks 15>;
++  interrupts = <1 11 0xf01>;
++  clocks = <&clks IMX6QDL_CLK_TWD>;
 +  };
 +
L2: l2-cache@00a02000 {
@@ -690,10 +691,10 @@ index 000..19b50df
 +  power = <50>;
 +};
 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
-index 878c979..aae32e6 100644
+index 878c979..dc2450d 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
-@@ -72,6 +72,12 @@
+@@ -72,6 +72,13 @@
interrupts = ;
};
  
@@ -701,6 +702,7 @@ index 878c979..aae32e6 100644
 +  compatible = "arm,cortex-a9-global-timer";
 +  reg = <0x48240200 0x20>;
 +  clocks = <&mpu_periphclk>;
++  interrupts = ;
 +  };
 +
/*
@@ -1651,7 +1653,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..5c7e9bd
+index 000..76c7b6b
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,272 @@
@@ -1699,7 +1701,7 @@ index 000..5c7e9bd
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE5
++#define IPIPE_CORE_RELEASE6
 +
 +struct ipipe_domain;
 +
@@ -3717,6 +3719,19 @@ index 4176df7..8451be2 100644
  /*
   * These are the registers used in the syscall handler, and allow us to
   * have in theory up to 7 arguments to a function - r0 to r6.
+diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
+index cfb354f..d11d476 100644
+--- a/arch/arm/kernel/hibernate.c
 b/arch/arm/kernel/hibernate.c
+@@ -83,7 +83,7 @@ static void notrace arch_restore_image(void *unused)
+ {
+   struct pbe *pbe;
+ 
+-  cpu_switch_mm(idmap_pgd, &init_mm);
++  cpu_switch_mm(idmap_pgd, &init_mm, 1);
+   for (pbe = restore_pblist; pbe; pbe = pbe->next)
+   copy_page(pbe->orig_address, pbe->address);
+ 
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
 index 000..9577fbb
@@ -4285,10 +4300,10 @@ index 000..9577fbb
 +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..f0cfd86
+index 000..4a87f0c
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe_tsc.c
-@@ -0,0 +1,201 @@
+@@ -0,0 +1,203 @@
 +#include 
 +#include 
 +#include 
@@ -4456,6 +4471,8 @@ index 000..f0cfd86
 +  ipipe_tsc_update_timer.function = __ipipe_tsc_update_fn;
 +  mod_timer(&ipipe_tsc_update_timer,
 +  jiffies + ipipe_tsc_update_timer.data);
++
++  __ipipe_tracer_hrclock_initialized();
 +}
 +
 +void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
@@ -4969,7 +4986,7 @@ index bd19834..c49e067 100644
} while (thread_flags & _TIF_WORK_MASK);
return 0;
 diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
-index a8e32aa..bd81cc5 100644
+index a8e32aa..4939e05 100644
 --- a/arch/arm/kernel/smp.c
 +++ b/arch/arm/kernel/smp.c
 @@ -72,8 +72,24 @@ enum ipi_msg_type {
@@ -5016,18 +5033,16 @@ index a8e32aa..bd81cc5 100644
  
/*
 * All kernel threads share the same mm context; grab a
-@@ -514,6 +537,93 @@ void arch_irq_work_raise(void)
+@@ -514,6 +537,91 @@ void arch_irq_work_raise(void)
  #endif
  
  #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
 +
 +static inline void ipi

[Xenomai-git] Philippe Gerum : boilerplate/libc: add placeholder for pthread_setaffinity_np()

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 54161943141f38048a4fe741eeb6d62a533e8c1b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=54161943141f38048a4fe741eeb6d62a533e8c1b

Author: Philippe Gerum 
Date:   Mon Oct  5 15:18:45 2015 +0200

boilerplate/libc: add placeholder for pthread_setaffinity_np()

---

 configure.ac   |1 +
 include/boilerplate/libc.h |   10 ++
 2 files changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index b613515..8027b7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -509,6 +509,7 @@ AC_CHECK_FUNCS([pthread_mutexattr_setprotocol   \
pthread_condattr_setclock   \
pthread_spin_lock fork  \
pthread_attr_setaffinity_np \
+   pthread_setaffinity_np  \
pthread_getattr_np  \
pthread_atfork  \
pthread_setname_np  \
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index d65ce3f..f544ef4 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -118,6 +118,16 @@ int pthread_attr_setaffinity_np(pthread_attr_t *attr,
return 0;
return ENOSYS;
 }
+
+static inline
+int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
+  const cpu_set_t *cpuset)
+{
+   if (CPU_ISSET(0, cpuset) && CPU_COUNT(cpuset) == 1)
+   return 0;
+   return ENOSYS;
+}
+
 #endif /* !HAVE_PTHREAD_ATTR_SETAFFINITY_NP */
 
 #if !defined(HAVE_CLOCK_NANOSLEEP) && defined(CONFIG_XENO_MERCURY)


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


[Xenomai-git] Philippe Gerum : copperplate/threadobj: use default stack size for the agent thread

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4fc0d3e53e139a25d5f6f8b941262785a78e754b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4fc0d3e53e139a25d5f6f8b941262785a78e754b

Author: Philippe Gerum 
Date:   Mon Aug 24 11:53:50 2015 +0200

copperplate/threadobj: use default stack size for the agent thread

---

 lib/copperplate/threadobj.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index e5aefe9..c10e46a 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -202,7 +202,7 @@ static void start_agent(void)
cta.prologue = agent_prologue;
cta.run = agent_loop;
cta.arg = NULL;
-   cta.stacksize = PTHREAD_STACK_MIN * 4;
+   cta.stacksize = PTHREAD_STACK_DEFAULT;
cta.detachstate = PTHREAD_CREATE_DETACHED;
 
ret = copperplate_create_thread(&cta, &ptid);


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


[Xenomai-git] Gilles Chanteperdrix : rtnet: adapt to RTDM task management changes

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: bd971c3a9624987d76662b5c67a4ab10bdc51cd8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bd971c3a9624987d76662b5c67a4ab10bdc51cd8

Author: Gilles Chanteperdrix 
Date:   Thu Oct  1 02:10:29 2015 +0200

rtnet: adapt to RTDM task management changes

Replace rtcfg timer tasks with timers, polled in the rtcfg rx task.
Remove useless calls to rtdm_task_join_nrt.

---

 kernel/drivers/net/addons/proxy.c  |7 +-
 .../drivers/net/stack/include/rtcfg/rtcfg_event.h  |   12 ++-
 .../drivers/net/stack/include/rtcfg/rtcfg_frame.h  |6 +-
 .../drivers/net/stack/include/rtcfg/rtcfg_timer.h  |5 +-
 kernel/drivers/net/stack/include/rtmac/tdma/tdma.h |1 -
 .../drivers/net/stack/rtcfg/rtcfg_client_event.c   |   70 +++---
 kernel/drivers/net/stack/rtcfg/rtcfg_conn_event.c  |   14 +--
 kernel/drivers/net/stack/rtcfg/rtcfg_event.c   |   48 +-
 kernel/drivers/net/stack/rtcfg/rtcfg_frame.c   |   23 +++--
 kernel/drivers/net/stack/rtcfg/rtcfg_proc.c|2 +-
 kernel/drivers/net/stack/rtcfg/rtcfg_timer.c   |   96 
 kernel/drivers/net/stack/rtmac/nomac/nomac_proto.c |8 +-
 kernel/drivers/net/stack/rtmac/tdma/tdma_module.c  |4 +-
 kernel/drivers/net/stack/rtmac/tdma/tdma_worker.c  |2 +-
 kernel/drivers/net/stack/rtnet_rtpc.c  |   13 +--
 kernel/drivers/net/stack/stack_mgr.c   |6 +-
 16 files changed, 187 insertions(+), 130 deletions(-)

diff --git a/kernel/drivers/net/addons/proxy.c 
b/kernel/drivers/net/addons/proxy.c
index 9b459eb..4887f77 100644
--- a/kernel/drivers/net/addons/proxy.c
+++ b/kernel/drivers/net/addons/proxy.c
@@ -103,7 +103,10 @@ static void rtnetproxy_tx_loop(void *arg)
 struct rtnet_device *rtdev;
 struct rtskb *rtskb;
 
-while (rtdm_event_wait(&rtnetproxy_tx_event) == 0) {
+while (!rtdm_task_should_stop()) {
+   if (rtdm_event_wait(&rtnetproxy_tx_event) < 0)
+   break;
+
while ((rtskb = rtskb_dequeue(&tx_queue)) != NULL) {
rtdev = rtskb->rtdev;
rtdev_xmit_proxy(rtskb);
@@ -415,8 +418,8 @@ static void __exit rtnetproxy_cleanup_module(void)
 unregister_netdev(dev_rtnetproxy);
 free_netdev(dev_rtnetproxy);
 
+rtdm_task_destroy(&rtnetproxy_tx_task);
 rtdm_event_destroy(&rtnetproxy_tx_event);
-rtdm_task_join_nrt(&rtnetproxy_tx_task, 100);
 
 /* free the non-real-time signal */
 rtdm_nrtsig_destroy(&rtnetproxy_rx_signal);
diff --git a/kernel/drivers/net/stack/include/rtcfg/rtcfg_event.h 
b/kernel/drivers/net/stack/include/rtcfg/rtcfg_event.h
index 44c9bbb..a4b7955 100644
--- a/kernel/drivers/net/stack/include/rtcfg/rtcfg_event.h
+++ b/kernel/drivers/net/stack/include/rtcfg/rtcfg_event.h
@@ -34,9 +34,13 @@
 #include 
 
 
-#define FLAG_TIMER_STARTED  0x0001
-#define FLAG_TIMER_SHUTDOWN 0x0002
+#define FLAG_TIMER_STARTED  16
+#define FLAG_TIMER_SHUTDOWN 17
+#define FLAG_TIMER_PENDING  18
 
+#define _FLAG_TIMER_STARTED (1 << FLAG_TIMER_STARTED)
+#define _FLAG_TIMER_SHUTDOWN(1 << FLAG_TIMER_SHUTDOWN)
+#define _FLAG_TIMER_PENDING (1 << FLAG_TIMER_PENDING)
 
 typedef enum {
 RTCFG_MAIN_OFF,
@@ -63,8 +67,8 @@ struct rtcfg_device {
 rtdm_mutex_tdev_mutex;
 struct list_headevent_calls;
 rtdm_lock_t event_calls_lock;
-rtdm_task_t timer_task;
-unsigned intflags;
+rtdm_timer_ttimer;
+unsigned long   flags;
 unsigned intburstrate;
 #ifdef CONFIG_XENO_OPT_VFILE
 struct xnvfile_directoryproc_entry;
diff --git a/kernel/drivers/net/stack/include/rtcfg/rtcfg_frame.h 
b/kernel/drivers/net/stack/include/rtcfg/rtcfg_frame.h
index ac9f78b..2a6a415 100644
--- a/kernel/drivers/net/stack/include/rtcfg/rtcfg_frame.h
+++ b/kernel/drivers/net/stack/include/rtcfg/rtcfg_frame.h
@@ -51,9 +51,11 @@
 #define RTCFG_ADDRSIZE_IP   4
 #define RTCFG_MAX_ADDRSIZE  RTCFG_ADDRSIZE_IP
 
-#define RTCFG_FLAG_STAGE_2_DATA 1
-#define RTCFG_FLAG_READY2
+#define RTCFG_FLAG_STAGE_2_DATA 0
+#define RTCFG_FLAG_READY1
 
+#define _RTCFG_FLAG_STAGE_2_DATA (1 << RTCFG_FLAG_STAGE_2_DATA)
+#define _RTCFG_FLAG_READY(1 << RTCFG_FLAG_READY)
 
 struct rtcfg_frm_head {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
diff --git a/kernel/drivers/net/stack/include/rtcfg/rtcfg_timer.h 
b/kernel/drivers/net/stack/include/rtcfg/rtcfg_timer.h
index e9f6e27..2da6d50 100644
--- a/kernel/drivers/net/stack/include/rtcfg/rtcfg_timer.h
+++ b/kernel/drivers/net/stack/include/rtcfg/rtcfg_timer.h
@@ -25,7 +25,10 @@
 #ifndef __RTCFG_TIMER_H_
 #define __RTCFG_TIMER_H_
 
+void rtcfg_timer(rtdm_timer_t *t);
 
-void rtcfg_timer(void *arg);
+void rtcfg_timer_run(void);
+
+void rtcfg_thread_signal(void);
 
 #endif /* __RTCFG_TIMER_H_ */

[Xenomai-git] Gilles Chanteperdrix : cobalt/cond: fix autoinit

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: a792041f32220080ff19ceb47c97d5fb9155dad2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a792041f32220080ff19ceb47c97d5fb9155dad2

Author: Gilles Chanteperdrix 
Date:   Fri Oct  2 23:01:09 2015 +0200

cobalt/cond: fix autoinit

Drop comparison with PTHREAD_COND_INITIALIZER, as the structure
contains 4 bytes of padding for external alignment on ARM, which are
not initialized by PTHREAD_COND_INITIALIZER. The memcmp may fail whereas
the pthread_cond_t structure is correctly initialized.

---

 lib/cobalt/cond.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/lib/cobalt/cond.c b/lib/cobalt/cond.c
index 19ef372..7eeb9e6 100644
--- a/lib/cobalt/cond.c
+++ b/lib/cobalt/cond.c
@@ -194,11 +194,6 @@ static void __pthread_cond_cleanup(void *data)
 
 static int __attribute__((cold)) cobalt_cond_autoinit(pthread_cond_t *cond)
 {
-   static pthread_cond_t uninit_cond = PTHREAD_COND_INITIALIZER;
-
-   if (memcmp(cond, &uninit_cond, sizeof(*cond)))
-   return EINVAL;
-
return __COBALT(pthread_cond_init(cond, NULL));
 }
 


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


[Xenomai-git] Philippe Gerum : cobalt/autotune, utils/autotune: fix calibration

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c0609157bd7939ee830b479f3f3327d203368bbb
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c0609157bd7939ee830b479f3f3327d203368bbb

Author: Philippe Gerum 
Date:   Sat Sep  5 19:03:41 2015 +0200

cobalt/autotune, utils/autotune: fix calibration

Fix pondered mean and variance calculation. In addition, make the load
generator thread relax each 20 ms as expected to account for domain
migrations in the overhead.

Calibration scores are now filtered incrementally as follows:

1. top-half of the smallest pondered mean values
  2. top-half of the smallest standard deviation values
3. top-half of the minimum latencies
  4. smallest gravity value required

---

 kernel/drivers/autotune/autotune.c |  153 +++-
 utils/autotune/autotune.c  |2 +-
 2 files changed, 84 insertions(+), 71 deletions(-)

diff --git a/kernel/drivers/autotune/autotune.c 
b/kernel/drivers/autotune/autotune.c
index 6afec5c..a20ee38 100644
--- a/kernel/drivers/autotune/autotune.c
+++ b/kernel/drivers/autotune/autotune.c
@@ -25,21 +25,17 @@
 #include 
 #include 
 
-MODULE_DESCRIPTION("Xenomai/cobalt autotuner");
+MODULE_DESCRIPTION("Xenomai/cobalt core clock autotuner");
 MODULE_AUTHOR("Philippe Gerum ");
 MODULE_LICENSE("GPL");
 
 /* Auto-tuning services for the Cobalt core clock. */
 
 #define SAMPLING_TIME  5UL
-#define LOG_TIMESPAN   2U  /* ns */
-#define BUCKET_TIMESPAN500U/* ns */
-#define NR_BUCKETS (LOG_TIMESPAN / BUCKET_TIMESPAN)
 #define WARMUP_STEPS   3
-#define AUTOTUNE_STEPS  NR_BUCKETS
+#define AUTOTUNE_STEPS  40
 
 struct tuning_score {
-   int mean;
int pmean;
int stddev;
int minlat;
@@ -52,11 +48,12 @@ struct tuner_state {
xnticks_t step;
int min_lat;
int max_lat;
-   int pow_sum_avg;
-   int mean;
+   int prev_mean;
+   int prev_sqs;
+   int cur_sqs;
+   unsigned int sum;
unsigned int cur_samples;
unsigned int max_samples;
-   unsigned int log[NR_BUCKETS];
 };
 
 struct gravity_tuner {
@@ -121,7 +118,7 @@ static inline void done_sampling(struct gravity_tuner 
*tuner,
 static int add_sample(struct gravity_tuner *tuner, xnticks_t timestamp)
 {
struct tuner_state *state;
-   int b, n, delta;
+   int n, delta, cur_mean;
 
state = &tuner->state;
 
@@ -130,15 +127,26 @@ static int add_sample(struct gravity_tuner *tuner, 
xnticks_t timestamp)
state->min_lat = delta;
if (delta > state->max_lat)
state->max_lat = delta;
+   if (delta < 0)
+   delta = 0;
 
+   state->sum += delta;
state->ideal += state->step;
n = ++state->cur_samples;
 
-   b = (delta < 0 ? 0 : delta) / BUCKET_TIMESPAN;
-   state->log[b < NR_BUCKETS ? b : NR_BUCKETS - 1]++;
-   /* Build running mean and power sum average for stddev. */
-   state->mean += (delta - state->mean) / n;
-   state->pow_sum_avg += (delta * delta - state->pow_sum_avg) / n;
+   /*
+* Knuth citing Welford in TAOCP (Vol 2), single-pass
+* computation of variance using a recurrence relation.
+*/
+   if (n == 1)
+   state->prev_mean = delta;
+   else {
+   cur_mean = state->prev_mean + (delta - state->prev_mean) / n;
+state->cur_sqs = state->prev_sqs + (delta - state->prev_mean)
+   * (delta - cur_mean);
+state->prev_mean = cur_mean; 
+state->prev_sqs = state->cur_sqs;
+   }
 
if (n >= state->max_samples) {
done_sampling(tuner, 0);
@@ -415,17 +423,11 @@ struct uthread_gravity_tuner uthread_tuner = {
 static inline void build_score(struct gravity_tuner *tuner, int step)
 {
struct tuner_state *state = &tuner->state;
-   unsigned int sum, variance, n, b;
-
-   for (b = sum = n = 0; b < NR_BUCKETS; b++) {
-   sum += (b * BUCKET_TIMESPAN + BUCKET_TIMESPAN / 2) * 
state->log[b];
-   n += state->log[b];
-   }
+   unsigned int variance, n;
 
-   tuner->scores[step].mean = state->mean;
-   tuner->scores[step].pmean = sum / n;
-   variance = (state->pow_sum_avg * n - n *
-   state->mean * state->mean) / (n - 1);
+   n = state->cur_samples;
+   tuner->scores[step].pmean = state->sum / n;
+   variance = n > 1 ? state->cur_sqs / (n - 1) : 0;
tuner->scores[step].stddev = int_sqrt(variance);
tuner->scores[step].minlat = state->min_lat;
tuner->scores[step].gravity = tuner->get_gravity(tuner);
@@ -433,16 +435,12 @@ static inline void build_score(struct gravity_tuner 
*tuner, int step)
tuner->nscores++;
 }
 
-#if XENO_DEBUG(COBALT)
 #define progress(__tuner, __fmt, __args...)\
do {\
if (!(__tuner)->q

[Xenomai-git] Philippe Gerum : lib/cobalt: assorted documentation fixes

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b05639b62050e4b305d075bb7e0d546e63bf7a20
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b05639b62050e4b305d075bb7e0d546e63bf7a20

Author: Philippe Gerum 
Date:   Wed Sep 30 20:49:37 2015 +0200

lib/cobalt: assorted documentation fixes

---

 doc/asciidoc/MIGRATION.adoc  |  109 +
 doc/asciidoc/TROUBLESHOOTING.COBALT.adoc |   40 ---
 kernel/cobalt/rtdm/drvlib.c  |2 +-
 lib/cobalt/clock.c   |4 +-
 lib/cobalt/cond.c|   23 ++--
 lib/cobalt/init.c|   12 +-
 lib/cobalt/internal.c|6 +-
 lib/cobalt/mq.c  |   14 +--
 lib/cobalt/mutex.c   |   22 ++--
 lib/cobalt/sched.c   |   80 -
 lib/cobalt/semaphore.c   |   15 ++-
 lib/cobalt/sigshadow.c   |2 +-
 lib/cobalt/thread.c  |  192 +++---
 lib/cobalt/timer.c   |3 +-
 14 files changed, 227 insertions(+), 297 deletions(-)

diff --git a/doc/asciidoc/MIGRATION.adoc b/doc/asciidoc/MIGRATION.adoc
index 4cb8836..62aaae3 100644
--- a/doc/asciidoc/MIGRATION.adoc
+++ b/doc/asciidoc/MIGRATION.adoc
@@ -755,19 +755,17 @@ kernel requires kernel threads to exit at their earliest 
convenience
 upon notification, which therefore applies to RTDM tasks as well.
 **
 
-- +rtdm_task_set_period()+ does not suspend the target task until the
-first release point is reached. If a start date is specified, then
-+rtdm_task_wait_period()+ will apply the initial delay.
+- +rtdm_task_set_period()+ now accepts a start date for the periodic
+timeline. Zero can be passed to emulate the previous call form,
+setting the first release point when the first period after the
+current date elapses.
 
-.Rationale
-**
-A periodic RTDM task has to call +rtdm_task_wait_period()+ from within
-its work loop for sleeping until the next release point is
-reached. Since waiting for the initial and subsequent release points
-will most often happen at the same code location in the driver, the
-semantics of +rtdm_task_set_period()+ can be simplified so that only
-+rtdm_task_wait_period()+ may block the caller.
-**
+- +rtdm_task_wait_period()+ now copies back the count of overruns into
+a user-provided variable if -ETIMEDOUT is returned. NULL can be passed
+to emulate the previous call form, discarding this information.
+
+- Both +rtdm_task_set_period()+ and +rtdm_task_wait_period()+ may be
+  invoked over a Cobalt thread context.
 
 - RTDM_EXECUTE_ATOMICALLY() is deprecated and will be phased out in
   the next release. Drivers should prefer the newly introduced RTDM
@@ -1208,18 +1206,21 @@ kernel Cobalt environment.
 
 === Scheduling ===
 
+- Cobalt implements the following POSIX.1-2001 services not present in
+  Xenomai 2.x: +sched_setscheduler(2)+, +sched_getscheduler(2)+.
+
 - The +SCHED_FIFO+, +SCHED_RR+, +SCHED_SPORADIC+ and +SCHED_TP+
   classes now support up to 256 priority levels, instead of 99 as
-  previously with Xenomai 2.x. However, +sched_get_priority_max()+
+  previously with Xenomai 2.x. However, +sched_get_priority_max(2)+
   still returns 99. Only the Cobalt extended call forms
   (e.g. +pthread_attr_setschedparam_ex()+, +pthread_create_ex()+)
   recognize these additional levels.
 
-- +sched_get_priority_min_ex()+ and +sched_get_priority_max_ex()+
-  should be used for querying the static priority range of Cobalt
-  policies.
+- The new +sched_get_priority_min_ex()+ and
+  +sched_get_priority_max_ex()+ services should be used for querying
+  the static priority range of Cobalt policies.
 
-- `pthread_setschedparam()` may cause a secondary mode switch for the
+- `pthread_setschedparam(3)` may cause a secondary mode switch for the
   caller, but will not cause any mode switch for the target thread
   unlike with Xenomai 2.x.
 
@@ -1228,13 +1229,13 @@ kernel Cobalt environment.
   Xenomai scheduler in sync, with respect to thread priorities, since
   the former maintains a process-local priority cache for the threads
   it knows about. Therefore, an explicit call to the the regular
-  `pthread_setschedparam()` shall be issued upon each priority change
+  `pthread_setschedparam(3)` shall be issued upon each priority change
   Xenomai-wise, for maintaining consistency.
 
 [normal]
   In the Xenomai 2.x implementation, the thread being set a new
   priority would receive a SIGSHADOW signal, triggering a call to
-  `pthread_setschedparam()` immediately.
+  `pthread_setschedparam(3)` immediately.
 
 .Rationale
 **
@@ -1242,12 +1243,12 @@ The target Xenomai thread may hold 

[Xenomai-git] Philippe Gerum : drivers/can: merge assorted CAN fixes from 2.6.x

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 02bc0b1bc778e6262933ab8377298c3b6d7781ee
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=02bc0b1bc778e6262933ab8377298c3b6d7781ee

Author: Philippe Gerum 
Date:   Tue Sep  8 20:42:47 2015 +0200

drivers/can: merge assorted CAN fixes from 2.6.x

commit a7b94fc631816e64988f32247edc788e7c70efd1
Author: Matthew Lindner 
Date:   Mon Oct 20 17:24:45 2014 -0400

drivers/can: Properly initialize bittime

commit 7fcc04ce4bca162bc3367c4f04b8bd96edc02ca9
Author: Gilles Chanteperdrix 
Date:   Wed Jan 29 12:57:24 2014 +0100

drivers/flexcan: avoid unaligned access

commit 34c5ec7a704115cd84530ee36c540b981f1fef4e
Author: Henri Roosen 
Date:   Tue May 28 13:14:09 2013 +0200

Fix rtcan_flexcan for mx6 for OpenFirmware platforms

The default rx fifo global mask register, newly introduced in mx6q,
is 0x and the reset value in Message buffers(can be reused as the
memory of rx fifo filter table) is none zero, it will wrongly cause the
can to be unable to recevie packets due to filter.
We need to clear it to make sure to receive all packets.

Signed-off-by: Henri Roosen 
Acked-by: Wolfgang Grandegger 

commit e7fb1d155969a6cf3194e1a7b5257e5375b328f0
Author: Henri Roosen 
Date:   Tue May 28 13:14:09 2013 +0200

make rtcan_flexcan driver compatible with non OpenFirmware platforms

This also fixes the rx fifo global mask for mx6:

The default rx fifo global mask register, newly introduced in mx6q,
is 0x and the reset value in Message buffers(can be reused as the
memory of rx fifo filter table) is none zero, it will wrongly cause the
can to be unable to recevie packets due to filter.
We need to clear it to make sure to receive all packets.

Signed-off-by: Henri Roosen 
Acked-by: Wolfgang Grandegger 

---

 kernel/drivers/can/rtcan_flexcan.c |  141 +---
 kernel/drivers/can/rtcan_raw.c |   39 --
 kernel/drivers/can/rtcan_raw_dev.c |1 +
 3 files changed, 113 insertions(+), 68 deletions(-)

diff --git a/kernel/drivers/can/rtcan_flexcan.c 
b/kernel/drivers/can/rtcan_flexcan.c
index 1290118..adfbef8 100644
--- a/kernel/drivers/can/rtcan_flexcan.c
+++ b/kernel/drivers/can/rtcan_flexcan.c
@@ -30,9 +30,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -42,20 +44,15 @@
 #include "rtcan_raw.h"
 #include "rtcan_internal.h"
 
-/*
- * Due to a bug in most Flexcan cores, the bus error interrupt needs
- * to be enabled. Otherwise we don't get any bus warning or passive
- * interrupts. This is not necessay for the i.MX28, for example and
- * this modules parameter allows to overcome this limitation.
- */
-static int berr_int = 1;
-module_param(berr_int, int, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(berr_int,
-   "Bus error interrupt [1 (enabled)]. Can be disabled for i.MX28.");
-
 #define DEV_NAME   "rtcan%d"
 #define DRV_NAME   "flexcan"
 
+enum flexcan_ip_version {
+   FLEXCAN_VER_3_0_0,
+   FLEXCAN_VER_3_0_4,
+   FLEXCAN_VER_10_0_12,
+};
+
 /* 8 for RX fifo and 2 error handling */
 #define FLEXCAN_NAPI_WEIGHT(8 + 2)
 
@@ -160,6 +157,23 @@ MODULE_PARM_DESC(berr_int,
 
 #define FLEXCAN_MB_CODE_MASK   (0xf0ff)
 
+/*
+ * FLEXCAN hardware feature flags
+ *
+ * Below is some version info we got:
+ *SOC   Version   IP-Version  Glitch-  [TR]WRN_INT
+ *Filter?   connected?
+ *   MX25  FlexCAN2  03.00.00.00 no no
+ *   MX28  FlexCAN2  03.00.04.00yesyes
+ *   MX35  FlexCAN2  03.00.00.00 no no
+ *   MX53  FlexCAN2  03.00.00.00yes no
+ *   MX6s  FlexCAN3  10.00.12.00yesyes
+ *
+ * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected.
+ */
+#define FLEXCAN_HAS_V10_FEATURES   BIT(1) /* For core version >= 10 */
+#define FLEXCAN_HAS_BROKEN_ERR_STATE   BIT(2) /* [TR]WRN_INT not connected */
+
 /* Structure of the message buffer */
 struct flexcan_mb {
u32 can_ctrl;
@@ -182,10 +196,20 @@ struct flexcan_regs {
u32 imask1; /* 0x28 */
u32 iflag2; /* 0x2c */
u32 iflag1; /* 0x30 */
-   u32 _reserved2[19];
+   u32 crl2;   /* 0x34 */
+   u32 esr2;   /* 0x38 */
+   u32 _reserved2[2];
+   u32 crcr;   /* 0x44 */
+   u32 rxfgmask;   /* 0x48 */
+   u32 rxfir;  /* 0x4c */
+   u32 _reserved3[12];
struct flexcan_mb cantxfg[64];
 };
 
+struct flexcan_devtype_data {
+   u32 features;   /* hardware controller features */
+};
+
 struct flexcan_priv {
struct rtcan_device *dev;
 
@@ -194,10 +218,21 @@ struct flexcan_priv {
u32 reg_esr;
u32 reg_ctrl_default;
 
+   struct can_bittime bit_time;
+   const struct flexcan_devtype_data *devtype_data;
struct regulator *reg_xceiv

[Xenomai-git] Philippe Gerum : cobalt/kernel/posix: hide syscall handlers from the common namespace

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 7594a861e560581b444911790f65aff91f82b628
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7594a861e560581b444911790f65aff91f82b628

Author: Philippe Gerum 
Date:   Wed Sep 16 12:02:17 2015 +0200

cobalt/kernel/posix: hide syscall handlers from the common namespace

cobalt_* should be reserved for the Cobalt implementation. Use a
different prefix for Cobalt syscall handlers.

---

 kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h |   12 ++--
 kernel/cobalt/posix/syscall.c  |4 ++--
 kernel/cobalt/posix/syscall.h  |4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
index 58b7336..4fc1be8 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -42,7 +42,7 @@
 #error "__NR_COBALT_SYSCALLS > __COBALT_X32_BASE"
 #endif
 
-#define __syshand32x__(__name) ((cobalt_syshand)(cobalt32x_ ## __name))
+#define __syshand32x__(__name) ((cobalt_syshand)(CoBaLt32x_ ## __name))
 
 #define __COBALT_CALL32x_INITHAND(__handler)   \
[__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = 
__handler,
@@ -63,11 +63,11 @@
 
 /* x32 thunk implementation. */
 #define COBALT_SYSCALL32x(__name, __mode, __args)  \
-   long cobalt32x_ ## __name __args
+   long CoBaLt32x_ ## __name __args
 
 /* x32 thunk declaration. */
 #define COBALT_SYSCALL32x_DECL(__name, __args) \
-   long cobalt32x_ ## __name __args
+   long CoBaLt32x_ ## __name __args
 
 #else /* !CONFIG_X86_X32 */
 
@@ -110,7 +110,7 @@
 #error "__NR_COBALT_SYSCALLS > __COBALT_IA32_BASE"
 #endif
 
-#define __syshand32emu__(__name)   ((cobalt_syshand)(cobalt32emu_ ## 
__name))
+#define __syshand32emu__(__name)   ((cobalt_syshand)(CoBaLt32emu_ ## 
__name))
 
 #define __COBALT_CALL32emu_INITHAND(__handler) \
[__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = 
__handler,
@@ -128,11 +128,11 @@
 
 /* ia32 thunk implementation. */
 #define COBALT_SYSCALL32emu(__name, __mode, __args)\
-   long cobalt32emu_ ## __name __args
+   long CoBaLt32emu_ ## __name __args
 
 /* ia32 thunk declaration. */
 #define COBALT_SYSCALL32emu_DECL(__name, __args)   \
-   long cobalt32emu_ ## __name __args
+   long CoBaLt32emu_ ## __name __args
 
 #else /* !CONFIG_IA32_EMULATION */
 
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index a128dea..7f2e1c6 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -520,7 +520,7 @@ static COBALT_SYSCALL(corectl, probing,
return ret;
 }
 
-static int cobalt_ni(void)
+static int CoBaLt_ni(void)
 {
return -ENOSYS;
 }
@@ -585,7 +585,7 @@ static int cobalt_ni(void)
  *
  * --rpm
  */
-#define __syshand__(__name)((cobalt_syshand)(cobalt_ ## __name))
+#define __syshand__(__name)((cobalt_syshand)(CoBaLt_ ## __name))
 
 #define __COBALT_NI__syshand__(ni)
 
diff --git a/kernel/cobalt/posix/syscall.h b/kernel/cobalt/posix/syscall.h
index d2b4442..690cb22 100644
--- a/kernel/cobalt/posix/syscall.h
+++ b/kernel/cobalt/posix/syscall.h
@@ -22,11 +22,11 @@
 
 /* Regular (native) syscall handler implementation. */
 #define COBALT_SYSCALL(__name, __mode, __args) \
-   long cobalt_ ## __name __args
+   long CoBaLt_ ## __name __args
 
 /* Regular (native) syscall handler declaration. */
 #define COBALT_SYSCALL_DECL(__name, __args)\
-   long cobalt_ ## __name __args
+   long CoBaLt_ ## __name __args
 
 #include 
 


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


[Xenomai-git] Philippe Gerum : cobalt/arm: inline escalation of scheduling request

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 25a1d5c68caa76775a72f20d2557bd1453a2d2b0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=25a1d5c68caa76775a72f20d2557bd1453a2d2b0

Author: Philippe Gerum 
Date:   Sat Sep  5 19:00:05 2015 +0200

cobalt/arm: inline escalation of scheduling request

---

 kernel/cobalt/arch/arm/include/asm/xenomai/thread.h |   10 +-
 kernel/cobalt/arch/arm/thread.c |   10 --
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
index 11439a3..3e332b2 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
@@ -65,7 +65,15 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread 
*in);
 
 static inline void xnarch_enter_root(struct xnthread *root) { }
 
-int xnarch_escalate(void);
+static inline int xnarch_escalate(void)
+{
+   if (ipipe_root_p) {
+   ipipe_raise_irq(cobalt_pipeline.escalate_virq);
+   return 1;
+   }
+
+   return 0;
+}
 
 #if defined(CONFIG_XENO_ARCH_FPU) && defined(CONFIG_VFP)
 
diff --git a/kernel/cobalt/arch/arm/thread.c b/kernel/cobalt/arch/arm/thread.c
index 825926c..e13fb63 100644
--- a/kernel/cobalt/arch/arm/thread.c
+++ b/kernel/cobalt/arch/arm/thread.c
@@ -343,13 +343,3 @@ void xnarch_switch_to(struct xnthread *out, struct 
xnthread *in)
 
__asm_thread_switch(out_tcb->core.tip, in_tcb->core.tip);
 }
-
-int xnarch_escalate(void)
-{
-   if (ipipe_root_p) {
-   ipipe_raise_irq(cobalt_pipeline.escalate_virq);
-   return 1;
-   }
-
-   return 0;
-}


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


[Xenomai-git] Gilles Chanteperdrix : rtnet/stack_mgr: rework packet type locking

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 32f810a902502284e70e85c5b9ef4ab922a7d410
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=32f810a902502284e70e85c5b9ef4ab922a7d410

Author: Gilles Chanteperdrix 
Date:   Wed Sep 30 22:47:09 2015 +0200

rtnet/stack_mgr: rework packet type locking

Use module count to lock packet types rather than a reference count with
a loop blocking module unload.

---

 kernel/drivers/net/stack/include/stack_mgr.h |   14 +-
 kernel/drivers/net/stack/ipv4/arp.c  |6 +-
 kernel/drivers/net/stack/ipv4/ip_output.c|6 +-
 kernel/drivers/net/stack/packet/af_packet.c  |   10 --
 kernel/drivers/net/stack/rtcfg/rtcfg_frame.c |6 +-
 kernel/drivers/net/stack/rtmac/rtmac_proto.c |6 +-
 kernel/drivers/net/stack/stack_mgr.c |   19 ++-
 7 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/kernel/drivers/net/stack/include/stack_mgr.h 
b/kernel/drivers/net/stack/include/stack_mgr.h
index 871bbd4..4265252 100644
--- a/kernel/drivers/net/stack/include/stack_mgr.h
+++ b/kernel/drivers/net/stack/include/stack_mgr.h
@@ -51,21 +51,25 @@ struct rtpacket_type {
struct rtpacket_type *);
 bool(*trylock)(struct rtpacket_type *);
 void(*unlock)(struct rtpacket_type *);
+
+struct module  *owner;
 };
 
 
-int rtdev_add_pack(struct rtpacket_type *pt);
-int rtdev_remove_pack(struct rtpacket_type *pt);
+int __rtdev_add_pack(struct rtpacket_type *pt, struct module *module);
+#define rtdev_add_pack(pt) \
+__rtdev_add_pack(pt, THIS_MODULE)
+
+void rtdev_remove_pack(struct rtpacket_type *pt);
 
 static inline bool rtdev_lock_pack(struct rtpacket_type *pt)
 {
-++pt->refcount;
-return true;
+return try_module_get(pt->owner);
 }
 
 static inline void rtdev_unlock_pack(struct rtpacket_type *pt)
 {
---pt->refcount;
+module_put(pt->owner);
 }
 
 void rt_stack_connect(struct rtnet_device *rtdev, struct rtnet_mgr *mgr);
diff --git a/kernel/drivers/net/stack/ipv4/arp.c 
b/kernel/drivers/net/stack/ipv4/arp.c
index 98c010d..d6e074a 100644
--- a/kernel/drivers/net/stack/ipv4/arp.c
+++ b/kernel/drivers/net/stack/ipv4/arp.c
@@ -216,9 +216,5 @@ void __init rt_arp_init(void)
  */
 void rt_arp_release(void)
 {
-while (rtdev_remove_pack(&arp_packet_type) == -EAGAIN) {
-   printk("RTnet ARP: waiting for protocol unregistration\n");
-   set_current_state(TASK_UNINTERRUPTIBLE);
-   schedule_timeout(1*HZ); /* wait a second */
-}
+rtdev_remove_pack(&arp_packet_type);
 }
diff --git a/kernel/drivers/net/stack/ipv4/ip_output.c 
b/kernel/drivers/net/stack/ipv4/ip_output.c
index 89ca085..b498526 100644
--- a/kernel/drivers/net/stack/ipv4/ip_output.c
+++ b/kernel/drivers/net/stack/ipv4/ip_output.c
@@ -275,10 +275,6 @@ void __init rt_ip_init(void)
  */
 void rt_ip_release(void)
 {
-while (rtdev_remove_pack(&ip_packet_type) == -EAGAIN) {
-   printk("RTnet IP: waiting for protocol unregistration\n");
-   set_current_state(TASK_UNINTERRUPTIBLE);
-   schedule_timeout(1*HZ); /* wait a second */
-}
+rtdev_remove_pack(&ip_packet_type);
 rt_ip_fragment_cleanup();
 }
diff --git a/kernel/drivers/net/stack/packet/af_packet.c 
b/kernel/drivers/net/stack/packet/af_packet.c
index b4a18c2..faddd18 100644
--- a/kernel/drivers/net/stack/packet/af_packet.c
+++ b/kernel/drivers/net/stack/packet/af_packet.c
@@ -85,7 +85,7 @@ static bool rt_packet_trylock(struct rtpacket_type *pt)
 if (rtdm_fd_lock(fd) < 0)
return false;
 
-return rtdev_lock_pack(pt);
+return true;
 }
 
 static void rt_packet_unlock(struct rtpacket_type *pt)
@@ -93,7 +93,7 @@ static void rt_packet_unlock(struct rtpacket_type *pt)
 struct rtsocket *sock   = container_of(pt, struct rtsocket,
   prot.packet.packet_type);
 struct rtdm_fd *fd = rtdm_private_to_fd(sock);
-rtdev_unlock_pack(pt);
+
 rtdm_fd_unlock(fd);
 }
 
@@ -119,10 +119,8 @@ static int rt_packet_bind(struct rtsocket *sock, const 
struct sockaddr *addr,
 rtdm_lock_get_irqsave(&sock->param_lock, context);
 
 /* release existing binding */
-if ((pt->type != 0) && ((ret = rtdev_remove_pack(pt)) < 0)) {
-   rtdm_lock_put_irqrestore(&sock->param_lock, context);
-   return ret;
-}
+if (pt->type != 0)
+   rtdev_remove_pack(pt);
 
 pt->type = new_type;
 sock->prot.packet.ifindex = sll->sll_ifindex;
diff --git a/kernel/drivers/net/stack/rtcfg/rtcfg_frame.c 
b/kernel/drivers/net/stack/rtcfg/rtcfg_frame.c
index 7ca775d..4725a01 100644
--- a/kernel/drivers/net/stack/rtcfg/rtcfg_frame.c
+++ b/kernel/drivers/net/stack/rtcfg/rtcfg_frame.c
@@ -572,11 +572,7 @@ void rtcfg_cleanup_frames(void)
 struct rtskb *rtskb;
 
 
-while (rtdev_remove_pack(&rtcfg_packet_type) == -EAGAIN) {
-   RTCFG_DEBUG(3, "RTcfg: waiting for protocol unregistration\n");
-   set_curr

[Xenomai-git] Philippe Gerum : cobalt/arm: remove obsolete sysarch request numbers

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b48a245189a99687cb4b3351629e9973bc0020c7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b48a245189a99687cb4b3351629e9973bc0020c7

Author: Philippe Gerum 
Date:   Tue Aug 25 15:00:19 2015 +0200

cobalt/arm: remove obsolete sysarch request numbers

---

 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/syscall.h |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/syscall.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/syscall.h
index c4e3593..c079a35 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/syscall.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/syscall.h
@@ -25,10 +25,6 @@
 
 #define XENO_ARM_SYSCALL0x000F0042 /* carefully chosen... */
 
-#define XENOMAI_SYSARCH_ATOMIC_ADD_RETURN  0
-#define XENOMAI_SYSARCH_ATOMIC_SET_MASK1
-#define XENOMAI_SYSARCH_ATOMIC_CLEAR_MASK  2
-#define XENOMAI_SYSARCH_XCHG   3
-#define XENOMAI_SYSARCH_TSCINFO 4
+#define XENOMAI_SYSARCH_TSCINFO  4
 
 #endif /* !_COBALT_ARM_ASM_UAPI_SYSCALL_H */


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


[Xenomai-git] Philippe Gerum : drivers/can/raw: fix uninit flags in socket descriptor

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: bc3e48335b63ebd049c9edfe5ba759c99d746b03
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bc3e48335b63ebd049c9edfe5ba759c99d746b03

Author: Philippe Gerum 
Date:   Wed Sep  9 21:06:27 2015 +0200

drivers/can/raw: fix uninit flags in socket descriptor

---

 kernel/drivers/can/rtcan_socket.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/drivers/can/rtcan_socket.c 
b/kernel/drivers/can/rtcan_socket.c
index 3c73fba..edd4619 100644
--- a/kernel/drivers/can/rtcan_socket.c
+++ b/kernel/drivers/can/rtcan_socket.c
@@ -49,6 +49,7 @@ void rtcan_socket_init(struct rtdm_fd *fd)
 sock->flist = NULL;
 sock->err_mask = 0;
 sock->rx_buf_full = 0;
+sock->flags = 0;
 #ifdef CONFIG_XENO_DRIVERS_CAN_LOOPBACK
 sock->loopback = 1;
 #endif


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 83fed7b72313dda3b6b5fd5bb5175fa25a7f9ad3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=83fed7b72313dda3b6b5fd5bb5175fa25a7f9ad3

Author: Philippe Gerum 
Date:   Tue Sep 15 11:23:16 2015 +0200

cobalt/arm: upgrade I-pipe support

---

 ...-arm-4.patch => ipipe-core-3.18.20-arm-5.patch} | 2095 ++--
 1 file changed, 167 insertions(+), 1928 deletions(-)

diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.12-arm-4.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
similarity index 92%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.18.12-arm-4.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
index e6360b7..6bded0c 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.12-arm-4.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
@@ -1651,7 +1651,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..3c73753
+index 000..5c7e9bd
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,272 @@
@@ -1699,7 +1699,7 @@ index 000..3c73753
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE4
++#define IPIPE_CORE_RELEASE5
 +
 +struct ipipe_domain;
 +
@@ -3143,10 +3143,10 @@ index 705bb76..283d9da 100644
   */
  #if !defined(__KERNEL__)
 diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
-index 38ddd9f..ac4e2f8 100644
+index 2ecc7d1..5599d6e 100644
 --- a/arch/arm/kernel/Makefile
 +++ b/arch/arm/kernel/Makefile
-@@ -94,6 +94,8 @@ endif
+@@ -95,6 +95,8 @@ endif
  head-y:= head$(MMUEXT).o
  obj-$(CONFIG_DEBUG_LL)+= debug.o
  obj-$(CONFIG_EARLY_PRINTK)+= early_printk.o
@@ -3414,7 +3414,7 @@ index 2fd..a0cd9ce 100644
.if (. - \sym) & 3
.rept   4 - (. - \sym) & 3
 diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
-index 6bb09d4..91e4b89 100644
+index eb6f1927..7bef831 100644
 --- a/arch/arm/kernel/entry-common.S
 +++ b/arch/arm/kernel/entry-common.S
 @@ -2,6 +2,7 @@
@@ -3425,7 +3425,7 @@ index 6bb09d4..91e4b89 100644
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
-@@ -43,6 +44,42 @@ ret_fast_syscall:
+@@ -45,6 +46,42 @@ ret_fast_syscall:
ct_user_enter
  
restore_user_regs fast = 1, offset = S_OFF
@@ -3468,7 +3468,7 @@ index 6bb09d4..91e4b89 100644
   UNWIND(.fnend)
  
  /*
-@@ -72,12 +109,7 @@ ENTRY(ret_to_user_from_irq)
+@@ -74,12 +111,7 @@ ENTRY(ret_to_user_from_irq)
bne work_pending
  no_work_pending:
asm_trace_hardirqs_on
@@ -3482,7 +3482,7 @@ index 6bb09d4..91e4b89 100644
  ENDPROC(ret_to_user_from_irq)
  ENDPROC(ret_to_user)
  
-@@ -85,6 +117,7 @@ ENDPROC(ret_to_user)
+@@ -87,6 +119,7 @@ ENDPROC(ret_to_user)
   * This is how we return from a fork.
   */
  ENTRY(ret_from_fork)
@@ -3490,7 +3490,7 @@ index 6bb09d4..91e4b89 100644
bl  schedule_tail
cmp r5, #0
movne   r0, r4
-@@ -366,6 +399,16 @@ ENTRY(vector_swi)
+@@ -368,6 +401,16 @@ ENTRY(vector_swi)
str r0, [sp, #S_OLD_R0] @ Save OLD_R0
  #endif
zero_fp
@@ -3507,7 +3507,7 @@ index 6bb09d4..91e4b89 100644
alignment_trap r10, ip, __cr_alignment
enable_irq
ct_user_exit
-@@ -424,6 +467,57 @@ ENTRY(vector_swi)
+@@ -426,6 +469,57 @@ ENTRY(vector_swi)
  #endif
  
  local_restart:
@@ -3565,7 +3565,7 @@ index 6bb09d4..91e4b89 100644
ldr r10, [tsk, #TI_FLAGS]   @ check for syscall tracing
stmdb   sp!, {r4, r5}   @ push fifth and sixth args
  
-@@ -619,3 +713,28 @@ ENTRY(sys_oabi_call_table)
+@@ -621,3 +715,28 @@ ENTRY(sys_oabi_call_table)
  
  #endif
  
@@ -3719,10 +3719,10 @@ index 4176df7..8451be2 100644
   * have in theory up to 7 arguments to a function - r0 to r6.
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
-index 000..5187ab7
+index 000..9577fbb
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe.c
-@@ -0,0 +1,575 @@
+@@ -0,0 +1,560 @@
 +/* -*- linux-c -*-
 + * linux/arch/arm/kernel/ipipe.c
 + *
@@ -3959,21 +3959,6 @@ index 000..5187ab7
 +EXPORT_SYMBOL_GPL(smp_on_up);
 +#endif /* SMP_ON_UP */
 +
-+/*
-+ * ipipe_raise_irq() -- Push the interrupt at front of the pipeline
-+ * just like if it has been actually received from a hw source. Also
-+ * works for virtual interrupts.
-+ */
-+void ipipe_raise_irq(unsigned irq)
-+{
-+  unsigned long flags;
-+
-+  flags = hard_local_irq_save();
-+  __ipipe_dispatch_irq(irq, IPIPE_IRQF_NOACK);
-+  hard_local_irq_restore(flags);
-+}
-+EXPORT_SYMBOL_GPL(ipipe_raise_irq);
-+
 +int ipipe_get_sysinfo(struct ipipe_sysinfo *info)
 +

[Xenomai-git] Philippe Gerum : copperplate/internal: enforce default stack size as minimum

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 6f5374b92f742ac69fc7a1f2a79a498531368ad4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6f5374b92f742ac69fc7a1f2a79a498531368ad4

Author: Philippe Gerum 
Date:   Mon Aug 24 11:53:50 2015 +0200

copperplate/internal: enforce default stack size as minimum

Copperplate threads must be given at least PTHREAD_STACK_DEFAULT bytes
of stack.

---

 lib/copperplate/internal.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index d202a41..7f712de 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -53,8 +53,8 @@ int copperplate_create_thread(struct corethread_attributes 
*cta,
return __bt(ret);
 
stacksize = cta->stacksize;
-   if (stacksize < PTHREAD_STACK_MIN * 4)
-   stacksize = PTHREAD_STACK_MIN * 4;
+   if (stacksize < PTHREAD_STACK_DEFAULT)
+   stacksize = PTHREAD_STACK_DEFAULT;
 
pthread_attr_init_ex(&attr_ex);
pthread_attr_setinheritsched_ex(&attr_ex, PTHREAD_INHERIT_SCHED);
@@ -120,8 +120,8 @@ int copperplate_create_thread(struct corethread_attributes 
*cta,
return __bt(ret);
 
stacksize = cta->stacksize;
-   if (stacksize < PTHREAD_STACK_MIN * 4)
-   stacksize = PTHREAD_STACK_MIN * 4;
+   if (stacksize < PTHREAD_STACK_DEFAULT)
+   stacksize = PTHREAD_STACK_DEFAULT;
 
pthread_attr_init(&attr);
pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);


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


[Xenomai-git] Philippe Gerum : cobalt/powerpc: inline escalation of scheduling request

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 41a3391b6d9b106947fa48d1dd9fbc83f87a6899
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=41a3391b6d9b106947fa48d1dd9fbc83f87a6899

Author: Philippe Gerum 
Date:   Sat Sep  5 18:59:22 2015 +0200

cobalt/powerpc: inline escalation of scheduling request

---

 kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h |   12 ++--
 kernel/cobalt/arch/powerpc/thread.c |   10 --
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
index 8858bdd..8d6be84 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
@@ -81,9 +81,17 @@ xnarch_handle_fpu_fault(struct xnthread *from,
return 0;
 }
 
-void xnarch_switch_to(struct xnthread *out, struct xnthread *in);
+static inline int xnarch_escalate(void)
+{
+   if (ipipe_root_p) {
+   ipipe_raise_irq(cobalt_pipeline.escalate_virq);
+   return 1;
+   }
+
+   return 0;
+}
 
-int xnarch_escalate(void);
+void xnarch_switch_to(struct xnthread *out, struct xnthread *in);
 
 void xnarch_save_fpu(struct xnthread *thread);
 
diff --git a/kernel/cobalt/arch/powerpc/thread.c 
b/kernel/cobalt/arch/powerpc/thread.c
index c5b9a18..7f6ff87 100644
--- a/kernel/cobalt/arch/powerpc/thread.c
+++ b/kernel/cobalt/arch/powerpc/thread.c
@@ -193,13 +193,3 @@ void xnarch_leave_root(struct xnthread *root)
 }
 
 #endif /* CONFIG_XENO_ARCH_FPU */
-
-int xnarch_escalate(void)
-{
-   if (ipipe_root_p) {
-   ipipe_raise_irq(cobalt_pipeline.escalate_virq);
-   return 1;
-   }
-
-   return 0;
-}


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


[Xenomai-git] Philippe Gerum : posix/timer: fix init upon NULL sigevent

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: ae17d745e4a93e1e96d894a14ce294257201ed4e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ae17d745e4a93e1e96d894a14ce294257201ed4e

Author: Philippe Gerum 
Date:   Mon Sep  7 14:52:59 2015 +0200

posix/timer: fix init upon NULL sigevent

---

 kernel/cobalt/posix/timer.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index e5551b3..8c4d2da 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -67,8 +67,10 @@ timer_init(struct cobalt_timer *timer,
timer->clockid != CLOCK_REALTIME)
return ERR_PTR(-EINVAL);
 
-   if (evp == NULL || evp->sigev_notify == SIGEV_NONE)
-   return owner;   /* Assume SIGEV_THREAD_ID. */
+   if (evp == NULL || evp->sigev_notify == SIGEV_NONE) {
+   target = owner; /* Assume SIGEV_THREAD_ID. */
+   goto init;
+   }
 
if (evp->sigev_notify != SIGEV_THREAD_ID)
return ERR_PTR(-EINVAL);
@@ -80,7 +82,7 @@ timer_init(struct cobalt_timer *timer,
target = cobalt_thread_find_local(evp->sigev_notify_thread_id);
if (target == NULL)
return ERR_PTR(-EINVAL);
-
+init:
/*
 * All standard clocks are based on the core clock, and we
 * want to deliver a signal when a timer elapses.


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


[Xenomai-git] Philippe Gerum : cobalt/thread: assume current thread on xnthread_set_periodic(NULL)

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b209456e4c8e2f699a2f3e26aa30037dfccfd62c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b209456e4c8e2f699a2f3e26aa30037dfccfd62c

Author: Philippe Gerum 
Date:   Fri Sep 25 17:27:32 2015 +0200

cobalt/thread: assume current thread on xnthread_set_periodic(NULL)

---

 kernel/cobalt/thread.c |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 2d1f840..6a571af 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1230,7 +1230,8 @@ EXPORT_SYMBOL_GPL(xnthread_unblock);
  * xnthread_wait_period() will delay the thread until the next
  * periodic release point in the processor timeline is reached.
  *
- * @param thread The core thread to make periodic.
+ * @param thread The core thread to make periodic. If NULL, the
+ * current thread is assumed.
  *
  * @param idate The initial (absolute) date of the first release
  * point, expressed in nanoseconds. The affected thread will be
@@ -1260,6 +1261,9 @@ EXPORT_SYMBOL_GPL(xnthread_unblock);
  * returned if @a timeout_mode is not compatible with @a idate, such
  * as XN_RELATIVE with @a idate different from XN_INFINITE.
  *
+ * - -EPERM is returned if @a thread is NULL, but the caller is not a
+ * Xenomai thread.
+ *
  * @coretags{task-unrestricted}
  */
 int xnthread_set_periodic(struct xnthread *thread, xnticks_t idate,
@@ -1268,6 +1272,12 @@ int xnthread_set_periodic(struct xnthread *thread, 
xnticks_t idate,
int ret = 0;
spl_t s;
 
+   if (thread == NULL) {
+   thread = xnthread_current();
+   if (thread == NULL)
+   return -EPERM;
+   }
+   
xnlock_get_irqsave(&nklock, s);
 
if (period == XN_INFINITE) {


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


[Xenomai-git] Philippe Gerum : cobalt/x86: inline escalation of scheduling request

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 7fadcd23fba0e0d80a154c086127f19d5645fa91
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7fadcd23fba0e0d80a154c086127f19d5645fa91

Author: Philippe Gerum 
Date:   Sat Sep  5 19:01:05 2015 +0200

cobalt/x86: inline escalation of scheduling request

---

 kernel/cobalt/arch/x86/include/asm/xenomai/thread.h |   10 +-
 kernel/cobalt/arch/x86/thread.c |   10 --
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
index f58caf7..3862e33 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
@@ -76,6 +76,14 @@ void xnarch_switch_to(struct xnthread *out, struct xnthread 
*in);
 
 static inline void xnarch_enter_root(struct xnthread *root) { }
 
-int xnarch_escalate(void);
+static inline int xnarch_escalate(void)
+{
+   if (ipipe_root_p) {
+   ipipe_raise_irq(cobalt_pipeline.escalate_virq);
+   return 1;
+   }
+
+   return 0;
+}
 
 #endif /* !_COBALT_X86_ASM_THREAD_H */
diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index 0a057ee..8d2fc23 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -423,13 +423,3 @@ void xnarch_init_shadow_tcb(struct xnthread *thread)
/* XNFPU is set upon first FPU fault */
xnthread_clear_state(thread, XNFPU);
 }
-
-int xnarch_escalate(void)
-{
-   if (ipipe_root_p) {
-   ipipe_raise_irq(cobalt_pipeline.escalate_virq);
-   return 1;
-   }
-
-   return 0;
-}


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


[Xenomai-git] Philippe Gerum : boilerplate: define a reasonable default stack size

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: c212cc2f4cea63c8aaa8118a4dfb8681c11037a2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c212cc2f4cea63c8aaa8118a4dfb8681c11037a2

Author: Philippe Gerum 
Date:   Mon Aug 24 12:04:31 2015 +0200

boilerplate: define a reasonable default stack size

PTHREAD_STACK_MIN can be quite large (128k) on several architectures,
and small on others (16k). Instead of using a multiple of such value
which tends to be overkill in the former case, define
PTHREAD_STACK_DEFAULT = max(64k, PTHREAD_STACK_MIN) as the reasonable
default size.

NOTE: this is only a default value, applications needing a larger
stack size should override it into the thread attribute descriptor by
a call to pthread_attr_setstacksize().

---

 include/boilerplate/libc.h  |   12 
 lib/boilerplate/Makefile.am |2 +-
 lib/boilerplate/setup.c |2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 7dd305f..d65ce3f 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -18,6 +18,8 @@
 #ifndef _BOILERPLATE_LIBC_H
 #define _BOILERPLATE_LIBC_H
 
+#include 
+
 #ifdef __IN_XENO__
 /*
  * Quirks for dealing with outdated libc* issues.  This header will be
@@ -205,4 +207,14 @@ int pthread_setname_np(pthread_t thread, const char *name);
 #endif /* !HAVE_PTHREAD_SETNAME_NP */
 #endif /* __COBALT_WRAP__ || __IN_XENO__ */
 
+#ifndef PTHREAD_STACK_DEFAULT
+#define PTHREAD_STACK_DEFAULT  \
+   ({  \
+   int __ret = PTHREAD_STACK_MIN;  \
+   if (__ret < 65536)  \
+   __ret = 65536;  \
+   __ret;  \
+   })
+#endif /* !PTHREAD_STACK_DEFAULT */
+
 #endif /* _BOILERPLATE_LIBC_H */
diff --git a/lib/boilerplate/Makefile.am b/lib/boilerplate/Makefile.am
index 27b5dcb..4176c6d 100644
--- a/lib/boilerplate/Makefile.am
+++ b/lib/boilerplate/Makefile.am
@@ -48,7 +48,7 @@ config-dump.h: Makefile $(CONFIG_HEADER)
-e 's/^.*$$/\"&\",/' $(CONFIG_HEADER); echo '"---",'; \
sed -e '/#undef CONFIG_/!d' \
-e 's/.*\(CONFIG_[^ ]*\).*/\1/' \
-   -e 's/^.*$$/\"& is OFF\",/' $(CONFIG_HEADER) ) > $@
+   -e 's/^.*$$/\"& is OFF\",/' $(CONFIG_HEADER); echo '"---",' ) > $@
 
 libboilerplate_la_CPPFLAGS =   \
@XENO_USER_CFLAGS@  \
diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index 2ccb4f4..5273a5e 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -129,6 +129,8 @@ static inline void dump_configuration(void)
 
for (n = 0; config_strings[n]; n++)
puts(config_strings[n]);
+
+   printf("PTHREAD_STACK_DEFAULT=%d\n", PTHREAD_STACK_DEFAULT);
 }
 
 static int collect_cpu_affinity(const char *cpu_list)


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


[Xenomai-git] Philippe Gerum : testsuite/switchtest: use default stack size when applicable

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 56c405f4cac6f60a9f15b164d59394f642057480
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=56c405f4cac6f60a9f15b164d59394f642057480

Author: Philippe Gerum 
Date:   Mon Aug 24 11:57:17 2015 +0200

testsuite/switchtest: use default stack size when applicable

See f10d08fd92127.

---

 testsuite/switchtest/switchtest.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/testsuite/switchtest/switchtest.c 
b/testsuite/switchtest/switchtest.c
index cf33c70..a5898aa 100644
--- a/testsuite/switchtest/switchtest.c
+++ b/testsuite/switchtest/switchtest.c
@@ -1370,7 +1370,6 @@ int main(int argc, const char *argv[])
pthread_attr_setschedpolicy(&rt_attr, SCHED_FIFO);
sp.sched_priority = 1;
pthread_attr_setschedparam(&rt_attr, &sp);
-   pthread_attr_setstacksize(&rt_attr, PTHREAD_STACK_MIN);
 
if (quiet < 2)
printf("== Threads:");


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


[Xenomai-git] Philippe Gerum : testsuite/smokey: sched-quota: don' t check for accuracy with --vm

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b725f31644c8c9596fff6eb845f863c09b43a69f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b725f31644c8c9596fff6eb845f863c09b43a69f

Author: Philippe Gerum 
Date:   Wed Aug 26 17:14:16 2015 +0200

testsuite/smokey: sched-quota: don't check for accuracy with --vm

---

 testsuite/smokey/sched-quota/sched-quota.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/smokey/sched-quota/sched-quota.c 
b/testsuite/smokey/sched-quota/sched-quota.c
index 574f971..10ecfad 100644
--- a/testsuite/smokey/sched-quota/sched-quota.c
+++ b/testsuite/smokey/sched-quota/sched-quota.c
@@ -327,7 +327,7 @@ static int run_sched_quota(struct smokey_test *t, int argc, 
char *const argv[])
smokey_trace("%d thread%s: cap=%d%%, effective=%.1f%%",
 nrthreads, nrthreads > 1 ? "s": "", quota, effective);
 
-   if (fabs(effective - (double)quota) > 0.5) {
+   if (!smokey_on_vm && fabs(effective - (double)quota) > 0.5) {
smokey_warning("out of quota: %.1f%%",
   effective - (double)quota);
return -EPROTO;


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


[Xenomai-git] Philippe Gerum : boilerplate/debug: add __bterrno() helper for backtracing

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: cc9029a25411eca65c4a82db64f8bc9ea8a9e4c1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cc9029a25411eca65c4a82db64f8bc9ea8a9e4c1

Author: Philippe Gerum 
Date:   Fri Sep  4 11:53:56 2015 +0200

boilerplate/debug: add __bterrno() helper for backtracing

---

 include/boilerplate/debug.h |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/boilerplate/debug.h b/include/boilerplate/debug.h
index eae510c..f3eb687 100644
--- a/include/boilerplate/debug.h
+++ b/include/boilerplate/debug.h
@@ -82,6 +82,15 @@ void debug_init(void);
__ret;  \
})
 
+#define __bterrno(__exp)   \
+   ({  \
+   typeof(__exp) __ret = (__exp);  \
+   if (unlikely(__ret < 0))\
+   backtrace_log(-errno, __FUNCTION__, \
+ __FILE__, __LINE__);  \
+   __ret;  \
+   })
+
 #else /* !CONFIG_XENO_DEBUG */
 
 static inline int must_check(void)
@@ -94,6 +103,8 @@ struct backtrace_data {
 
 #define __bt(__exp)(__exp)
 
+#define __bterrno(__exp)   (__exp)
+
 #define backtrace_init_context(btd, name)  \
do { (void)(btd); (void)(name); } while (0)
 


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


[Xenomai-git] Philippe Gerum : cobalt/posix/process: emit notice on enabling group access

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: ba71e04c7d85564ec7e50239d194aa8cf0f568df
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ba71e04c7d85564ec7e50239d194aa8cf0f568df

Author: Philippe Gerum 
Date:   Sun Sep 13 15:41:02 2015 +0200

cobalt/posix/process: emit notice on enabling group access

---

 kernel/cobalt/posix/process.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 301df0b..e7f8a93 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -1488,6 +1488,9 @@ __init int cobalt_init(void)
ipipe_set_hooks(ipipe_root_domain, IPIPE_SYSCALL|IPIPE_KEVENT);
ipipe_set_hooks(&xnsched_realtime_domain, IPIPE_SYSCALL|IPIPE_TRAP);
 
+   if (gid_arg != -1)
+   printk(XENO_INFO "allowing access to group %d\n", gid_arg);
+
return 0;
 fail_siginit:
cobalt_unregister_personality(0);


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


[Xenomai-git] Philippe Gerum : demo/posix/can-rtt: sanitize

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 921558fc35ba9a213020aaa1b48195dd4f9ec782
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=921558fc35ba9a213020aaa1b48195dd4f9ec782

Author: Philippe Gerum 
Date:   Thu Sep 10 09:49:41 2015 +0200

demo/posix/can-rtt: sanitize

---

 demo/posix/can-rtt.c |   23 +++
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/demo/posix/can-rtt.c b/demo/posix/can-rtt.c
index 0a3dff8..36cdfbc 100644
--- a/demo/posix/can-rtt.c
+++ b/demo/posix/can-rtt.c
@@ -100,9 +100,7 @@ static void *transmitter(void *arg)
 frame.can_id = can_id;
 frame.can_dlc = sizeof(*rtt_time);
 
-#ifdef CONFIG_XENO_COBALT
 pthread_setname_np(pthread_self(), "rtcan_rtt_transmitter");
-#endif
 pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
 
 clock_gettime(CLOCK_MONOTONIC, &next_period);
@@ -147,9 +145,7 @@ static void *receiver(void *arg)
 struct rtt_stat rtt_stat = {0, 100LL, 
-100LL,
0, 0, 0};
 
-#ifdef CONFIG_XENO_COBALT
 pthread_setname_np(pthread_self(), "rtcan_rtt_receiver");
-#endif
 pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
 
 rtt_stat.counts_per_sec = 100 / cycle;
@@ -197,6 +193,8 @@ static void *receiver(void *arg)
 static void catch_signal(int sig)
 {
 mq_close(mq);
+close(rxsock);
+close(txsock);
 }
 
 
@@ -210,7 +208,7 @@ int main(int argc, char *argv[])
 struct rtt_stat rtt_stat;
 char mqname[32];
 char *txdev, *rxdev;
-struct ifreq ifr;
+struct can_ifreq ifr;
 int ret, opt;
 
 struct option long_options[] = {
@@ -394,23 +392,16 @@ int main(int argc, char *argv[])
 printf("shutting down\n");
 
 /* Important: First close the sockets! */
-while ((close(rxsock) < 0) && (errno == EAGAIN)) {
-   printf("RX socket busy - waiting...\n");
-   sleep(1);
-}
-while ((close(txsock) < 0) && (errno == EAGAIN)) {
-   printf("TX socket busy - waiting...\n");
-   sleep(1);
-}
-
+close(rxsock);
+close(txsock);
 pthread_join(txthread, NULL);
-pthread_kill(rxthread, SIGHUP);
+pthread_cancel(rxthread);
 pthread_join(rxthread, NULL);
 
 return 0;
 
  failure4:
-pthread_kill(rxthread, SIGHUP);
+pthread_cancel(rxthread);
 pthread_join(rxthread, NULL);
  failure3:
 mq_close(mq);


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


[Xenomai-git] Philippe Gerum : demo/posix: move can-rtt demo to the Cobalt-specific area

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 8ea8df3cd21dc22e6355b7085d6074c54fc66c76
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8ea8df3cd21dc22e6355b7085d6074c54fc66c76

Author: Philippe Gerum 
Date:   Mon Sep 14 10:13:35 2015 +0200

demo/posix: move can-rtt demo to the Cobalt-specific area

---

 demo/posix/Makefile.am|   21 +
 demo/posix/cobalt/Makefile.am |8 +++-
 demo/posix/{ => cobalt}/can-rtt.c |6 --
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/demo/posix/Makefile.am b/demo/posix/Makefile.am
index 613ebf6..aa0f7f7 100644
--- a/demo/posix/Makefile.am
+++ b/demo/posix/Makefile.am
@@ -1,25 +1,6 @@
-demodir = @XENO_DEMO_DIR@
-
-CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
 
 if XENO_COBALT
 SUBDIRS = cobalt
 endif
 
-demo_PROGRAMS = can-rtt
-
-cppflags = \
-   $(XENO_USER_CFLAGS) \
-   -I$(top_srcdir)/include
-
-ldflags = @XENO_AUTOINIT_LDFLAGS@ $(XENO_POSIX_WRAPPERS)
-
-ldadd =\
-   ../../lib/@XENO_CORE_LIB@   \
-@XENO_USER_LDADD@  \
-   -lpthread -lrt
-
-can_rtt_SOURCES = can-rtt.c
-can_rtt_CPPFLAGS = $(cppflags)
-can_rtt_LDFLAGS = $(ldflags)
-can_rtt_LDADD = $(ldadd)
+DIST_SUBDIRS = cobalt
diff --git a/demo/posix/cobalt/Makefile.am b/demo/posix/cobalt/Makefile.am
index 2eec916..cb854f3 100644
--- a/demo/posix/cobalt/Makefile.am
+++ b/demo/posix/cobalt/Makefile.am
@@ -9,7 +9,8 @@ demo_PROGRAMS = \
iddp-sendrecv   \
xddp-echo   \
xddp-label  \
-   xddp-stream
+   xddp-stream \
+   can_rtt
 
 cppflags = \
$(XENO_USER_CFLAGS) \
@@ -56,3 +57,8 @@ xddp_stream_SOURCES = xddp-stream.c
 xddp_stream_CPPFLAGS = $(cppflags)
 xddp_stream_LDFLAGS = $(ldflags)
 xddp_stream_LDADD = $(ldadd)
+
+can_rtt_SOURCES = can-rtt.c
+can_rtt_CPPFLAGS = $(cppflags)
+can_rtt_LDFLAGS = $(ldflags)
+can_rtt_LDADD = $(ldadd)
diff --git a/demo/posix/can-rtt.c b/demo/posix/cobalt/can-rtt.c
similarity index 99%
rename from demo/posix/can-rtt.c
rename to demo/posix/cobalt/can-rtt.c
index 36cdfbc..61cad05 100644
--- a/demo/posix/can-rtt.c
+++ b/demo/posix/cobalt/can-rtt.c
@@ -48,13 +48,7 @@
 #include 
 #include 
 #include 
-
-#ifdef CONFIG_XENO_COBALT
 #include 
-#else
-#include 
-#include 
-#endif
 #include 
 
 #define NSEC_PER_SEC 10


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


[Xenomai-git] Philippe Gerum : lib/smokey: add --vm switch

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: b4fffa079d7ee02d751f0f82701ceccd4be1a126
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b4fffa079d7ee02d751f0f82701ceccd4be1a126

Author: Philippe Gerum 
Date:   Wed Aug 26 17:08:58 2015 +0200

lib/smokey: add --vm switch

This switch gives a hint about smokey currently running in a virtual
environment. smokey_on_vm can be checked by test code to figure out
whether this might have an impact on their results (such as being
affected by a significant slowdown).

---

 include/smokey/smokey.h |2 ++
 lib/smokey/init.c   |   20 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/smokey/smokey.h b/include/smokey/smokey.h
index 7dcc06b..b48d796 100644
--- a/include/smokey/smokey.h
+++ b/include/smokey/smokey.h
@@ -166,4 +166,6 @@ extern int smokey_keep_going;
 
 extern int smokey_verbose_mode;
 
+extern int smokey_on_vm;
+
 #endif /* _XENOMAI_SMOKEY_SMOKEY_H */
diff --git a/lib/smokey/init.c b/lib/smokey/init.c
index 2c16cde..e98f9a0 100644
--- a/lib/smokey/init.c
+++ b/lib/smokey/init.c
@@ -188,6 +188,12 @@
  *   non-zero value, which should be interpreted by all parties as the
  *   desired verbosity level (defaults to 1).
  *
+ * - --vm gives a hint to the test code, about running in a virtual
+ * environment, such as KVM. When passed, the boolean @a smokey_on_vm
+ * is set. Each test may act upon this setting, such as skipping
+ * time-dependent checks that may fail due to any slowdown induced by
+ * the virtualization.
+ *
  * @par Writing a test driver based on the Smokey API
  *
  * A test driver provides the main() entry point, which should iterate
@@ -250,14 +256,16 @@ DEFINE_PRIVATE_LIST(smokey_test_list);
 
 int smokey_keep_going;
 
+int smokey_verbose_mode = 1;
+
+int smokey_on_vm = 0;
+
 static DEFINE_PRIVATE_LIST(register_list);
 
 static int test_count;
 
 static int do_list;
 
-int smokey_verbose_mode = 1;
-
 static const struct option smokey_options[] = {
{
 #define keep_going_opt 0
@@ -277,6 +285,12 @@ static const struct option smokey_options[] = {
.val = 1,
},
{
+#define vm_opt 3
+   .name = "vm",
+   .flag = &smokey_on_vm,
+   .val = 1,
+   },
+   {
/* sentinel */
}
 };
@@ -286,6 +300,7 @@ static void smokey_help(void)
 fprintf(stderr, "--keep-going  don't stop upon test 
error\n");
fprintf(stderr, "--list list all tests\n");
fprintf(stderr, "--run[=]]  run [portion of] the 
test list\n");
+   fprintf(stderr, "--vm   hint about running in a 
virtual environment\n");
 }
 
 static inline void pick_test_range(int start, int end)
@@ -431,6 +446,7 @@ static int smokey_parse_option(int optnum, const char 
*optarg)
 
switch (optnum) {
case keep_going_opt:
+   case vm_opt:
break;
case run_opt:
if (pvlist_empty(®ister_list)) {


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


[Xenomai-git] Philippe Gerum : drivers/can/raw: use safer way of detecting xmit abort

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 4fe9e77d5499bcf940fa78d603ac8a16c448b31f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4fe9e77d5499bcf940fa78d603ac8a16c448b31f

Author: Philippe Gerum 
Date:   Wed Sep  9 16:17:15 2015 +0200

drivers/can/raw: use safer way of detecting xmit abort

---

 kernel/drivers/can/rtcan_internal.h |5 -
 kernel/drivers/can/rtcan_raw.c  |   10 +-
 kernel/drivers/can/rtcan_socket.c   |3 +--
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/kernel/drivers/can/rtcan_internal.h 
b/kernel/drivers/can/rtcan_internal.h
index b731e71..b290005 100644
--- a/kernel/drivers/can/rtcan_internal.h
+++ b/kernel/drivers/can/rtcan_internal.h
@@ -29,11 +29,6 @@
 #include 
 #include 
 
-#ifndef LIST_POISON1
-/* 2.4 - 2.6 compatibility stuff */
-#define LIST_POISON1  ((void *) 0x0)
-#endif
-
 #ifdef CONFIG_XENO_DRIVERS_CAN_DEBUG
 #define RTCAN_ASSERT(expr, func) \
 if (!(expr)) { \
diff --git a/kernel/drivers/can/rtcan_raw.c b/kernel/drivers/can/rtcan_raw.c
index 9eb8531..2047529 100644
--- a/kernel/drivers/can/rtcan_raw.c
+++ b/kernel/drivers/can/rtcan_raw.c
@@ -888,9 +888,9 @@ ssize_t rtcan_raw_sendmsg(struct rtdm_fd *fd,
 
 tx_wait.rt_task = rtdm_task_current();
 
-/* If socket was not closed recently, register the task at the
- * socket's TX wait queue and decrement the TX semaphore. This must be
- * atomic. Finally, the task must be deregistered again (also atomic). */
+/* Register the task at the socket's TX wait queue and decrement
+ * the TX semaphore. This must be atomic. Finally, the task must
+ * be deregistered again (also atomic). */
 cobalt_atomic_enter(s);
 
 list_add(&tx_wait.tx_wait_list, &sock->tx_wait_head);
@@ -900,9 +900,9 @@ ssize_t rtcan_raw_sendmsg(struct rtdm_fd *fd,
 
 /* Only dequeue task again if socket isn't being closed i.e. if
  * this task was not unblocked within the close() function. */
-if (likely(tx_wait.tx_wait_list.next != LIST_POISON1))
+if (likely(!list_empty(&tx_wait.tx_wait_list)))
/* Dequeue this task from the TX wait queue */
-   list_del(&tx_wait.tx_wait_list);
+   list_del_init(&tx_wait.tx_wait_list);
 else
/* The socket was closed. */
ret = -EBADF;
diff --git a/kernel/drivers/can/rtcan_socket.c 
b/kernel/drivers/can/rtcan_socket.c
index 6e6e79e..3c73fba 100644
--- a/kernel/drivers/can/rtcan_socket.c
+++ b/kernel/drivers/can/rtcan_socket.c
@@ -71,7 +71,6 @@ void rtcan_socket_cleanup(struct rtdm_fd *fd)
 rtdm_lockctx_t lock_ctx;
 int tx_list_empty;
 
-
 /* Wake up sleeping senders. This is re-entrant-safe. */
 do {
cobalt_atomic_enter(lock_ctx);
@@ -86,7 +85,7 @@ void rtcan_socket_cleanup(struct rtdm_fd *fd)
struct tx_wait_queue, tx_wait_list);
 
/* Remove it from list */
-   list_del(&tx_waiting->tx_wait_list);
+   list_del_init(&tx_waiting->tx_wait_list);
 
/* Wake task up (atomic section is left implicitly) */
rtdm_task_unblock(tx_waiting->rt_task);


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


[Xenomai-git] Philippe Gerum : drivers/can, utils/can: introduce can_ifreq

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 5460e09d0f990799fb2eed67fbb00358860ebcab
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5460e09d0f990799fb2eed67fbb00358860ebcab

Author: Philippe Gerum 
Date:   Sat Aug 29 12:10:30 2015 +0200

drivers/can, utils/can: introduce can_ifreq

Doing piggyback on struct ifreq for passing arguments to CAN-specific
control requests is unsafe since nothing relates sizeof(ifr.ifr_ifru)
to the largest data field we need. Besides, this is prone to type
aliasing issues when mapping the CAN members over the union space
using casts, which the compiler may complain about loudly.

Introduce struct can_ifreq, defining all the data fields currently
supported by CAN raw ioctl requests. The driver still accepts struct
ifreq from existing applications though, but it is recommended to
switch to can_ifreq at the first opportunity.

---

 include/rtdm/uapi/can.h|   66 ++--
 kernel/drivers/can/rtcan_raw_dev.c |  120 
 utils/can/rtcanconfig.c|   34 --
 utils/can/rtcanrecv.c  |2 +-
 utils/can/rtcansend.c  |2 +-
 5 files changed, 112 insertions(+), 112 deletions(-)

diff --git a/include/rtdm/uapi/can.h b/include/rtdm/uapi/can.h
index 2700694..a33003f 100644
--- a/include/rtdm/uapi/can.h
+++ b/include/rtdm/uapi/can.h
@@ -324,6 +324,26 @@ typedef struct can_frame {
uint8_t data[8] __attribute__ ((aligned(8)));
 } can_frame_t;
 
+/**
+ * CAN interface request descriptor
+ *
+ * Parameter block for submitting CAN control requests.
+ */
+struct can_ifreq {
+   union {
+   charifrn_name[IFNAMSIZ];
+   } ifr_ifrn;
+   
+   union {
+   struct can_bittime bittime;
+   can_baudrate_t baudrate;
+   can_ctrlmode_t ctrlmode;
+   can_mode_t mode;
+   can_state_t state;
+   int ifru_ivalue;
+   } ifr_ifru;
+};
+
 /*!
  * @anchor RTCAN_TIMESTAMPS   @name Timestamp switches
  * Arguments to pass to @ref RTCAN_RTIOC_TAKE_TIMESTAMP
@@ -445,16 +465,22 @@ typedef struct can_frame {
 /*!
  * @anchor CANIOCTLs @name IOCTLs
  * CAN device IOCTLs
+ *
+ * @deprecated Passing struct ifreq as a request descriptor
+ * for CAN IOCTLs is still accepted for backward compatibility,
+ * however it is recommended to switch to struct can_ifreq at
+ * the first opportunity.
+ *
  * @{ */
 
 /**
  * Get CAN interface index by name
  *
  * @param [in,out] arg Pointer to interface request structure buffer
- * (struct ifreq from linux/if.h). If
- * ifr_name holds a valid CAN interface name
- * ifr_ifindex will be filled with the
- * corresponding interface index.
+ * (struct can_ifreq). If
+ * ifr_name holds a valid CAN interface
+ * name ifr_ifindex will be filled with
+ * the corresponding interface index.
  *
  * @return 0 on success, otherwise:
  * - -EFAULT: It was not possible to access user space memory area at the
@@ -475,7 +501,7 @@ typedef struct can_frame {
  * @ref SIOCSCANCUSTOMBITTIME to set custom bit-timing.
  *
  * @param [in] arg Pointer to interface request structure buffer
- * (struct ifreq from linux/if.h).
+ * (struct can_ifreq).
  * ifr_name must hold a valid CAN interface name,
  * ifr_ifru must be filled with an instance of
  * @ref can_baudrate_t.
@@ -493,13 +519,13 @@ typedef struct can_frame {
  * @note Setting the baud rate is a configuration task. It should
  * be done deliberately or otherwise CAN messages will likely be lost.
  */
-#define SIOCSCANBAUDRATE   _IOW(RTIOC_TYPE_CAN, 0x01, struct ifreq)
+#define SIOCSCANBAUDRATE   _IOW(RTIOC_TYPE_CAN, 0x01, struct can_ifreq)
 
 /**
  * Get baud rate
  *
  * @param [in,out] arg Pointer to interface request structure buffer
- *(struct ifreq from linux/if.h).
+ *(struct can_ifreq).
  *ifr_name must hold a valid CAN interface name,
  *ifr_ifru will be filled with an instance of
  *@ref can_baudrate_t.
@@ -512,7 +538,7 @@ typedef struct can_frame {
  *
  * @coretags{task-unrestricted}
  */
-#define SIOCGCANBAUDRATE   _IOWR(RTIOC_TYPE_CAN, 0x02, struct ifreq)
+#define SIOCGCANBAUDRATE   _IOWR(RTIOC_TYPE_CAN, 0x02, struct can_ifreq)
 
 /**
  * Set custom bit time parameter
@@ -521,7 +547,7 @@ typedef struct can_frame {
  * struct can_bittime).
  *
  * @param [in] arg Pointer to interface request structure buffer
- * (struct ifreq from linux/if.h).
+ * (struct can_ifreq).
  * ifr_name must hold a valid CAN interface name,
  * ifr_ifru must be filled with an instance of
  * struct can_bittime.
@@ -5

[Xenomai-git] Philippe Gerum : lib/analogy: add explicit dependency on libm

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 1f62275ca7cd784a8163b89b086a2799c3ef31e2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1f62275ca7cd784a8163b89b086a2799c3ef31e2

Author: Philippe Gerum 
Date:   Fri Aug 28 14:37:46 2015 +0200

lib/analogy: add explicit dependency on libm

---

 lib/analogy/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am
index 21b8fb4..e53d8a1 100644
--- a/lib/analogy/Makefile.am
+++ b/lib/analogy/Makefile.am
@@ -1,6 +1,6 @@
 lib_LTLIBRARIES = libanalogy.la
 
-libanalogy_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 1:0:0
+libanalogy_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 1:0:0 -lm
 
 libanalogy_la_SOURCES =\
async.c \


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


[Xenomai-git] Philippe Gerum : utils/autotune: force affinity to the same CPU for all threads

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: e142e0716f530691ff6eb2ad776868174af82de1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e142e0716f530691ff6eb2ad776868174af82de1

Author: Philippe Gerum 
Date:   Tue Aug 25 18:46:27 2015 +0200

utils/autotune: force affinity to the same CPU for all threads

To get consistent results, we want both the load generator and the
sampler to run on the same CPU. Force the scheduling affinity to
CPU#0.

---

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

diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index bbd16c7..a403e34 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -237,6 +237,7 @@ int main(int argc, char *const argv[])
 {
int fd, period, ret, c, lindex, tuned = 0;
pthread_t load_pth;
+   cpu_set_t cpu_set;
time_t start;
 
period = CONFIG_XENO_DEFAULT_PERIOD;
@@ -273,6 +274,12 @@ int main(int argc, char *const argv[])
}
}
 
+   CPU_ZERO(&cpu_set);
+   CPU_SET(0, &cpu_set);
+   ret = sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
+   if (ret)
+   error(1, errno, "cannot set CPU affinity");
+
if (background) {
ret = daemon(0, 0);
if (ret)


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


[Xenomai-git] Philippe Gerum : lib/cobalt: update default stack size in thread attribute

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: e4ac28083d72d4cc058f952324be472d2d4b834f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e4ac28083d72d4cc058f952324be472d2d4b834f

Author: Philippe Gerum 
Date:   Mon Aug 24 12:04:31 2015 +0200

lib/cobalt: update default stack size in thread attribute

---

 lib/cobalt/attr.c |2 +-
 lib/cobalt/init.c |2 +-
 lib/cobalt/internal.h |2 --
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/cobalt/attr.c b/lib/cobalt/attr.c
index fcb94ff..586de92 100644
--- a/lib/cobalt/attr.c
+++ b/lib/cobalt/attr.c
@@ -26,7 +26,7 @@
 COBALT_IMPL(int, pthread_attr_init, (pthread_attr_t *attr))
 {
__STD(pthread_attr_init)(attr);
-   return pthread_attr_setstacksize(attr, COBALT_STACKSIZE_DEFAULT);
+   return pthread_attr_setstacksize(attr, PTHREAD_STACK_DEFAULT);
 }
 
 int pthread_attr_init_ex(pthread_attr_ex_t *attr_ex)
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 4fde805..074d563 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -178,7 +178,7 @@ static void __cobalt_init(void)
 
 static inline void commit_stack_memory(void)
 {
-   char stk[PTHREAD_STACK_MIN];
+   char stk[PTHREAD_STACK_MIN / 2];
cobalt_commit_memory(stk);
 }
 
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index b0f1019..df7d416 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -23,8 +23,6 @@
 #include 
 #include "current.h"
 
-#define COBALT_STACKSIZE_DEFAULT   (PTHREAD_STACK_MIN * 4)
-
 extern void *cobalt_umm_private;
 
 extern void *cobalt_umm_shared;


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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: bebaf3a1df28e5c3c1790ab084744727a4f1b089
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bebaf3a1df28e5c3c1790ab084744727a4f1b089

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:24 2015 +0200

cobalt/blackfin: upgrade I-pipe support

---

 .../patches/ipipe-core-3.16.7-blackfin-5.patch |11815 
 ...2.patch => ipipe-core-3.18.20-blackfin-3.patch} |   89 +-
 2 files changed, 56 insertions(+), 11848 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=bebaf3a1df28e5c3c1790ab084744727a4f1b089

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


[Xenomai-git] Gilles Chanteperdrix : rtnet/rtdev.c: do not use return in a void function

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 13ef30a391d34310fe557e0b49322b966fa91def
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=13ef30a391d34310fe557e0b49322b966fa91def

Author: Gilles Chanteperdrix 
Date:   Tue Sep 29 03:15:15 2015 +0200

rtnet/rtdev.c: do not use return in a void function

---

 kernel/drivers/net/stack/rtdev.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/drivers/net/stack/rtdev.c b/kernel/drivers/net/stack/rtdev.c
index 54a7d82..4bc108f 100644
--- a/kernel/drivers/net/stack/rtdev.c
+++ b/kernel/drivers/net/stack/rtdev.c
@@ -242,7 +242,7 @@ static int rtdev_rx_pool_trylock(void *cookie)
 
 static void rtdev_rx_pool_unlock(void *cookie)
 {
-return rtdev_dereference(cookie);
+rtdev_dereference(cookie);
 }
 
 static const struct rtskb_pool_lock_ops rtdev_ops = {


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


[Xenomai-git] Philippe Gerum : drivers/can/flexcan: leave management of references to devm

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 584f825fd0c7dcf1d7d4ad6f59e253d935c88b5d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=584f825fd0c7dcf1d7d4ad6f59e253d935c88b5d

Author: Philippe Gerum 
Date:   Mon Oct  5 14:06:54 2015 +0200

drivers/can/flexcan: leave management of references to devm

Echoes commit 1994454 from Xenomai 2.6.

---

 kernel/drivers/can/rtcan_flexcan.c |8 
 1 file changed, 8 deletions(-)

diff --git a/kernel/drivers/can/rtcan_flexcan.c 
b/kernel/drivers/can/rtcan_flexcan.c
index 27c856d..ac88d07 100644
--- a/kernel/drivers/can/rtcan_flexcan.c
+++ b/kernel/drivers/can/rtcan_flexcan.c
@@ -996,12 +996,6 @@ static void unregister_flexcandev(struct rtcan_device *dev)
rtcan_dev_unregister(dev);
 }
 
-static void put_clocks(struct flexcan_priv *priv)
-{
-   clk_put(priv->clk_per);
-   clk_put(priv->clk_ipg);
-}
-
 static struct of_device_id flexcan_of_match[] = {
{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
{ .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
@@ -1125,7 +1119,6 @@ out_register:
 out_map:
release_mem_region(mem->start, mem_size);
 out_get:
-   put_clocks(priv);
rtcan_dev_free(dev);
 
return err;
@@ -1143,7 +1136,6 @@ static int flexcan_remove(struct platform_device *pdev)
 
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));
-   put_clocks(priv);
 
rtcan_dev_free(dev);
 


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


[Xenomai-git] Philippe Gerum : doc/doxygen: expand macro confusing to the parser

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: f66763e28a96eb19f438bc1f761c4bba5dfe7db7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f66763e28a96eb19f438bc1f761c4bba5dfe7db7

Author: Philippe Gerum 
Date:   Tue Oct  6 16:28:39 2015 +0200

doc/doxygen: expand macro confusing to the parser

---

 doc/doxygen/xeno3prm-common.conf.in |1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/doxygen/xeno3prm-common.conf.in 
b/doc/doxygen/xeno3prm-common.conf.in
index 9f3fca9..097a582 100644
--- a/doc/doxygen/xeno3prm-common.conf.in
+++ b/doc/doxygen/xeno3prm-common.conf.in
@@ -651,6 +651,7 @@ PREDEFINED = DOXYGEN_CPP\
CONFIG_SMP  \
 "dref_type(T)=opaque"  \
 "EXPORT_SYMBOL_GPL(symbol)=//" \
+"DECLARE_BITMAP(symbol, nr)=unsigned long symbol[BITS_TO_LONGS(nr)]" \
"COBALT_IMPL(T,I,A)=T I A"  \
"COBALT_DECL(T,P)=T P"  \
"COBALT_SYSCALL(N,M,T,A)=T N A" \


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


[Xenomai-git] Philippe Gerum : copperplate/threadobj: name main thread after process

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 70700428810333bf60aef7a26d8a3f7f2a9ee949
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=70700428810333bf60aef7a26d8a3f7f2a9ee949

Author: Philippe Gerum 
Date:   Tue Aug 25 11:51:03 2015 +0200

copperplate/threadobj: name main thread after process

---

 lib/copperplate/internal.c  |8 
 lib/copperplate/internal.h  |2 ++
 lib/copperplate/threadobj.c |   14 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 7f712de..b9751e4 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -153,6 +153,14 @@ static inline void prepare_wait_corespec(void)
 
 #endif  /* CONFIG_XENO_MERCURY */
 
+int copperplate_get_current_name(char *name, size_t maxlen)
+{
+   if (maxlen < 16)
+   return -ENOSPC;
+
+   return prctl(PR_GET_NAME, (unsigned long)name, 0, 0, 0);
+}
+
 static int thread_spawn_prologue(struct corethread_attributes *cta)
 {
int ret;
diff --git a/lib/copperplate/internal.h b/lib/copperplate/internal.h
index 5d0d41e..6369694 100644
--- a/lib/copperplate/internal.h
+++ b/lib/copperplate/internal.h
@@ -81,6 +81,8 @@ extern "C" {
 
 void copperplate_set_current_name(const char *name);
 
+int copperplate_get_current_name(char *name, size_t maxlen);
+
 int copperplate_kill_tid(pid_t tid, int sig);
 
 int copperplate_create_thread(struct corethread_attributes *cta,
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index c10e46a..961d8c4 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -1309,17 +1309,21 @@ int threadobj_prologue(struct threadobj *thobj, const 
char *name)
finalize_thread(current);
}
 
-   if (name)
+   if (name) {
namecpy(thobj->name, name);
-   else
-   *thobj->name = '\0';
+   copperplate_set_current_name(name);
+   } else {
+   ret = copperplate_get_current_name(thobj->name,
+  sizeof(thobj->name));
+   if (ret)
+   warning("cannot get process name, %s", symerror(ret));
+   }
 
thobj->ptid = pthread_self();
thobj->pid = get_thread_pid();
thobj->errno_pointer = &errno;
threadobj_set_agent(thobj);
backtrace_init_context(&thobj->btd, name);
-   copperplate_set_current_name(thobj->name);
ret = threadobj_setup_corespec(thobj);
if (ret) {
warning("prologue failed for thread %s, %s",
@@ -1741,7 +1745,7 @@ static inline int main_overlay(void)
}
 
tcb->status = __THREAD_S_STARTED|__THREAD_S_ACTIVE;
-   threadobj_prologue(tcb, "main");
+   threadobj_prologue(tcb, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
 
return 0;


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


[Xenomai-git] Philippe Gerum : utils/rtcanconfig: fix error message

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 2939ed1270056c76df9dabcb47d782722f0e8df9
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2939ed1270056c76df9dabcb47d782722f0e8df9

Author: Philippe Gerum 
Date:   Tue Sep  8 19:02:33 2015 +0200

utils/rtcanconfig: fix error message

---

 utils/can/rtcanconfig.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/can/rtcanconfig.c b/utils/can/rtcanconfig.c
index 968e909..a285ec7 100644
--- a/utils/can/rtcanconfig.c
+++ b/utils/can/rtcanconfig.c
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
 
 ret = ioctl(can_fd, SIOCGIFINDEX, &ifr);
 if (ret) {
-   fprintf(stderr,"Can't get interface index for %s, code = %d\n", ifname, 
ret);
+   fprintf(stderr,"Can't get interface index for %s, errno = %d\n", 
ifname, errno);
return ret;
 }
 


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


[Xenomai-git] Philippe Gerum : demo/cyclictest: fixups for building over uClibc

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: f23985b033a4576773d58a9b77fd9219037f47f6
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f23985b033a4576773d58a9b77fd9219037f47f6

Author: Philippe Gerum 
Date:   Mon Oct  5 14:49:44 2015 +0200

demo/cyclictest: fixups for building over uClibc

Mainly for building with outdated Blackfin toolchains.

---

 demo/posix/cyclictest/Makefile.am  |3 +-
 demo/posix/cyclictest/cyclictest.c |   99 ++--
 demo/posix/cyclictest/rt-utils.h   |5 ++
 3 files changed, 56 insertions(+), 51 deletions(-)

diff --git a/demo/posix/cyclictest/Makefile.am 
b/demo/posix/cyclictest/Makefile.am
index ff62b37..a35fdca 100644
--- a/demo/posix/cyclictest/Makefile.am
+++ b/demo/posix/cyclictest/Makefile.am
@@ -14,8 +14,7 @@ cyclictest_CPPFLAGS = \
-Wno-implicit-function-declaration  \
-Wno-missing-prototypes \
-Wno-nonnull\
-   -Wno-unused-function\
-   -Wno-unused-result
+   -Wno-unused-function
 
 cyclictest_SOURCES =   \
cyclictest.c\
diff --git a/demo/posix/cyclictest/cyclictest.c 
b/demo/posix/cyclictest/cyclictest.c
index 92c7043..0f59e21 100644
--- a/demo/posix/cyclictest/cyclictest.c
+++ b/demo/posix/cyclictest/cyclictest.c
@@ -43,52 +43,12 @@
 #define DEFAULT_INTERVAL 1000
 #define DEFAULT_DISTANCE 500
 
-#ifndef SCHED_IDLE
-#define SCHED_IDLE 5
-#endif
-#ifndef SCHED_NORMAL
-#define SCHED_NORMAL SCHED_OTHER
-#endif
-
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* Ugly, but  */
 #define gettid() syscall(__NR_gettid)
 #define sigev_notify_thread_id _sigev_un._tid
 
-#ifdef __UCLIBC__
-#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
-   ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
-#define CPUCLOCK_SCHED  2
-
-static int clock_nanosleep(clockid_t clock_id, int flags, const struct 
timespec *req,
-  struct timespec *rem)
-{
-   if (clock_id == CLOCK_THREAD_CPUTIME_ID)
-   return -EINVAL;
-   if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
-   clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
-
-   return syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
-}
-
-int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
-  __const cpu_set_t *__cpuset)
-{
-   return -EINVAL;
-}
-
-#undef CPU_SET
-#undef CPU_ZERO
-#define CPU_SET(cpu, cpusetp)
-#define CPU_ZERO(cpusetp)
-
-#else
-extern int clock_nanosleep(clockid_t __clock_id, int __flags,
-  __const struct timespec *__req,
-  struct timespec *__rem);
-#endif
-
 #define USEC_PER_SEC   100
 #define NSEC_PER_SEC   10
 
@@ -113,6 +73,12 @@ int enable_events;
 
 static char *policyname(int policy);
 
+#define write_check(__fd, __buf, __len)\
+   do {\
+   int __ret = write(__fd, __buf, __len);  \
+   (void)__ret;\
+   } while (0);
+
 enum {
NOTRACE,
CTXTSWITCH,
@@ -196,8 +162,6 @@ static pthread_mutex_t break_thread_id_lock = 
PTHREAD_MUTEX_INITIALIZER;
 static pid_t break_thread_id = 0;
 static uint64_t break_thread_value = 0;
 
-static pthread_barrier_t align_barr;
-static pthread_barrier_t globalt_barr;
 static struct timespec globalt;
 
 /* Backup of kernel variables that we modify */
@@ -437,7 +401,7 @@ static void tracemark(char *fmt, ...)
va_start(ap, fmt);
len = vsnprintf(tracebuf, TRACEBUFSIZ, fmt, ap);
va_end(ap);
-   write(tracemark_fd, tracebuf, len);
+   write_check(tracemark_fd, tracebuf, len);
 }
 
 
@@ -450,7 +414,7 @@ void tracing(int on)
case KV_26_LT24: prctl(0, 1); break;
case KV_26_33:
case KV_30:
-   write(trace_fd, "1", 1);
+   write_check(trace_fd, "1", 1);
break;
default: break;
}
@@ -460,7 +424,7 @@ void tracing(int on)
case KV_26_LT24: prctl(0, 0); break;
case KV_26_33:
case KV_30:
-   write(trace_fd, "0", 1);
+   write_check(trace_fd, "0", 1);
break;
default:break;
}
@@ -737,6 +701,43 @@ try_again:
return err;
 }
 
+/* Work around lack of barriers in oldish uClibc-based toolchains. */
+
+static struct thread_barrier {
+   pthread_mutex_t lock;
+   pthread_cond_t wait;
+   unsigned int count;
+} align_barr, globalt_barr;
+
+static inline
+void barrier_init(struct thread_barrier *__restrict barrier,
+unsigned int count)
+{
+   pthread_mutex_init(&barrier->lock, NULL);
+   pthread_cond_init(&barrier->wait, NULL);
+   ba

[Xenomai-git] Philippe Gerum : doc/doxygen: expand macro confusing to the parser

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f66763e28a96eb19f438bc1f761c4bba5dfe7db7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f66763e28a96eb19f438bc1f761c4bba5dfe7db7

Author: Philippe Gerum 
Date:   Tue Oct  6 16:28:39 2015 +0200

doc/doxygen: expand macro confusing to the parser

---

 doc/doxygen/xeno3prm-common.conf.in |1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/doxygen/xeno3prm-common.conf.in 
b/doc/doxygen/xeno3prm-common.conf.in
index 9f3fca9..097a582 100644
--- a/doc/doxygen/xeno3prm-common.conf.in
+++ b/doc/doxygen/xeno3prm-common.conf.in
@@ -651,6 +651,7 @@ PREDEFINED = DOXYGEN_CPP\
CONFIG_SMP  \
 "dref_type(T)=opaque"  \
 "EXPORT_SYMBOL_GPL(symbol)=//" \
+"DECLARE_BITMAP(symbol, nr)=unsigned long symbol[BITS_TO_LONGS(nr)]" \
"COBALT_IMPL(T,I,A)=T I A"  \
"COBALT_DECL(T,P)=T P"  \
"COBALT_SYSCALL(N,M,T,A)=T N A" \


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


[Xenomai-git] Philippe Gerum : demo/cyclictest: fixups for building over uClibc

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f23985b033a4576773d58a9b77fd9219037f47f6
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f23985b033a4576773d58a9b77fd9219037f47f6

Author: Philippe Gerum 
Date:   Mon Oct  5 14:49:44 2015 +0200

demo/cyclictest: fixups for building over uClibc

Mainly for building with outdated Blackfin toolchains.

---

 demo/posix/cyclictest/Makefile.am  |3 +-
 demo/posix/cyclictest/cyclictest.c |   99 ++--
 demo/posix/cyclictest/rt-utils.h   |5 ++
 3 files changed, 56 insertions(+), 51 deletions(-)

diff --git a/demo/posix/cyclictest/Makefile.am 
b/demo/posix/cyclictest/Makefile.am
index ff62b37..a35fdca 100644
--- a/demo/posix/cyclictest/Makefile.am
+++ b/demo/posix/cyclictest/Makefile.am
@@ -14,8 +14,7 @@ cyclictest_CPPFLAGS = \
-Wno-implicit-function-declaration  \
-Wno-missing-prototypes \
-Wno-nonnull\
-   -Wno-unused-function\
-   -Wno-unused-result
+   -Wno-unused-function
 
 cyclictest_SOURCES =   \
cyclictest.c\
diff --git a/demo/posix/cyclictest/cyclictest.c 
b/demo/posix/cyclictest/cyclictest.c
index 92c7043..0f59e21 100644
--- a/demo/posix/cyclictest/cyclictest.c
+++ b/demo/posix/cyclictest/cyclictest.c
@@ -43,52 +43,12 @@
 #define DEFAULT_INTERVAL 1000
 #define DEFAULT_DISTANCE 500
 
-#ifndef SCHED_IDLE
-#define SCHED_IDLE 5
-#endif
-#ifndef SCHED_NORMAL
-#define SCHED_NORMAL SCHED_OTHER
-#endif
-
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* Ugly, but  */
 #define gettid() syscall(__NR_gettid)
 #define sigev_notify_thread_id _sigev_un._tid
 
-#ifdef __UCLIBC__
-#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
-   ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
-#define CPUCLOCK_SCHED  2
-
-static int clock_nanosleep(clockid_t clock_id, int flags, const struct 
timespec *req,
-  struct timespec *rem)
-{
-   if (clock_id == CLOCK_THREAD_CPUTIME_ID)
-   return -EINVAL;
-   if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
-   clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
-
-   return syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
-}
-
-int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
-  __const cpu_set_t *__cpuset)
-{
-   return -EINVAL;
-}
-
-#undef CPU_SET
-#undef CPU_ZERO
-#define CPU_SET(cpu, cpusetp)
-#define CPU_ZERO(cpusetp)
-
-#else
-extern int clock_nanosleep(clockid_t __clock_id, int __flags,
-  __const struct timespec *__req,
-  struct timespec *__rem);
-#endif
-
 #define USEC_PER_SEC   100
 #define NSEC_PER_SEC   10
 
@@ -113,6 +73,12 @@ int enable_events;
 
 static char *policyname(int policy);
 
+#define write_check(__fd, __buf, __len)\
+   do {\
+   int __ret = write(__fd, __buf, __len);  \
+   (void)__ret;\
+   } while (0);
+
 enum {
NOTRACE,
CTXTSWITCH,
@@ -196,8 +162,6 @@ static pthread_mutex_t break_thread_id_lock = 
PTHREAD_MUTEX_INITIALIZER;
 static pid_t break_thread_id = 0;
 static uint64_t break_thread_value = 0;
 
-static pthread_barrier_t align_barr;
-static pthread_barrier_t globalt_barr;
 static struct timespec globalt;
 
 /* Backup of kernel variables that we modify */
@@ -437,7 +401,7 @@ static void tracemark(char *fmt, ...)
va_start(ap, fmt);
len = vsnprintf(tracebuf, TRACEBUFSIZ, fmt, ap);
va_end(ap);
-   write(tracemark_fd, tracebuf, len);
+   write_check(tracemark_fd, tracebuf, len);
 }
 
 
@@ -450,7 +414,7 @@ void tracing(int on)
case KV_26_LT24: prctl(0, 1); break;
case KV_26_33:
case KV_30:
-   write(trace_fd, "1", 1);
+   write_check(trace_fd, "1", 1);
break;
default: break;
}
@@ -460,7 +424,7 @@ void tracing(int on)
case KV_26_LT24: prctl(0, 0); break;
case KV_26_33:
case KV_30:
-   write(trace_fd, "0", 1);
+   write_check(trace_fd, "0", 1);
break;
default:break;
}
@@ -737,6 +701,43 @@ try_again:
return err;
 }
 
+/* Work around lack of barriers in oldish uClibc-based toolchains. */
+
+static struct thread_barrier {
+   pthread_mutex_t lock;
+   pthread_cond_t wait;
+   unsigned int count;
+} align_barr, globalt_barr;
+
+static inline
+void barrier_init(struct thread_barrier *__restrict barrier,
+unsigned int count)
+{
+   pthread_mutex_init(&barrier->lock, NULL);
+   pthread_cond_init(&barrier->wait, NULL);
+   barr

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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: bebaf3a1df28e5c3c1790ab084744727a4f1b089
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bebaf3a1df28e5c3c1790ab084744727a4f1b089

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:24 2015 +0200

cobalt/blackfin: upgrade I-pipe support

---

 .../patches/ipipe-core-3.16.7-blackfin-5.patch |11815 
 ...2.patch => ipipe-core-3.18.20-blackfin-3.patch} |   89 +-
 2 files changed, 56 insertions(+), 11848 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=bebaf3a1df28e5c3c1790ab084744727a4f1b089

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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: cdd4d58892b456cf18a122329f21a5bd6d40c54e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cdd4d58892b456cf18a122329f21a5bd6d40c54e

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:27 2015 +0200

cobalt/arm: upgrade I-pipe support

---

 ...-arm-5.patch => ipipe-core-3.18.20-arm-6.patch} |  134 +---
 1 file changed, 86 insertions(+), 48 deletions(-)

diff --git a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch 
b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
similarity index 99%
rename from kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
rename to kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
index 6bded0c..073b2a7 100644
--- a/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-5.patch
+++ b/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
@@ -159,17 +159,18 @@ index 38c89ca..7c954bc 100644
  
  # Keep at91 dtb files sorted alphabetically for each SoC
 diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
-index 9596ed5..3e7a4a3 100644
+index 9596ed5..8957633e 100644
 --- a/arch/arm/boot/dts/imx6qdl.dtsi
 +++ b/arch/arm/boot/dts/imx6qdl.dtsi
-@@ -125,6 +125,12 @@
+@@ -125,6 +125,13 @@
clocks = <&clks IMX6QDL_CLK_TWD>;
};
  
 +  timer@00a00200 {
 +  compatible = "arm,cortex-a9-global-timer";
 +  reg = <0x00a00200 0x20>;
-+  clocks = <&clks 15>;
++  interrupts = <1 11 0xf01>;
++  clocks = <&clks IMX6QDL_CLK_TWD>;
 +  };
 +
L2: l2-cache@00a02000 {
@@ -690,10 +691,10 @@ index 000..19b50df
 +  power = <50>;
 +};
 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
-index 878c979..aae32e6 100644
+index 878c979..dc2450d 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
-@@ -72,6 +72,12 @@
+@@ -72,6 +72,13 @@
interrupts = ;
};
  
@@ -701,6 +702,7 @@ index 878c979..aae32e6 100644
 +  compatible = "arm,cortex-a9-global-timer";
 +  reg = <0x48240200 0x20>;
 +  clocks = <&mpu_periphclk>;
++  interrupts = ;
 +  };
 +
/*
@@ -1651,7 +1653,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..5c7e9bd
+index 000..76c7b6b
 --- /dev/null
 +++ b/arch/arm/include/asm/ipipe.h
 @@ -0,0 +1,272 @@
@@ -1699,7 +1701,7 @@ index 000..5c7e9bd
 +#include 
 +#include 
 +
-+#define IPIPE_CORE_RELEASE5
++#define IPIPE_CORE_RELEASE6
 +
 +struct ipipe_domain;
 +
@@ -3717,6 +3719,19 @@ index 4176df7..8451be2 100644
  /*
   * These are the registers used in the syscall handler, and allow us to
   * have in theory up to 7 arguments to a function - r0 to r6.
+diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c
+index cfb354f..d11d476 100644
+--- a/arch/arm/kernel/hibernate.c
 b/arch/arm/kernel/hibernate.c
+@@ -83,7 +83,7 @@ static void notrace arch_restore_image(void *unused)
+ {
+   struct pbe *pbe;
+ 
+-  cpu_switch_mm(idmap_pgd, &init_mm);
++  cpu_switch_mm(idmap_pgd, &init_mm, 1);
+   for (pbe = restore_pblist; pbe; pbe = pbe->next)
+   copy_page(pbe->orig_address, pbe->address);
+ 
 diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
 new file mode 100644
 index 000..9577fbb
@@ -4285,10 +4300,10 @@ index 000..9577fbb
 +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..f0cfd86
+index 000..4a87f0c
 --- /dev/null
 +++ b/arch/arm/kernel/ipipe_tsc.c
-@@ -0,0 +1,201 @@
+@@ -0,0 +1,203 @@
 +#include 
 +#include 
 +#include 
@@ -4456,6 +4471,8 @@ index 000..f0cfd86
 +  ipipe_tsc_update_timer.function = __ipipe_tsc_update_fn;
 +  mod_timer(&ipipe_tsc_update_timer,
 +  jiffies + ipipe_tsc_update_timer.data);
++
++  __ipipe_tracer_hrclock_initialized();
 +}
 +
 +void __ipipe_mach_get_tscinfo(struct __ipipe_tscinfo *info)
@@ -4969,7 +4986,7 @@ index bd19834..c49e067 100644
} while (thread_flags & _TIF_WORK_MASK);
return 0;
 diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
-index a8e32aa..bd81cc5 100644
+index a8e32aa..4939e05 100644
 --- a/arch/arm/kernel/smp.c
 +++ b/arch/arm/kernel/smp.c
 @@ -72,8 +72,24 @@ enum ipi_msg_type {
@@ -5016,18 +5033,16 @@ index a8e32aa..bd81cc5 100644
  
/*
 * All kernel threads share the same mm context; grab a
-@@ -514,6 +537,93 @@ void arch_irq_work_raise(void)
+@@ -514,6 +537,91 @@ void arch_irq_work_raise(void)
  #endif
  
  #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
 +
 +static inline void ipi_t

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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: afbe6d48c2a43daddabf5e20cb9c0f631e925098
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=afbe6d48c2a43daddabf5e20cb9c0f631e925098

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:37 2015 +0200

cobalt/x86: upgrade I-pipe support

---

 .../arch/x86/patches/ipipe-core-3.16.7-x86-5.patch |15377 
 ...-x86-2.patch => ipipe-core-3.18.20-x86-3.patch} |   89 +-
 2 files changed, 56 insertions(+), 15410 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=afbe6d48c2a43daddabf5e20cb9c0f631e925098

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


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

2015-10-06 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d18d5aa14deb8c81cef820f88bae8a5004d360cf
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d18d5aa14deb8c81cef820f88bae8a5004d360cf

Author: Philippe Gerum 
Date:   Tue Oct  6 15:38:33 2015 +0200

cobalt/powerpc: upgrade I-pipe support

---

 .../patches/ipipe-core-3.16.7-powerpc-5.patch  |15596 
 ...-2.patch => ipipe-core-3.18.20-powerpc-3.patch} |   89 +-
 2 files changed, 56 insertions(+), 15629 deletions(-)

Diff:   
http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=d18d5aa14deb8c81cef820f88bae8a5004d360cf

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