[Xenomai-git] Philippe Gerum : cobalt/timer: de-macroize timer list scanners
Module: xenomai-3 Branch: master Commit: 7fb7c4287863a59b381b19e72e1acf2203f00d9d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7fb7c4287863a59b381b19e72e1acf2203f00d9d Author: Philippe Gerum r...@xenomai.org Date: Tue Jul 21 15:30:20 2015 +0200 cobalt/timer: de-macroize timer list scanners --- include/cobalt/kernel/timer.h | 44 + 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h index 1fe0427..de35380 100644 --- a/include/cobalt/kernel/timer.h +++ b/include/cobalt/kernel/timer.h @@ -80,25 +80,35 @@ struct xntlholder { #define xntlholder_prio(h) ((h)-prio) #define xntlist_init(q)INIT_LIST_HEAD(q) #define xntlist_empty(q) list_empty(q) -#define xntlist_head(q) \ - ({ \ - struct xntlholder *h = list_empty(q) ? NULL : \ - list_first_entry(q, struct xntlholder, link); \ - h; \ - }) -#define xntlist_second(q) \ - ({ \ - struct xntlholder *_h = xntlist_head(q);\ - _h == NULL ? NULL : xntlist_next(q, _h);\ - }) +static inline struct xntlholder *xntlist_head(struct list_head *q) +{ + if (list_empty(q)) + return NULL; -#define xntlist_next(q, h) \ - ({ \ - struct xntlholder *_h = list_is_last(h-link, q) ? NULL : \ - list_entry(h-link.next, struct xntlholder, link); \ - _h; \ - }) + return list_first_entry(q, struct xntlholder, link); +} + +static inline struct xntlholder *xntlist_next(struct list_head *q, + struct xntlholder *h) +{ + if (list_is_last(h-link, q)) + return NULL; + + return list_entry(h-link.next, struct xntlholder, link); +} + +static inline struct xntlholder *xntlist_second(struct list_head *q) +{ + struct xntlholder *h; + + if (list_empty(q)) + return NULL; + + h = list_first_entry(q, struct xntlholder, link); + + return xntlist_next(q, h); +} static inline void xntlist_insert(struct list_head *q, struct xntlholder *holder) { ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/regd: fix duplicate removal of /system tree
Module: xenomai-3 Branch: master Commit: d045a544f0bc2ab43f3d8f27339fbe67dbfb13f5 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d045a544f0bc2ab43f3d8f27339fbe67dbfb13f5 Author: Philippe Gerum r...@xenomai.org Date: Thu Jul 23 09:58:12 2015 +0200 copperplate/regd: fix duplicate removal of /system tree delete_system_fs() is already called via an atexit() handler. --- lib/copperplate/regd/regd.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/copperplate/regd/regd.c b/lib/copperplate/regd/regd.c index 8176c9a..bcf5a9d 100644 --- a/lib/copperplate/regd/regd.c +++ b/lib/copperplate/regd/regd.c @@ -377,10 +377,8 @@ static void handle_requests(void) if (tmfd != -1 FD_ISSET(tmfd, set)) { ret = __STD(read(tmfd, exp, sizeof(exp))); (void)ret; - if (pvlist_empty(client_list)) { - delete_system_fs(); + if (pvlist_empty(client_list)) exit(0); - } } for (s = sockfd + 1; s FD_SETSIZE; s++) { if (!FD_ISSET(s, set) || s == tmfd) @@ -391,7 +389,6 @@ static void handle_requests(void) __STD(close(s)); FD_CLR(s, refset); if (anon pvlist_empty(client_list)) { - delete_system_fs(); if (daemonize) { note(unlinking session %s, __copperplate_setup_data.session_label); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/arm: add calibration value for LS1021A
Module: xenomai-3 Branch: master Commit: 2c1ee1232c67dc33173083540d006f5478b1766c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2c1ee1232c67dc33173083540d006f5478b1766c Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 3 10:00:17 2015 +0200 cobalt/arm: add calibration value for LS1021A --- kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h b/kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h index 6a3f5e1..e303a04 100644 --- a/kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h +++ b/kernel/cobalt/arch/arm/include/asm/xenomai/calibration.h @@ -44,6 +44,8 @@ static inline void xnarch_get_latencies(struct xnclock_gravity *p) ulat = 2000; #elif defined(CONFIG_SOC_IMX7) ulat = 2000; +#elif defined(CONFIG_SOC_LS1021A) + ulat = 2800; #elif defined(CONFIG_ARCH_OMAP) ulat = cpu_is_omap44xx() ? 2500 : 5000; #else ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/kernel: make most SIGDEBUG notifications depend on XNWARN
Module: xenomai-3 Branch: master Commit: 0cc5564c796480da5d3ae1515b0f97f0351ae9b7 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0cc5564c796480da5d3ae1515b0f97f0351ae9b7 Author: Philippe Gerum r...@xenomai.org Date: Sat Jul 11 17:25:15 2015 +0200 cobalt/kernel: make most SIGDEBUG notifications depend on XNWARN Only two situations are still unconditionally reported via SIGDEBUG, regardless of XNWARN being set or not: - lack of process memory locking when binding to the core - mayday trigger --- include/cobalt/kernel/thread.h |5 ++- include/cobalt/uapi/kernel/thread.h |5 +-- kernel/cobalt/rtdm/core.c |6 +-- kernel/cobalt/synch.c |4 +- kernel/cobalt/thread.c | 17 ++--- lib/cobalt/thread.c | 71 --- 6 files changed, 73 insertions(+), 35 deletions(-) diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h index ef7de04..8a9236a 100644 --- a/include/cobalt/kernel/thread.h +++ b/include/cobalt/kernel/thread.h @@ -502,9 +502,10 @@ static inline void xnthread_get_resource(struct xnthread *thread) static inline int xnthread_put_resource(struct xnthread *thread) { - if (xnthread_test_state(thread, XNWEAK|XNDEBUG)) { + if (xnthread_test_state(thread, XNWEAK) || + IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) { if (unlikely(thread-res_count == 0)) { - if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) + if (xnthread_test_state(thread, XNWARN)) xnthread_signal(thread, SIGDEBUG, SIGDEBUG_RESCNT_IMBALANCE); return -EPERM; diff --git a/include/cobalt/uapi/kernel/thread.h b/include/cobalt/uapi/kernel/thread.h index c053472..89853e8 100644 --- a/include/cobalt/uapi/kernel/thread.h +++ b/include/cobalt/uapi/kernel/thread.h @@ -94,11 +94,10 @@ * 'T' - Ptraced and stopped. * 'l' - Locks scheduler. * 'r' - Undergoes round-robin. - * 't' - Mode switches trapped. + * 't' - Runtime mode errors notified. * 'L' - Lock breaks trapped. - * 'd' - Debug mode turned on. */ -#define XNTHREAD_STATE_LABELS SWDRU..X.HbTlrt.Ld +#define XNTHREAD_STATE_LABELS SWDRU..X.HbTlrt.L. struct xnthread_user_window { __u32 state; diff --git a/kernel/cobalt/rtdm/core.c b/kernel/cobalt/rtdm/core.c index d00b0c4..fda3dab 100644 --- a/kernel/cobalt/rtdm/core.c +++ b/kernel/cobalt/rtdm/core.c @@ -104,12 +104,12 @@ open_devnode(struct rtdm_device *dev, const char *path, int oflag) struct file *filp; char *filename; -#ifdef CONFIG_XENO_OPT_DEBUG_USER - if (strncmp(path, /dev/rtdm/, 10)) + if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER) + strncmp(path, /dev/rtdm/, 10)) printk(XENO_WARNING %s[%d] opens obsolete device path: %s\n, current-comm, current-pid, path); -#endif + filename = kasprintf(GFP_KERNEL, /dev/rtdm/%s, dev-name); if (filename == NULL) return ERR_PTR(-ENOMEM); diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c index 536e0a7..f3c9d31 100644 --- a/kernel/cobalt/synch.c +++ b/kernel/cobalt/synch.c @@ -171,7 +171,9 @@ int xnsynch_sleep_on(struct xnsynch *synch, xnticks_t timeout, thread = xnthread_current(); - if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER) thread-res_count 0) + if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER) + thread-res_count 0 + xnthread_test_state(thread, XNWARN)) xnthread_signal(thread, SIGDEBUG, SIGDEBUG_RESCNT_SLEEP); xnlock_get_irqsave(nklock, s); diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index fa2fffd..acaf1a3 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -166,6 +166,11 @@ int __xnthread_init(struct xnthread *thread, ksformat(thread-name, sizeof(thread-name), @%p, thread); + /* +* We mirror the global user debug state into the per-thread +* state, to speed up branch taking in lib/cobalt wherever +* this needs to be tested. +*/ if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) flags |= XNDEBUG; @@ -706,8 +711,8 @@ EXPORT_SYMBOL_GPL(xnthread_start); * * - XNLOCK makes the current thread non-preemptible by other threads. * Unless XNTRAPLB is also set for the thread, the latter may still - * block, in which case, the lock will be reacquired automatically - * when it is scheduled back in. + * block, dropping the lock temporarily, in which case, the lock will + * be reacquired automatically when the thread resumes execution. * * - XNWARN enables debugging notifications for the current thread. A * SIGDEBUG (Linux-originated) signal is sent when the following @@ -718,13 +723,15 @@
[Xenomai-git] Philippe Gerum : copperplate/threadobj, boilerplate/list: cope with pedantic C++ parsers
Module: xenomai-3 Branch: master Commit: c52e08830612df3ede52389b228d7cc07fade417 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c52e08830612df3ede52389b228d7cc07fade417 Author: Philippe Gerum r...@xenomai.org Date: Mon Jul 20 18:45:01 2015 +0200 copperplate/threadobj, boilerplate/list: cope with pedantic C++ parsers --- include/boilerplate/scope.h |2 +- include/copperplate/threadobj.h |3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boilerplate/scope.h b/include/boilerplate/scope.h index d2203b3..98e1fe8 100644 --- a/include/boilerplate/scope.h +++ b/include/boilerplate/scope.h @@ -33,7 +33,7 @@ int pshared_check(void *heap, void *addr); #define dref_type(t) memoff_t -#define __memoff(__base, __addr) ((caddr_t)(__addr) - (caddr_t)(__base)) +#define __memoff(__base, __addr) ((memoff_t)((caddr_t)(__addr) - (caddr_t)(__base))) #define __memptr(__base, __off)((void *)((caddr_t)(__base) + (__off))) #define __memchk(__base, __addr) pshared_check(__base, __addr) diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h index 997334b..1d01709 100644 --- a/include/copperplate/threadobj.h +++ b/include/copperplate/threadobj.h @@ -84,7 +84,8 @@ static inline struct xnthread_user_window * threadobj_get_window(struct threadobj_corespec *corespec) { extern void *cobalt_umm_shared; - return cobalt_umm_shared + corespec-u_winoff; + return (struct xnthread_user_window *) + ((caddr_t)cobalt_umm_shared + corespec-u_winoff); } #else /* !CONFIG_XENO_PSHARED */ ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : rtdm/waitqueue: fix error codes
Module: xenomai-3 Branch: master Commit: a3d9da699e62df122bea5213b5724d96aa0025af URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a3d9da699e62df122bea5213b5724d96aa0025af Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 17 17:20:12 2015 +0200 rtdm/waitqueue: fix error codes --- include/cobalt/kernel/rtdm/driver.h | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/include/cobalt/kernel/rtdm/driver.h b/include/cobalt/kernel/rtdm/driver.h index 4853ba9..80308ca 100644 --- a/include/cobalt/kernel/rtdm/driver.h +++ b/include/cobalt/kernel/rtdm/driver.h @@ -656,13 +656,28 @@ static inline void rtdm_waitqueue_destroy(struct rtdm_waitqueue *wq) xnsynch_destroy(wq-wait); } +static inline int __rtdm_dowait(struct rtdm_waitqueue *wq, + nanosecs_rel_t timeout, xntmode_t timeout_mode) +{ + int ret; + + ret = xnsynch_sleep_on(wq-wait, timeout, timeout_mode); + if (ret XNBREAK) + return -EINTR; + if (ret XNTIMEO) + return -ETIMEDOUT; + if (ret XNRMID) + return -EIDRM; + return 0; +} + static inline int __rtdm_timedwait(struct rtdm_waitqueue *wq, nanosecs_rel_t timeout, rtdm_toseq_t *toseq) { if (toseq timeout 0) - return xnsynch_sleep_on(wq-wait, *toseq, XN_ABSOLUTE); + return __rtdm_dowait(wq, *toseq, XN_ABSOLUTE); - return xnsynch_sleep_on(wq-wait, timeout, XN_RELATIVE); + return __rtdm_dowait(wq, timeout, XN_RELATIVE); } #define rtdm_timedwait_condition_locked(__wq, __cond, __timeout, __toseq) \ @@ -677,8 +692,8 @@ static inline int __rtdm_timedwait(struct rtdm_waitqueue *wq, ({ \ int __ret = 0; \ while (__ret == 0 !(__cond)) \ - __ret = xnsynch_sleep_on((__wq)-wait, \ -XN_INFINITE, XN_RELATIVE); \ + __ret = __rtdm_dowait(__wq, \ + XN_INFINITE, XN_RELATIVE); \ __ret; \ }) @@ -710,7 +725,7 @@ static inline int __rtdm_timedwait(struct rtdm_waitqueue *wq, }) #define rtdm_wait(__wq) \ - xnsynch_sleep_on((__wq)-wait, XN_INFINITE, XN_RELATIVE) + __rtdm_dowait(__wq, XN_INFINITE, XN_RELATIVE) #define rtdm_wait_locked(__wq) rtdm_wait(__wq) ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/sched: get rid of XNINLOCK scheduler flag
Module: xenomai-3 Branch: master Commit: 79a94a46f0c8f280a052f244ddb064b61a1f95ce URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=79a94a46f0c8f280a052f244ddb064b61a1f95ce Author: Philippe Gerum r...@xenomai.org Date: Thu Jul 2 09:18:41 2015 +0200 cobalt/sched: get rid of XNINLOCK scheduler flag XNINLOCK and the per-thread scheduler lock nesting count are redundant. Drop XNINLOCK which conveys less information. --- include/cobalt/kernel/sched.h | 42 - kernel/cobalt/clock.c |2 +- kernel/cobalt/sched.c | 11 +++ kernel/cobalt/thread.c| 11 +-- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h index 9cc64e5..1c11756 100644 --- a/include/cobalt/kernel/sched.h +++ b/include/cobalt/kernel/sched.h @@ -45,7 +45,6 @@ #define XNHTICK0x8000 /* Host tick pending */ #define XNINIRQ0x4000 /* In IRQ handling context */ #define XNHDEFER 0x2000 /* Host tick deferred */ -#define XNINLOCK 0x1000 /* Scheduler locked */ struct xnsched_rt { xnsched_queue_t runnable; /*! Runnable thread queue. */ @@ -255,19 +254,18 @@ static inline int xnsched_supported_cpu(int cpu) for_each_online_cpu(cpu)\ if (xnsched_supported_cpu(cpu)) \ -int __xnsched_run(struct xnsched *sched); +int ___xnsched_run(struct xnsched *sched); void __xnsched_run_handler(void); -static inline int xnsched_run(void) +static inline int __xnsched_run(struct xnsched *sched) { - struct xnsched *sched; /* -* NOTE: Since __xnsched_run() won't run if an escalation to -* primary domain is needed, we won't use critical scheduler -* information before we actually run in primary mode; -* therefore we can first test the scheduler status then -* escalate. +* NOTE: Since ___xnsched_run() won't run immediately if an +* escalation to primary domain is needed, we won't use +* critical scheduler information before we actually run in +* primary mode; therefore we can first test the scheduler +* status then escalate. * * Running in the primary domain means that no Linux-triggered * CPU migration may occur from that point either. Finally, @@ -280,18 +278,28 @@ static inline int xnsched_run(void) * in secondary mode; in which case we will escalate to the * primary domain, then unwind the current call frame without * running the rescheduling procedure in -* __xnsched_run(). Therefore, the scheduler slot +* ___xnsched_run(). Therefore, the scheduler slot * (i.e. sched) will be either valid, or unused. */ - sched = xnsched_current(); - smp_rmb(); + if (((sched-status|sched-lflags) +(XNINIRQ|XNINSW|XNRESCHED)) != XNRESCHED) + return 0; + + return ___xnsched_run(sched); +} + +static inline int xnsched_run(void) +{ + struct xnsched *sched = xnsched_current(); /* -* No immediate rescheduling is possible if an ISR context is -* active, the current thread holds the scheduler lock, or if -* we are caught in the middle of an unlocked context switch. +* No rescheduling is possible, either if: +* +* - the current thread holds the scheduler lock +* - an ISR context is active +* - we are caught in the middle of an unlocked context switch. */ - if (((sched-status|sched-lflags) -(XNINIRQ|XNINSW|XNRESCHED|XNINLOCK)) != XNRESCHED) + smp_rmb(); + if (unlikely(sched-curr-lock_count 0)) return 0; return __xnsched_run(sched); diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c index dfaa79e..e75d296 100644 --- a/kernel/cobalt/clock.c +++ b/kernel/cobalt/clock.c @@ -157,7 +157,7 @@ void xnclock_core_local_shot(struct xnsched *sched) * resumes. * * The host tick deferral is cleared whenever Xenomai is about -* to yield control to the host kernel (see __xnsched_run()), +* to yield control to the host kernel (see ___xnsched_run()), * or a timer with an earlier timeout date is scheduled, * whichever comes first. */ diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index 01ada7c..56014e0 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -338,8 +338,7 @@ void xnsched_lock(void) XENO_BUG_ON(COBALT, xnsched_current()-curr != curr); } - if (curr-lock_count++ == 0) - curr-sched-lflags |= XNINLOCK; + curr-lock_count++; } EXPORT_SYMBOL_GPL(xnsched_lock); @@ -357,7 +356,6 @@ void xnsched_unlock(void) if (--curr-lock_count == 0) {
[Xenomai-git] Philippe Gerum : cobalt/x86: fix missing early clobber in asm
Module: xenomai-3 Branch: master Commit: 5d313a256ff20a8ccdab6503e5f99b032ec9e6f1 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5d313a256ff20a8ccdab6503e5f99b032ec9e6f1 Author: Philippe Gerum r...@xenomai.org Date: Mon Jul 20 09:13:20 2015 +0200 cobalt/x86: fix missing early clobber in asm Detected with gcc 5.1.1 20150618 (Red Hat 5.1.1-4). --- kernel/cobalt/arch/x86/include/asm/xenomai/uapi/arith.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/arith.h b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/arith.h index 1cf6b08..3682736 100644 --- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/arith.h +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/arith.h @@ -117,7 +117,7 @@ mach_x86_32_ulldiv(const unsigned long long ull, mov %[__s],%%ecx\n\t \ shrd %%cl,%%edx,%%eax\n\t \ shrd %%cl,%[__hi],%%edx\n\t \ - : =A (__ret), [__lo] =r (__lo), [__hi] =r (__hi) \ + : =A (__ret), [__lo] =r (__lo), [__hi] =r (__hi) \ : A (ll), [__m] m (m), [__s] m (s)\ : ecx); \ __ret; \ ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : cobalt/posix/timer: Set error return codes
Module: xenomai-3 Branch: master Commit: a0cd7e6ad8cd90e4365d5a66ece9ec5890561e01 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a0cd7e6ad8cd90e4365d5a66ece9ec5890561e01 Author: Jan Kiszka jan.kis...@siemens.com Date: Thu Jul 2 18:16:22 2015 +0200 cobalt/posix/timer: Set error return codes These error exit paths incorrectly returned the positive timer ID so far, although the timer is deleted on error. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/timer.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c index 0adc112..e5551b3 100644 --- a/kernel/cobalt/posix/timer.c +++ b/kernel/cobalt/posix/timer.c @@ -163,8 +163,10 @@ static inline int timer_create(clockid_t clockid, signo = 0; /* Don't notify. */ else { signo = evp-sigev_signo; - if (signo 1 || signo _NSIG) + if (signo 1 || signo _NSIG) { + ret = -EINVAL; goto fail; + } timer-sigp.si.si_value = evp-sigev_value; } } @@ -174,8 +176,10 @@ static inline int timer_create(clockid_t clockid, timer-id = timer_id; target = timer_init(timer, evp); - if (target == NULL) + if (target == NULL) { + ret = -EPERM; goto fail; + } if (IS_ERR(target)) { ret = PTR_ERR(target); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/thread: introduce local information flags
Module: xenomai-3 Branch: master Commit: c35b5bbfabefb41ddeef490c204bdd9aee1b0bbb URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c35b5bbfabefb41ddeef490c204bdd9aee1b0bbb Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 3 10:00:25 2015 +0200 cobalt/thread: introduce local information flags thread-local_info receives information bits which may be updated only by the thread concerned. Therefore, there is no need for serialization when changing this data. --- include/cobalt/kernel/thread.h | 18 +- include/cobalt/uapi/kernel/thread.h | 13 - kernel/cobalt/sched.c |4 ++-- kernel/cobalt/thread.c | 29 - 4 files changed, 43 insertions(+), 21 deletions(-) diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h index cc2e32c..ef7de04 100644 --- a/include/cobalt/kernel/thread.h +++ b/include/cobalt/kernel/thread.h @@ -85,10 +85,11 @@ struct xnthread_personality { }; struct xnthread { - struct xnarchtcb tcb; /* Architecture-dependent block */ + struct xnarchtcb tcb; /* Architecture-dependent block */ __u32 state;/* Thread state flags */ __u32 info; /* Thread information flags */ + __u32 local_info; /* Local thread information flags */ struct xnsched *sched; /* Thread scheduler */ struct xnsched_class *sched_class; /* Current scheduling class */ @@ -222,6 +223,21 @@ static inline void xnthread_clear_info(struct xnthread *thread, int bits) thread-info = ~bits; } +static inline int xnthread_test_localinfo(struct xnthread *curr, int bits) +{ + return curr-local_info bits; +} + +static inline void xnthread_set_localinfo(struct xnthread *curr, int bits) +{ + curr-local_info |= bits; +} + +static inline void xnthread_clear_localinfo(struct xnthread *curr, int bits) +{ + curr-local_info = ~bits; +} + static inline struct xnarchtcb *xnthread_archtcb(struct xnthread *thread) { return thread-tcb; diff --git a/include/cobalt/uapi/kernel/thread.h b/include/cobalt/uapi/kernel/thread.h index 474271f..c053472 100644 --- a/include/cobalt/uapi/kernel/thread.h +++ b/include/cobalt/uapi/kernel/thread.h @@ -27,7 +27,7 @@ * @{ */ -/* State flags */ +/* State flags (shared) */ #define XNSUSP0x0001 /** Suspended. */ #define XNPEND0x0002 /** Sleep-wait for a resource. */ @@ -61,7 +61,7 @@ * @{ */ -/* Information flags */ +/* Information flags (shared) */ #define XNTIMEO 0x0001 /** Woken up due to a timeout condition */ #define XNRMID0x0002 /** Pending on a removed resource */ @@ -70,9 +70,12 @@ #define XNWAKEN 0x0010 /** Thread waken up upon resource availability */ #define XNROBBED 0x0020 /** Robbed from resource ownership */ #define XNCANCELD 0x0040 /** Cancellation request is pending */ -#define XNMOVED 0x0080 /** CPU migration in primary mode occurred */ -#define XNPIALERT 0x1000 /** Priority inversion alert (SIGDEBUG sent) */ -#define XNLBALERT 0x2000 /** Scheduler lock break alert (SIGDEBUG sent) */ +#define XNPIALERT 0x0080 /** Priority inversion alert (SIGDEBUG sent) */ + +/* Local information flags (private to current thread) */ + +#define XNMOVED 0x0001 /** CPU migration in primary mode occurred */ +#define XNLBALERT 0x0002 /** Scheduler lock break alert (SIGDEBUG sent) */ /** @} */ diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index 9a0bc4f..4900817 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -337,7 +337,7 @@ void ___xnsched_unlock(struct xnsched *sched) return; if (--curr-lock_count == 0) { - xnthread_clear_info(curr, XNLBALERT); + xnthread_clear_localinfo(curr, XNLBALERT); sched-lflags = ~XNINLOCK; xnsched_run(); } @@ -349,7 +349,7 @@ void ___xnsched_unlock_fully(struct xnsched *sched) struct xnthread *curr = sched-curr; curr-lock_count = 0; - xnthread_clear_info(curr, XNLBALERT); + xnthread_clear_localinfo(curr, XNLBALERT); sched-lflags = ~XNINLOCK; xnsched_run(); } diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index 07a39b6..8ab2dd8 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -174,6 +174,7 @@ int __xnthread_init(struct xnthread *thread, thread-sched = sched; thread-state = flags; thread-info = 0; + thread-local_info = 0; thread-lock_count = 0; thread-rrperiod = XN_INFINITE; thread-wchan = NULL; @@ -984,9 +985,11 @@ out: return; lock_break: + /* NOTE: thread is current */ if (xnthread_test_state(thread, XNWARN) - !xnthread_test_info(thread, XNLBALERT)) { - xnthread_set_info(thread, XNLBALERT | XNKICKED); +
[Xenomai-git] Jan Kiszka : cobalt/kernel: Remove write-only local variable from handle_schedule_event
Module: xenomai-3 Branch: master Commit: 83ff26d5acc3b691718e3226d0159ae40e99f684 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=83ff26d5acc3b691718e3226d0159ae40e99f684 Author: Jan Kiszka jan.kis...@siemens.com Date: Sun Jul 19 18:53:34 2015 +0200 cobalt/kernel: Remove write-only local variable from handle_schedule_event prev is unused since the introduction of this function to forge. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/process.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c index 1d2309d..301df0b 100644 --- a/kernel/cobalt/posix/process.c +++ b/kernel/cobalt/posix/process.c @@ -1067,13 +1067,12 @@ static inline void signal_yield(void) static int handle_schedule_event(struct task_struct *next_task) { struct task_struct *prev_task; - struct xnthread *prev, *next; + struct xnthread *next; sigset_t pending; signal_yield(); prev_task = current; - prev = xnthread_from_task(prev_task); next = xnthread_from_task(next_task); if (next == NULL) goto out; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/sched: simplify locking helpers
Module: xenomai-3 Branch: master Commit: fd0fdd8bc135244c37501a20fd6495384af211cc URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fd0fdd8bc135244c37501a20fd6495384af211cc Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 3 12:28:37 2015 +0200 cobalt/sched: simplify locking helpers --- include/cobalt/kernel/sched.h | 36 kernel/cobalt/sched.c | 11 --- kernel/cobalt/thread.c| 11 +++ 3 files changed, 11 insertions(+), 47 deletions(-) diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h index ecd9605..774f441 100644 --- a/include/cobalt/kernel/sched.h +++ b/include/cobalt/kernel/sched.h @@ -301,54 +301,31 @@ void ___xnsched_lock(struct xnsched *sched); void ___xnsched_unlock(struct xnsched *sched); -void ___xnsched_unlock_fully(struct xnsched *sched); - static inline void __xnsched_lock(void) { - struct xnsched *sched; - - barrier(); - sched = xnsched_current(); - ___xnsched_lock(sched); + ___xnsched_lock(xnsched_current()); } static inline void __xnsched_unlock(void) { - struct xnsched *sched; - - barrier(); - sched = xnsched_current(); - ___xnsched_unlock(sched); -} - -static inline void __xnsched_unlock_fully(void) -{ - struct xnsched *sched; - - barrier(); - sched = xnsched_current(); - ___xnsched_unlock_fully(sched); + ___xnsched_unlock(xnsched_current()); } static inline void xnsched_lock(void) { - struct xnsched *sched; spl_t s; xnlock_get_irqsave(nklock, s); - sched = xnsched_current(); - ___xnsched_lock(sched); + __xnsched_lock(); xnlock_put_irqrestore(nklock, s); } static inline void xnsched_unlock(void) { - struct xnsched *sched; spl_t s; xnlock_get_irqsave(nklock, s); - sched = xnsched_current(); - ___xnsched_unlock(sched); + __xnsched_unlock(); xnlock_put_irqrestore(nklock, s); } @@ -357,11 +334,6 @@ static inline int xnsched_interrupt_p(void) return xnsched_current()-lflags XNINIRQ; } -static inline int xnsched_locked_p(void) -{ - return xnsched_current_thread()-lock_count 0; -} - static inline int xnsched_root_p(void) { return xnthread_test_state(xnsched_current_thread(), XNROOT); diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index 4900817..240b5da 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -344,17 +344,6 @@ void ___xnsched_unlock(struct xnsched *sched) } EXPORT_SYMBOL_GPL(___xnsched_unlock); -void ___xnsched_unlock_fully(struct xnsched *sched) -{ - struct xnthread *curr = sched-curr; - - curr-lock_count = 0; - xnthread_clear_localinfo(curr, XNLBALERT); - sched-lflags = ~XNINLOCK; - xnsched_run(); -} -EXPORT_SYMBOL_GPL(___xnsched_unlock_fully); - /* Must be called with nklock locked, interrupts off. */ void xnsched_putback(struct xnthread *thread) { diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index 8ab2dd8..6badab2 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -758,8 +758,11 @@ int xnthread_set_mode(int clrmask, int setmask) if (lock_count == 0) __xnsched_lock(); } else if (clrmask XNLOCK) { - if (lock_count 0) - __xnsched_unlock_fully(); + if (lock_count 0) { + curr-lock_count = 0; + xnthread_clear_localinfo(curr, XNLBALERT); + xnsched_run(); + } } xnlock_put_irqrestore(nklock, s); @@ -1645,12 +1648,12 @@ int xnthread_migrate(int cpu) xnlock_get_irqsave(nklock, s); - if (!xnsched_primary_p() || xnsched_locked_p()) { + curr = xnthread_current(); + if (!xnsched_primary_p() || curr-lock_count 0) { ret = -EPERM; goto unlock_and_exit; } - curr = xnthread_current(); if (!cpu_isset(cpu, curr-affinity)) { ret = -EINVAL; goto unlock_and_exit; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : lib/cobalt: output sync delay fit in a regular integer
Module: xenomai-3 Branch: master Commit: 2dd50c880950fc9a93c0f76fbe1f7c202a46092b URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2dd50c880950fc9a93c0f76fbe1f7c202a46092b Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 11:25:24 2015 +0200 lib/cobalt: output sync delay fit in a regular integer --- include/cobalt/tunables.h |8 lib/cobalt/init.c | 29 +++-- lib/cobalt/printf.c |6 +++--- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/include/cobalt/tunables.h b/include/cobalt/tunables.h index 67953c2..67ac77a 100644 --- a/include/cobalt/tunables.h +++ b/include/cobalt/tunables.h @@ -31,7 +31,7 @@ extern int __cobalt_print_bufsz; extern int __cobalt_print_bufcount; -extern unsigned long long __cobalt_print_syncdelay; +extern int __cobalt_print_syncdelay; static inline define_config_tunable(main_prio, int, prio) { @@ -63,12 +63,12 @@ static inline read_config_tunable(print_buffer_count, int) return __cobalt_print_bufcount; } -static inline define_config_tunable(print_sync_delay, unsigned long long, delay) +static inline define_config_tunable(print_sync_delay, int, delay_ms) { - __cobalt_print_syncdelay = delay; + __cobalt_print_syncdelay = delay_ms; } -static inline read_config_tunable(print_sync_delay, unsigned long long) +static inline read_config_tunable(print_sync_delay, int) { return __cobalt_print_syncdelay; } diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c index 85dd590..2a81814 100644 --- a/lib/cobalt/init.c +++ b/lib/cobalt/init.c @@ -26,6 +26,7 @@ #include getopt.h #include limits.h #include unistd.h +#include stdint.h #include semaphore.h #include boilerplate/setup.h #include cobalt/uapi/kernel/heap.h @@ -230,16 +231,17 @@ int cobalt_init(void) } static int get_int_arg(const char *name, const char *arg, - unsigned long long *valp) + int *valp, int min) { - unsigned long long value; + int value, ret; char *p; errno = 0; - value = strtoll(arg, p, 10); - if (errno || *p) { + value = (int)strtol(arg, p, 10); + if (errno || *p || value min) { + ret = -errno ?: -EINVAL; early_warning(invalid value for %s: %s, name, arg); - return -errno; + return ret; } *valp = value; @@ -249,30 +251,29 @@ static int get_int_arg(const char *name, const char *arg, static int cobalt_parse_option(int optnum, const char *optarg) { - unsigned long long value; - int ret; + int value, ret; switch (optnum) { case main_prio_opt: - ret = get_int_arg(--main-prio, optarg, value); + ret = get_int_arg(--main-prio, optarg, value, INT32_MIN); if (ret) return ret; - __cobalt_main_prio = (int)value; + __cobalt_main_prio = value; break; case print_bufsz_opt: - ret = get_int_arg(--print-buffer-size, optarg, value); + ret = get_int_arg(--print-buffer-size, optarg, value, 0); if (ret) return ret; - __cobalt_print_bufsz = (int)value; + __cobalt_print_bufsz = value; break; case print_bufcnt_opt: - ret = get_int_arg(--print-buffer-count, optarg, value); + ret = get_int_arg(--print-buffer-count, optarg, value, 0); if (ret) return ret; - __cobalt_print_bufcount = (int)value; + __cobalt_print_bufcount = value; break; case print_syncdelay_opt: - ret = get_int_arg(--print-sync-delay, optarg, value); + ret = get_int_arg(--print-sync-delay, optarg, value, 0); if (ret) return ret; __cobalt_print_syncdelay = value; diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c index e7ff120..c016fb2 100644 --- a/lib/cobalt/printf.c +++ b/lib/cobalt/printf.c @@ -72,7 +72,7 @@ __weak int __cobalt_print_bufsz = RT_PRINT_DEFAULT_BUFFER; __weak int __cobalt_print_bufcount = RT_PRINT_DEFAULT_BUFFERS_COUNT; -__weak unsigned long long __cobalt_print_syncdelay = RT_PRINT_DEFAULT_SYNCDELAY; +__weak int __cobalt_print_syncdelay = RT_PRINT_DEFAULT_SYNCDELAY; static struct print_buffer *first_buffer; static int buffers; @@ -693,8 +693,8 @@ void cobalt_print_init(void) first_buffer = NULL; seq_no = 0; - syncdelay.tv_sec = __cobalt_print_syncdelay / 1000ULL; - syncdelay.tv_nsec = (__cobalt_print_syncdelay % 1000ULL) * 100; + syncdelay.tv_sec = __cobalt_print_syncdelay / 1000; + syncdelay.tv_nsec = (__cobalt_print_syncdelay % 1000) * 100; /* Fill the buffer pool */ pool_bitmap_len =
[Xenomai-git] Philippe Gerum : lib/cobalt: drop dandling declaration
Module: xenomai-3 Branch: master Commit: 6c4e0b4c1acd90e8f3ac0c5decdfdec7522772c5 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6c4e0b4c1acd90e8f3ac0c5decdfdec7522772c5 Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 16:19:21 2015 +0200 lib/cobalt: drop dandling declaration --- include/cobalt/pthread.h |2 -- 1 file changed, 2 deletions(-) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index 7843c84..386c337 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -45,8 +45,6 @@ COBALT_DECL(int, pthread_create(pthread_t *ptid_r, void *(*start) (void *), void *arg)); -COBALT_DECL(int, pthread_detach(pthread_t thread)); - COBALT_DECL(int, pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param)); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : config: bump version code
Module: xenomai-3 Branch: master Commit: 75a32904f26d4418690e469c8673c88c405163a2 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=75a32904f26d4418690e469c8673c88c405163a2 Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 18:09:30 2015 +0200 config: bump version code --- config/version-code |2 +- config/version-label |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/version-code b/config/version-code index e83f86c..ac14d36 100644 --- a/config/version-code +++ b/config/version-code @@ -1 +1 @@ -2.99.14 +2.99.15 diff --git a/config/version-label b/config/version-label index c548b54..14bd94e 100644 --- a/config/version-label +++ b/config/version-label @@ -1 +1 @@ -3.0-rc5 +3.0-rc6 ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : demo/can-rtt: remove redundant mlockall()
Module: xenomai-3 Branch: master Commit: 0c0031ad82b1ed3698dc4f07a7c9aa5d3cb69a6f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0c0031ad82b1ed3698dc4f07a7c9aa5d3cb69a6f Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 12:56:25 2015 +0200 demo/can-rtt: remove redundant mlockall() --- demo/posix/can-rtt.c |2 -- 1 file changed, 2 deletions(-) diff --git a/demo/posix/can-rtt.c b/demo/posix/can-rtt.c index 6c7c54d..0a3dff8 100644 --- a/demo/posix/can-rtt.c +++ b/demo/posix/can-rtt.c @@ -48,7 +48,6 @@ #include netinet/in.h #include net/if.h #include sys/ioctl.h -#include sys/mman.h #ifdef CONFIG_XENO_COBALT #include rtdm/can.h @@ -318,7 +317,6 @@ int main(int argc, char *argv[]) signal(SIGTERM, catch_signal); signal(SIGINT, catch_signal); signal(SIGHUP, catch_signal); -mlockall(MCL_CURRENT|MCL_FUTURE); printf(Round-Trip-Time test %s - %s with CAN ID 0x%x\n, argv[optind], argv[optind + 1], can_id); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : lib/cobalt: turn environment variables into options
Module: xenomai-3 Branch: master Commit: f42334abc373fd885dfeefe704aec9b026241800 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f42334abc373fd885dfeefe704aec9b026241800 Author: Philippe Gerum r...@xenomai.org Date: Sat Jul 25 20:07:11 2015 +0200 lib/cobalt: turn environment variables into options RT_PRINT_*_ENV variables are converted to command line base options, with associated configuration tunables (include/cobalt/tunables.h). RT_PRINT_BUFFER_ENV =--print-buffer-size RT_PRINT_BUFFERS_COUNT_ENV=--print-buffer-count RT_PRINT_PERIOD_ENV =--print-sync-delay --- include/cobalt/Makefile.am |1 + include/cobalt/sys/cobalt.h |4 -- include/cobalt/tunables.h | 80 + lib/cobalt/init.c | 68 +++-- lib/cobalt/printf.c | 116 +++ 5 files changed, 186 insertions(+), 83 deletions(-) diff --git a/include/cobalt/Makefile.am b/include/cobalt/Makefile.am index e2d7f87..19e9611 100644 --- a/include/cobalt/Makefile.am +++ b/include/cobalt/Makefile.am @@ -13,6 +13,7 @@ includesub_HEADERS = \ ticks.h \ time.h \ trace.h \ + tunables.h \ unistd.h\ wrappers.h diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h index 22322c1..e80800b 100644 --- a/include/cobalt/sys/cobalt.h +++ b/include/cobalt/sys/cobalt.h @@ -132,10 +132,6 @@ void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th); extern int __cobalt_control_bind; -extern int __cobalt_main_prio; - -extern int __cobalt_print_bufsz; - #ifdef __cplusplus } #endif diff --git a/include/cobalt/tunables.h b/include/cobalt/tunables.h new file mode 100644 index 000..67953c2 --- /dev/null +++ b/include/cobalt/tunables.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2015 Philippe Gerum r...@xenomai.org. + * + * 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. + */ +#ifndef _COBALT_TUNABLES_H +#define _COBALT_TUNABLES_H + +#include boilerplate/tunables.h +#include sys/cobalt.h + +#ifdef __cplusplus +extern C { +#endif + +extern int __cobalt_main_prio; + +extern int __cobalt_print_bufsz; + +extern int __cobalt_print_bufcount; + +extern unsigned long long __cobalt_print_syncdelay; + +static inline define_config_tunable(main_prio, int, prio) +{ + __cobalt_main_prio = prio; +} + +static inline read_config_tunable(main_prio, int) +{ + return __cobalt_main_prio; +} + +static inline define_config_tunable(print_buffer_size, int, size) +{ + __cobalt_print_bufsz = size; +} + +static inline read_config_tunable(print_buffer_size, int) +{ + return __cobalt_print_bufsz; +} + +static inline define_config_tunable(print_buffer_count, int, count) +{ + __cobalt_print_bufcount = count; +} + +static inline read_config_tunable(print_buffer_count, int) +{ + return __cobalt_print_bufcount; +} + +static inline define_config_tunable(print_sync_delay, unsigned long long, delay) +{ + __cobalt_print_syncdelay = delay; +} + +static inline read_config_tunable(print_sync_delay, unsigned long long) +{ + return __cobalt_print_syncdelay; +} + +#ifdef __cplusplus +} +#endif + +#endif /* !_COBALT_TUNABLES_H */ diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c index 3399329..85dd590 100644 --- a/lib/cobalt/init.c +++ b/lib/cobalt/init.c @@ -30,6 +30,7 @@ #include boilerplate/setup.h #include cobalt/uapi/kernel/heap.h #include cobalt/ticks.h +#include cobalt/tunables.h #include asm/xenomai/syscall.h #include xenomai/init.h #include umm.h @@ -57,6 +58,21 @@ static const struct option cobalt_options[] = { .has_arg = 1, }, { +#define print_bufsz_opt1 + .name = print-buffer-size, + .has_arg = 1, + }, + { +#define print_bufcnt_opt 2 + .name = print-buffer-count, + .has_arg = 1, + }, + { +#define print_syncdelay_opt3 + .name = print-sync-delay, + .has_arg = 1, + }, + { /* sentinel */ } }; @@ -205,18 +221,61 @@ int cobalt_init(void) ret = __RT(pthread_setschedparam(ptid, policy, parm)); if (ret) { -
[Xenomai-git] Philippe Gerum : lib/cobalt: drop no shadow binding mode
Module: xenomai-3 Branch: master Commit: f9227f35eea45418c30333f2c11e5fcd7f5b98c8 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f9227f35eea45418c30333f2c11e5fcd7f5b98c8 Author: Philippe Gerum r...@xenomai.org Date: Sat Jul 25 17:32:20 2015 +0200 lib/cobalt: drop no shadow binding mode This mode was meant to allow application programs to dlopen() the legacy Xenomai core library (aka libxenomai.so), in which the services used to be bootstrapped from an embedded library constructor, binding to the real-time core, before the current thread got shadowed automatically. The no-shadow mechanism was meant at preventing the latter action from taking place at the end of the init sequence. In the current implementation, the services are bootstrapped by an explicit call to xenomai_init(), usually done from a wrapper interposing on the main() routine, not from a library constructor anymore. Therefore, dlopen()'ing libcobalt.so per se will not cause the calling context to be shadowed. Calling xenomai_init() will be required to activate the Xenomai services for the calling process at some point, however the program is free to choose the context from which this should be done. In parallel, running over a shadowed context is required for traversing the init code of the various libraries bootstapped on behalf of xenomai_init(). So, basically we don't support no shadow binding anymore, but this is a non-issue since it became useless. --- include/cobalt/sys/cobalt.h |2 -- lib/cobalt/init.c | 15 ++- utils/corectl/corectl.c |2 -- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h index 9f9d03a..22322c1 100644 --- a/include/cobalt/sys/cobalt.h +++ b/include/cobalt/sys/cobalt.h @@ -130,8 +130,6 @@ int cobalt_sched_weighted_prio(int policy, void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th); -extern int __cobalt_no_shadow; - extern int __cobalt_control_bind; extern int __cobalt_main_prio; diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c index c67de7b..3399329 100644 --- a/lib/cobalt/init.c +++ b/lib/cobalt/init.c @@ -44,8 +44,6 @@ * Single Unix specification/a over the Cobalt core. */ -__weak int __cobalt_no_shadow = 0; - __weak int __cobalt_control_bind = 0; __weak int __cobalt_main_prio = -1; @@ -54,13 +52,7 @@ struct sigaction __cobalt_orig_sigdebug; static const struct option cobalt_options[] = { { -#define no_shadow_opt 0 - .name = no-shadow, - .flag = __cobalt_no_shadow, - .val = 1 - }, - { -#define main_prio_opt 1 +#define main_prio_opt 0 .name = main-prio, .has_arg = 1, }, @@ -184,7 +176,7 @@ int cobalt_init(void) cobalt_default_condattr_init(); __cobalt_init(); - if (__cobalt_no_shadow) + if (__cobalt_control_bind) return 0; ret = __STD(pthread_getschedparam(ptid, policy, parm)); @@ -226,8 +218,6 @@ static int cobalt_parse_option(int optnum, const char *optarg) case main_prio_opt: __cobalt_main_prio = atoi(optarg); break; - case no_shadow_opt: - break; default: /* Paranoid, can't happen. */ return -EINVAL; @@ -238,7 +228,6 @@ static int cobalt_parse_option(int optnum, const char *optarg) static void cobalt_help(void) { -fprintf(stderr, --no-shadow do not shadow main thread\n); fprintf(stderr, --main-prio=prioset main thread priority\n); } diff --git a/utils/corectl/corectl.c b/utils/corectl/corectl.c index 7104086..e1d1f17 100644 --- a/utils/corectl/corectl.c +++ b/utils/corectl/corectl.c @@ -25,8 +25,6 @@ #include sys/cobalt.h #include xenomai/init.h -int __cobalt_no_shadow = 1; - int __cobalt_control_bind = 1; static int action; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : utils/can: remove redundant mlockall()
Module: xenomai-3 Branch: master Commit: 8a19aeedefa174913badf566c3d0480f375af895 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8a19aeedefa174913badf566c3d0480f375af895 Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 12:58:00 2015 +0200 utils/can: remove redundant mlockall() --- utils/can/rtcanrecv.c |3 --- utils/can/rtcansend.c |3 --- 2 files changed, 6 deletions(-) diff --git a/utils/can/rtcanrecv.c b/utils/can/rtcanrecv.c index 17b2a48..e6e87b3 100644 --- a/utils/can/rtcanrecv.c +++ b/utils/can/rtcanrecv.c @@ -5,7 +5,6 @@ #include time.h #include errno.h #include getopt.h -#include sys/mman.h #include alchemy/task.h @@ -176,8 +175,6 @@ int main(int argc, char **argv) { 0, 0, 0, 0}, }; -mlockall(MCL_CURRENT | MCL_FUTURE); - signal(SIGTERM, cleanup_and_exit); signal(SIGINT, cleanup_and_exit); diff --git a/utils/can/rtcansend.c b/utils/can/rtcansend.c index 1c1f916..51fc080 100644 --- a/utils/can/rtcansend.c +++ b/utils/can/rtcansend.c @@ -5,7 +5,6 @@ #include time.h #include errno.h #include getopt.h -#include sys/mman.h #include alchemy/task.h #include alchemy/timer.h @@ -140,8 +139,6 @@ int main(int argc, char **argv) { 0, 0, 0, 0}, }; -mlockall(MCL_CURRENT | MCL_FUTURE); - signal(SIGTERM, cleanup_and_exit); signal(SIGINT, cleanup_and_exit); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : boilerplate/init: pull ancillary definitions from init header
Module: xenomai-3 Branch: master Commit: 1798ec3be16e692bc7fc5498d446723388f40b05 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1798ec3be16e692bc7fc5498d446723388f40b05 Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 11:59:47 2015 +0200 boilerplate/init: pull ancillary definitions from init header --- include/xenomai/init.h |1 + 1 file changed, 1 insertion(+) diff --git a/include/xenomai/init.h b/include/xenomai/init.h index bed4a28..1ec1d43 100644 --- a/include/xenomai/init.h +++ b/include/xenomai/init.h @@ -19,6 +19,7 @@ #define _XENOMAI_INIT_H #include boilerplate/setup.h +#include boilerplate/ancillaries.h #ifdef __cplusplus extern C { ___ 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
Module: xenomai-3 Branch: master Commit: 807152f5cd659160a0fb39f17e598a18822b483e URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=807152f5cd659160a0fb39f17e598a18822b483e Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 20:50:50 2015 +0200 cobalt/arm: upgrade I-pipe support --- ...arm-9.patch = ipipe-core-3.10.32-arm-10.patch} | 122 +- ...rm-10.patch = ipipe-core-3.14.44-arm-11.patch} | 302 +- .../arch/arm/patches/ipipe-core-3.16.7-arm-8.patch |22371 ...-arm-2.patch = ipipe-core-3.18.12-arm-3.patch} | 202 +- 4 files changed, 362 insertions(+), 22635 deletions(-) Diff: http://git.xenomai.org/?p=xenomai-3.git;a=commitdiff;h=807152f5cd659160a0fb39f17e598a18822b483e ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : testsuite/latency: remove redundant mlockall()
Module: xenomai-3 Branch: master Commit: 9c5283b769d9251cd8c9594da4a58e71df05439b URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9c5283b769d9251cd8c9594da4a58e71df05439b Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 12:50:04 2015 +0200 testsuite/latency: remove redundant mlockall() --- testsuite/latency/latency.c |3 --- 1 file changed, 3 deletions(-) diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c index fa19c56..bbc4317 100644 --- a/testsuite/latency/latency.c +++ b/testsuite/latency/latency.c @@ -30,7 +30,6 @@ #include signal.h #include sched.h #include time.h -#include sys/mman.h #include sys/time.h #include unistd.h #include pthread.h @@ -778,8 +777,6 @@ int main(int argc, char *const *argv) == All results in microseconds\n, period_ns / 1000, test_mode_names[test_mode]); - mlockall(MCL_CURRENT | MCL_FUTURE); - if (test_mode != USER_TASK) { benchdev = open(/dev/rtdm/timerbench, O_RDWR); if (benchdev 0) ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : cobalt/kernel: Fix mode of mayday syscall
Module: xenomai-3 Branch: master Commit: 9b68cbe2a7d3bbeb537184b8050dbd71365983be URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9b68cbe2a7d3bbeb537184b8050dbd71365983be Author: Jan Kiszka jan.kis...@siemens.com Date: Fri Jun 19 15:59:15 2015 +0200 cobalt/kernel: Fix mode of mayday syscall The oneway mode meant norestart, thus return -EINTR instead of retrying the syscall after signal processing. But this caused damaged to the register state of the mayday-interrupted thread, most visible on x86-64 where RAX is holding the RIP. Fix this by restarting the syscall on signals. The syscall is supposed to deliver the same result then, including a correct register state. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/syscall.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c index 759e423..61f3008 100644 --- a/kernel/cobalt/posix/syscall.c +++ b/kernel/cobalt/posix/syscall.c @@ -71,8 +71,6 @@ #define __xn_exec_nonrestartable (__xn_exec_primary|__xn_exec_norestart) /* Shorthand for domain probing syscall */ #define __xn_exec_probing (__xn_exec_conforming|__xn_exec_adaptive) -/* Shorthand for oneway trap - does not return to call site. */ -#define __xn_exec_oneway__xn_exec_norestart typedef long (*cobalt_syshand)(unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, @@ -246,7 +244,7 @@ static COBALT_SYSCALL(serialdbg, current, return 0; } -static COBALT_SYSCALL(mayday, oneway, (void)) +static COBALT_SYSCALL(mayday, current, (void)) { struct pt_regs *regs = task_pt_regs(current); struct xnthread *cur; @@ -800,7 +798,7 @@ static const int cobalt_sysmodes[] = { __COBALT_MODE(extend, lostage), __COBALT_MODE(trace, current), __COBALT_MODE(get_current, current), - __COBALT_MODE(mayday, oneway), + __COBALT_MODE(mayday, current), __COBALT_MODE(backtrace, current), __COBALT_MODE(serialdbg, current), __COBALT_MODE(corectl, probing), ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : lib/cobalt: assume CPU_COUNT, CPU_FILL are available
Module: xenomai-3 Branch: master Commit: ba364e772d82241dc6814960ca1b174972edd758 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ba364e772d82241dc6814960ca1b174972edd758 Author: Philippe Gerum r...@xenomai.org Date: Thu Jul 23 11:08:51 2015 +0200 lib/cobalt: assume CPU_COUNT, CPU_FILL are available --- include/cobalt/sched.h | 12 lib/cobalt/wrappers.c | 30 -- 2 files changed, 42 deletions(-) diff --git a/include/cobalt/sched.h b/include/cobalt/sched.h index 776272b..d7c72ca 100644 --- a/include/cobalt/sched.h +++ b/include/cobalt/sched.h @@ -31,18 +31,6 @@ COBALT_DECL(int, sched_get_priority_min(int policy)); COBALT_DECL(int, sched_get_priority_max(int policy)); -#ifndef CPU_COUNT -#define CPU_COUNT(__setp)__PROVIDE_CPU_COUNT(__setp) -#define __PROVIDE_CPU_COUNT(__setp) __sched_cpucount(sizeof(cpu_set_t), __setp) -int __sched_cpucount(size_t __setsize, const cpu_set_t *__setp); -#endif /* !CPU_COUNT */ - -#ifndef CPU_FILL -#define CPU_FILL(__setp)__PROVIDE_CPU_FILL(__setp) -#define __PROVIDE_CPU_FILL(__setp) __sched_cpufill(sizeof(cpu_set_t), __setp) -void __sched_cpufill(size_t __setsize, cpu_set_t *__setp); -#endif /* !CPU_COUNT */ - #ifdef __cplusplus extern C { #endif diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 313c3a7..4776e36 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -496,33 +496,3 @@ unsigned int __real_sleep(unsigned int seconds) { return sleep(seconds); } - -#ifdef __PROVIDE_CPU_COUNT - -int __sched_cpucount(size_t setsize, const cpu_set_t *setp) -{ - int count, shift; - const char *p; - - for (count = 0, p = setp; p (char *)setp + setsize; p++) { - shift = *p; - while (shift) { - if (shift 1) - count++; - shift = 1; - } - } - - return count; -} - -#endif /* __PROVIDE_CPU_COUNT */ - -#ifdef __PROVIDE_CPU_FILL - -void __sched_cpufill(size_t setsize, cpu_set_t *setp) -{ - memset(setp, 0xff, setsize); -} - -#endif /* __PROVIDE_CPU_COUNT */ ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/kernel: improve handling of user debug options
Module: xenomai-3 Branch: master Commit: 032fb4fad94c54c681ea9f5d2f47bae83e2c9029 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=032fb4fad94c54c681ea9f5d2f47bae83e2c9029 Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 12 16:42:23 2015 +0200 cobalt/kernel: improve handling of user debug options This changeset introduces individual switches for enabling/disabling particular user debug features. At this chance, the related documentation has been updated. Notification upon secondary mode switches is still considered regardless of the debug settings, as production setups may depend on it for basic sanity testing. --- include/cobalt/kernel/synch.h |6 +- include/cobalt/kernel/thread.h |2 +- include/cobalt/uapi/corectl.h | 16 ++-- include/cobalt/uapi/signal.h |2 +- kernel/cobalt/Kconfig | 168 +--- kernel/cobalt/debug.c |2 +- kernel/cobalt/posix/cond.c |5 +- kernel/cobalt/posix/mutex.c| 22 +++--- kernel/cobalt/posix/sem.c | 10 +-- kernel/cobalt/posix/syscall.c | 10 ++- kernel/cobalt/rtdm/core.c |2 +- kernel/cobalt/rtdm/fd.c|5 +- kernel/cobalt/synch.c |8 +- kernel/cobalt/thread.c | 26 --- kernel/drivers/Kconfig |3 +- lib/cobalt/internal.c |4 +- lib/cobalt/thread.c| 29 +-- 17 files changed, 176 insertions(+), 144 deletions(-) diff --git a/include/cobalt/kernel/synch.h b/include/cobalt/kernel/synch.h index f53cd5e..ffb884a 100644 --- a/include/cobalt/kernel/synch.h +++ b/include/cobalt/kernel/synch.h @@ -101,14 +101,14 @@ static inline struct xnthread *xnsynch_owner(struct xnsynch *synch) #define xnsynch_owner_check(synch, thread) \ xnsynch_fast_owner_check((synch)-fastlock, thread-handle) -#if XENO_DEBUG(USER) +#if XENO_DEBUG(MUTEX_RELAXED) void xnsynch_detect_relaxed_owner(struct xnsynch *synch, struct xnthread *sleeper); void xnsynch_detect_claimed_relax(struct xnthread *owner); -#else /* !XENO_DEBUG(USER) */ +#else /* !XENO_DEBUG(MUTEX_RELAXED) */ static inline void xnsynch_detect_relaxed_owner(struct xnsynch *synch, struct xnthread *sleeper) @@ -119,7 +119,7 @@ static inline void xnsynch_detect_claimed_relax(struct xnthread *owner) { } -#endif /* !XENO_DEBUG(USER) */ +#endif /* !XENO_DEBUG(MUTEX_RELAXED) */ void xnsynch_init(struct xnsynch *synch, int flags, atomic_t *fastlock); diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h index 8a9236a..1ba0c1b 100644 --- a/include/cobalt/kernel/thread.h +++ b/include/cobalt/kernel/thread.h @@ -503,7 +503,7 @@ static inline void xnthread_get_resource(struct xnthread *thread) static inline int xnthread_put_resource(struct xnthread *thread) { if (xnthread_test_state(thread, XNWEAK) || - IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) { + IS_ENABLED(CONFIG_XENO_OPT_DEBUG_MUTEX_SLEEP)) { if (unlikely(thread-res_count == 0)) { if (xnthread_test_state(thread, XNWARN)) xnthread_signal(thread, SIGDEBUG, diff --git a/include/cobalt/uapi/corectl.h b/include/cobalt/uapi/corectl.h index d2544b3..9466743 100644 --- a/include/cobalt/uapi/corectl.h +++ b/include/cobalt/uapi/corectl.h @@ -22,12 +22,16 @@ #define _CC_COBALT_GET_NR_PIPES1 #define _CC_COBALT_GET_NR_TIMERS 2 -#define _CC_COBALT_GET_DEBUG 3 -# define _CC_COBALT_DEBUG_ASSERT 1 -# define _CC_COBALT_DEBUG_CONTEXT2 -# define _CC_COBALT_DEBUG_LOCKING4 -# define _CC_COBALT_DEBUG_USER 8 -# define _CC_COBALT_DEBUG_RELAX 16 +#define _CC_COBALT_GET_DEBUG 3 +# define _CC_COBALT_DEBUG_ASSERT 1 +# define _CC_COBALT_DEBUG_CONTEXT2 +# define _CC_COBALT_DEBUG_LOCKING4 +# define _CC_COBALT_DEBUG_USER 8 +# define _CC_COBALT_DEBUG_MUTEX_RELAXED 16 +# define _CC_COBALT_DEBUG_MUTEX_SLEEP32 +# define _CC_COBALT_DEBUG_POSIX_SYNCHRO 64 +# define _CC_COBALT_DEBUG_LEGACY 128 +# define _CC_COBALT_DEBUG_TRACE_RELAX256 #define _CC_COBALT_GET_POLICIES4 # define _CC_COBALT_SCHED_FIFO 1 diff --git a/include/cobalt/uapi/signal.h b/include/cobalt/uapi/signal.h index 53e46ba..b5483d7 100644 --- a/include/cobalt/uapi/signal.h +++ b/include/cobalt/uapi/signal.h @@ -66,7 +66,7 @@ #define SIGDEBUG_WATCHDOG 6 #define SIGDEBUG_RESCNT_IMBALANCE 7 #define SIGDEBUG_LOCK_BREAK8 -#define SIGDEBUG_RESCNT_SLEEP 9 +#define SIGDEBUG_MUTEX_SLEEP 9 #define COBALT_DELAYMAX2147483647U diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig index 27b4a4a..afa62d2 100644 --- a/kernel/cobalt/Kconfig
[Xenomai-git] Jan Kiszka : cobalt/kernel: Rework thread debugging helpers
Module: xenomai-3 Branch: master Commit: e0f8d1b2ba86f0e1cce2e7145abf2a2c05757f7d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e0f8d1b2ba86f0e1cce2e7145abf2a2c05757f7d Author: Jan Kiszka jan.kis...@siemens.com Date: Fri Jun 19 09:55:39 2015 +0200 cobalt/kernel: Rework thread debugging helpers Factor out register/unregister_debugged_thread helpers to have a single point where tasks related to preparing/cleaning up ptraced-base thread debugging can be placed. Put all steps under nklock, which is required anyway for manipulating xnthread::state and fixes a lurking race. The timer lock counter can then be converted into a non-atomic variable. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- include/cobalt/kernel/clock.h |2 +- kernel/cobalt/clock.c |6 +++--- kernel/cobalt/posix/process.c | 35 --- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/include/cobalt/kernel/clock.h b/include/cobalt/kernel/clock.h index 35a07c1..70e1c15 100644 --- a/include/cobalt/kernel/clock.h +++ b/include/cobalt/kernel/clock.h @@ -89,7 +89,7 @@ extern struct xnclock nkclock; extern unsigned long nktimerlat; -extern atomic_t nkclklk; +extern unsigned int nkclock_lock; int xnclock_register(struct xnclock *clock); diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c index 8b8d992..dfaa79e 100644 --- a/kernel/cobalt/clock.c +++ b/kernel/cobalt/clock.c @@ -34,7 +34,7 @@ */ unsigned long nktimerlat; -atomic_t nkclklk; +unsigned int nkclock_lock; static unsigned long long clockfreq; @@ -471,7 +471,7 @@ void print_core_clock_status(struct xnclock *clock, { const char *tm_status, *wd_status = ; - tm_status = atomic_read(nkclklk) 0 ? locked : on; + tm_status = nkclock_lock 0 ? locked : on; #ifdef CONFIG_XENO_OPT_WATCHDOG wd_status = +watchdog; #endif /* CONFIG_XENO_OPT_WATCHDOG */ @@ -715,7 +715,7 @@ void xnclock_tick(struct xnclock *clock) } /* Check for a locked clock state (i.e. ptracing). */ - if (unlikely(atomic_read(nkclklk) 0)) { + if (unlikely(nkclock_lock 0)) { if (timer-status XNTIMER_NOBLCK) goto fire; if (timer-status XNTIMER_PERIODIC) diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c index 6110da6..828e9e5 100644 --- a/kernel/cobalt/posix/process.c +++ b/kernel/cobalt/posix/process.c @@ -984,18 +984,26 @@ static inline void init_hostrt(void) { } #endif /* !CONFIG_XENO_OPT_HOSTRT */ -static inline void lock_timers(void) +/* called with nklock held */ +static void register_debugged_thread(struct xnthread *thread) { - /* We are covered by the core lock: no barriers needed. */ - atomic_inc(nkclklk); + nkclock_lock++; + + xnthread_set_state(thread, XNSSTEP); } -static inline void unlock_timers(void) +static void unregister_debugged_thread(struct xnthread *thread) { - XENO_BUG_ON(COBALT, atomic_read(nkclklk) == 0); - smp_mb__before_atomic(); - atomic_dec(nkclklk); - smp_mb__after_atomic(); + spl_t s; + + xnlock_get_irqsave(nklock, s); + + xnthread_clear_state(thread, XNSSTEP); + + XENO_BUG_ON(COBALT, nkclock_lock == 0); + nkclock_lock--; + + xnlock_put_irqrestore(nklock, s); } static int handle_taskexit_event(struct task_struct *p) /* p == current */ @@ -1014,7 +1022,7 @@ static int handle_taskexit_event(struct task_struct *p) /* p == current */ trace_cobalt_shadow_unmap(thread); if (xnthread_test_state(thread, XNSSTEP)) - unlock_timers(); + unregister_debugged_thread(thread); xnthread_run_handler_stack(thread, exit_thread); /* Waiters will receive EIDRM */ @@ -1093,8 +1101,7 @@ static int handle_schedule_event(struct task_struct *next_task) sigismember(pending, SIGINT)) goto no_ptrace; } - xnthread_clear_state(next, XNSSTEP); - unlock_timers(); + unregister_debugged_thread(next); } no_ptrace: @@ -1146,10 +1153,8 @@ static int handle_sigwake_event(struct task_struct *p) if (sigismember(pending, SIGTRAP) || sigismember(pending, SIGSTOP) - || sigismember(pending, SIGINT)) { - xnthread_set_state(thread, XNSSTEP); - lock_timers(); - } + || sigismember(pending, SIGINT)) + register_debugged_thread(thread); } if (xnthread_test_state(thread, XNRELAX)) { ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Do no install syscall header
Module: xenomai-3 Branch: master Commit: eb2f4b5dcf553aee6b9ddacba3a7b625d5f36482 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=eb2f4b5dcf553aee6b9ddacba3a7b625d5f36482 Author: Jan Kiszka jan.kis...@siemens.com Date: Mon Jul 20 08:00:27 2015 +0200 lib/cobalt: Do no install syscall header Not part of the external API, and the file is unusable anyway due to unfulfilled dependencies. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- include/cobalt/uapi/Makefile.am |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/cobalt/uapi/Makefile.am b/include/cobalt/uapi/Makefile.am index 6adecc0..d887213 100644 --- a/include/cobalt/uapi/Makefile.am +++ b/include/cobalt/uapi/Makefile.am @@ -9,8 +9,10 @@ includesub_HEADERS = \ sched.h \ sem.h \ signal.h\ - syscall.h \ thread.h\ time.h +noinst_HEADERS = \ + syscall.h + SUBDIRS = asm-generic kernel ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : testsuite/xeno-test: accept a keep-going option for smokey
Module: xenomai-3 Branch: master Commit: b20277b93617e613cccf6ea70ba5ba42b8408dc1 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b20277b93617e613cccf6ea70ba5ba42b8408dc1 Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 17 17:39:24 2015 +0200 testsuite/xeno-test: accept a keep-going option for smokey --- testsuite/xeno-test/xeno-test.in | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/testsuite/xeno-test/xeno-test.in b/testsuite/xeno-test/xeno-test.in index 2a985d3..be8506d 100644 --- a/testsuite/xeno-test/xeno-test.in +++ b/testsuite/xeno-test/xeno-test.in @@ -8,12 +8,15 @@ xeno-test -h or xeno-test --help This help text. -xeno-test [ -l load command ] [ -- ] [ latency test options ] +xeno-test [ -k ] [ -l load command ] [ -- ] [ latency test options ] Run a basic test/benchmark of Xenomai on your platform, by first starting a few unit tests, then running the latency test under the load generated by load-command. +This script accepts the -k option to tell the unit test loop to keep +going upon a failing test. Otherwise xeno-test stops immediately. + By default, the load command is dohell 900, which will generate load during 15 minutes. To generate a more realistic load see dohell help. @@ -34,6 +37,12 @@ if [ $1 = -h -o $1 = --help ]; then exit 0 fi +keep_going= +if [ $1 = -k ]; then + keep_going=--keep-going + shift +fi + if [ $1 = -- ]; then shift fi @@ -44,7 +53,7 @@ echo 0 /proc/xenomai/latency || : testdir=@testdir@ -$testdir/smokey --run +$testdir/smokey --run $keep_going $testdir/clocktest -D -T 30 -C CLOCK_HOST_REALTIME || $testdir/clocktest -T 30 $testdir/switchtest -T 30 ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/synch: do not serialize around nop code
Module: xenomai-3 Branch: master Commit: 3d9d71678207ac91f0f2da3c9875fedbb2df917e URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3d9d71678207ac91f0f2da3c9875fedbb2df917e Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 17 16:45:20 2015 +0200 cobalt/synch: do not serialize around nop code --- kernel/cobalt/synch.c |5 + kernel/cobalt/thread.c |3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c index ae4ceef..5b2d839 100644 --- a/kernel/cobalt/synch.c +++ b/kernel/cobalt/synch.c @@ -935,6 +935,9 @@ void xnsynch_detect_claimed_relax(struct xnthread *owner) { struct xnthread *sleeper; struct xnsynch *synch; + spl_t s; + + xnlock_get_irqsave(nklock, s); xnthread_for_each_claimed(synch, owner) { xnsynch_for_each_sleeper(sleeper, synch) { @@ -945,6 +948,8 @@ void xnsynch_detect_claimed_relax(struct xnthread *owner) } } } + + xnlock_put_irqrestore(nklock, s); } #endif /* XENO_DEBUG(MUTEX_RELAXED) */ diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index 7c8cb3a..4cec6e7 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -1989,7 +1989,6 @@ void xnthread_relax(int notify, int reason) struct task_struct *p = current; int cpu __maybe_unused; siginfo_t si; - spl_t s; primary_mode_only(); @@ -2046,9 +2045,7 @@ void xnthread_relax(int notify, int reason) si.si_int = reason | sigdebug_marker; send_sig_info(SIGDEBUG, si, p); } - xnlock_get_irqsave(nklock, s); xnsynch_detect_claimed_relax(thread); - xnlock_put_irqrestore(nklock, s); } /* ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : cobalt/kernel: Mark backtrace syscall as lostage
Module: xenomai-3 Branch: master Commit: bb2a470f35b49ea3862c17e63e1e9ecfeea9b85b URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bb2a470f35b49ea3862c17e63e1e9ecfeea9b85b Author: Jan Kiszka jan.kis...@siemens.com Date: Wed Jul 1 21:18:27 2015 +0200 cobalt/kernel: Mark backtrace syscall as lostage It uses Linux services, thus can't run in primary mode. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/syscall.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c index 61f3008..74b8c18 100644 --- a/kernel/cobalt/posix/syscall.c +++ b/kernel/cobalt/posix/syscall.c @@ -192,7 +192,7 @@ static COBALT_SYSCALL(get_current, current, sizeof(*u_handle)); } -static COBALT_SYSCALL(backtrace, current, +static COBALT_SYSCALL(backtrace, lostage, (int nr, unsigned long __user *u_backtrace, int reason)) { unsigned long backtrace[SIGSHADOW_BACKTRACE_DEPTH]; @@ -799,7 +799,7 @@ static const int cobalt_sysmodes[] = { __COBALT_MODE(trace, current), __COBALT_MODE(get_current, current), __COBALT_MODE(mayday, current), - __COBALT_MODE(backtrace, current), + __COBALT_MODE(backtrace, lostage), __COBALT_MODE(serialdbg, current), __COBALT_MODE(corectl, probing), __COBALT_MODE(fcntl, current), ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/kernel: introduce late machine init handler
Module: xenomai-3 Branch: master Commit: 79fb5178686d75a29dc9a0fc6db136c33f7b958d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=79fb5178686d75a29dc9a0fc6db136c33f7b958d Author: Philippe Gerum r...@xenomai.org Date: Tue Jul 21 15:13:29 2015 +0200 cobalt/kernel: introduce late machine init handler --- kernel/cobalt/arch/arm/machine.c |1 + kernel/cobalt/arch/blackfin/machine.c | 25 ++-- kernel/cobalt/arch/nios2/machine.c |1 + kernel/cobalt/arch/powerpc/machine.c |1 + kernel/cobalt/arch/sh/machine.c|1 + kernel/cobalt/arch/x86/machine.c |1 + .../cobalt/include/asm-generic/xenomai/machine.h |1 + kernel/cobalt/init.c | 12 ++ 8 files changed, 30 insertions(+), 13 deletions(-) diff --git a/kernel/cobalt/arch/arm/machine.c b/kernel/cobalt/arch/arm/machine.c index bb50d2b..f48d4a8 100644 --- a/kernel/cobalt/arch/arm/machine.c +++ b/kernel/cobalt/arch/arm/machine.c @@ -111,6 +111,7 @@ static const char *const fault_labels[] = { struct cobalt_machine cobalt_machine = { .name = arm, .init = NULL, + .late_init = NULL, .cleanup = NULL, .calibrate = mach_arm_calibrate, .prefault = mach_arm_prefault, diff --git a/kernel/cobalt/arch/blackfin/machine.c b/kernel/cobalt/arch/blackfin/machine.c index 8175d9d..b0a70fe 100644 --- a/kernel/cobalt/arch/blackfin/machine.c +++ b/kernel/cobalt/arch/blackfin/machine.c @@ -28,27 +28,25 @@ static unsigned long mach_blackfin_calibrate(void) static void schedule_deferred(void) { + xnsched_run(); +} + +static int mach_blackfin_late_init(void) +{ /* -* We have a small race window which turns out to be -* innocuous, i.e.: +* We hook the rescheduling handler late in the init sequence +* to prevent the race below from happening: * * mach_setup() ... *IRQ/syscall *= irq_tail_hook * = xnsched_run() *... -* xnsys_init() +* xenomai_init() * -* in which case, we would call xnsched_run() for a not yet -* initialized system. However, we would be covered by the -* check for XNSCHED in xnsched_run(), which basically makes -* this call a nop. +* in which case, we would spuriously call xnsched_run() +* before the scheduler slot is initialized. */ - xnsched_run(); -} - -static int mach_blackfin_init(void) -{ __ipipe_irq_tail_hook = (unsigned long)schedule_deferred; return 0; @@ -83,7 +81,8 @@ static const char *const fault_labels[] = { struct cobalt_machine cobalt_machine = { .name = blackfin, - .init = mach_blackfin_init, + .init = NULL, + .late_init = mach_blackfin_late_init, .cleanup = mach_blackfin_cleanup, .calibrate = mach_blackfin_calibrate, .prefault = NULL, diff --git a/kernel/cobalt/arch/nios2/machine.c b/kernel/cobalt/arch/nios2/machine.c index 39f5cc1..1c5b194 100644 --- a/kernel/cobalt/arch/nios2/machine.c +++ b/kernel/cobalt/arch/nios2/machine.c @@ -53,6 +53,7 @@ static const char *const fault_labels[] = { struct cobalt_machine cobalt_machine = { .name = nios2, .init = NULL, + .late_init = NULL, .cleanup = NULL, .calibrate = mach_nios2_calibrate, .prefault = NULL, diff --git a/kernel/cobalt/arch/powerpc/machine.c b/kernel/cobalt/arch/powerpc/machine.c index 62c339c..2e1643a 100644 --- a/kernel/cobalt/arch/powerpc/machine.c +++ b/kernel/cobalt/arch/powerpc/machine.c @@ -65,6 +65,7 @@ static const char *const fault_labels[] = { struct cobalt_machine cobalt_machine = { .name = powerpc, .init = mach_powerpc_init, + .late_init = NULL, .cleanup = NULL, .calibrate = mach_powerpc_calibrate, .prefault = NULL, diff --git a/kernel/cobalt/arch/sh/machine.c b/kernel/cobalt/arch/sh/machine.c index 327632c..f331b9d 100644 --- a/kernel/cobalt/arch/sh/machine.c +++ b/kernel/cobalt/arch/sh/machine.c @@ -52,6 +52,7 @@ static const char *const fault_labels[] = { struct cobalt_machine cobalt_machine = { .name = sh, .init = NULL, + .late_init = NULL, .cleanup = NULL, .calibrate = mach_sh_calibrate, .prefault = NULL, diff --git a/kernel/cobalt/arch/x86/machine.c b/kernel/cobalt/arch/x86/machine.c index 67a3729..4ca5cd8 100644 --- a/kernel/cobalt/arch/x86/machine.c +++ b/kernel/cobalt/arch/x86/machine.c @@ -184,6 +184,7 @@ static const char *const fault_labels[] = { struct cobalt_machine cobalt_machine = { .name = x86, .init = mach_x86_init, + .late_init = NULL, .cleanup = mach_x86_cleanup, .calibrate = mach_x86_calibrate, .prefault = NULL, diff --git
[Xenomai-git] Jan Kiszka : cobalt/kernel: Print suspension mask as hex in traces
Module: xenomai-3 Branch: master Commit: db6ea6686d449959feadf9ab47281dd24ad561b8 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=db6ea6686d449959feadf9ab47281dd24ad561b8 Author: Jan Kiszka jan.kis...@siemens.com Date: Mon Jun 29 09:39:33 2015 +0200 cobalt/kernel: Print suspension mask as hex in traces Aligns cobalt_thread_suspend with cobalt_thread_resume and makes traces easier readable. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/trace/cobalt-core.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cobalt/trace/cobalt-core.h b/kernel/cobalt/trace/cobalt-core.h index dc23588..ee20b7c 100644 --- a/kernel/cobalt/trace/cobalt-core.h +++ b/kernel/cobalt/trace/cobalt-core.h @@ -251,7 +251,7 @@ TRACE_EVENT(cobalt_thread_suspend, __entry-wchan = wchan; ), - TP_printk(thread=%p mask=%lu timeout=%Lu timeout_mode=%d wchan=%p, + TP_printk(thread=%p mask=0x%lx timeout=%Lu timeout_mode=%d wchan=%p, __entry-thread, __entry-mask, __entry-timeout, __entry-timeout_mode, __entry-wchan) ); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : doc: prebuild
Module: xenomai-3 Branch: master Commit: 41c02ebccc4afadfa1d5c85e8ea4e8ce0ffb17a4 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=41c02ebccc4afadfa1d5c85e8ea4e8ce0ffb17a4 Author: Philippe Gerum r...@xenomai.org Date: Sun Jul 26 18:25:19 2015 +0200 doc: prebuild --- doc/asciidoc/MIGRATION.adoc| 21 +- doc/asciidoc/README.INSTALL.adoc |5 - doc/asciidoc/TROUBLESHOOTING.COBALT.adoc |4 + doc/prebuilt/html/MIGRATION/index.html | 24 +- doc/prebuilt/html/README.APPLICATIONS/index.html |2 +- doc/prebuilt/html/README.INSTALL/index.html|5 +- .../html/TROUBLESHOOTING.COBALT/index.html | 38 +- .../html/TROUBLESHOOTING.MERCURY/index.html|2 +- doc/prebuilt/html/man1/autotune/index.html |2 +- doc/prebuilt/html/man1/xeno-config/index.html |2 +- .../html/xeno3prm/16550A__io_8h_source.html|2 +- .../html/xeno3prm/16550A__pci_8h_source.html |4 +- .../html/xeno3prm/16550A__pnp_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/8255_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/af__inet_8h_source.html |2 +- .../html/xeno3prm/alchemy_2compat_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/analogy_2driver_8h.html |2 +- .../html/xeno3prm/analogy_2driver_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/analogy_8h.html |2 +- doc/prebuilt/html/xeno3prm/analogy_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/annotated.html |2 +- doc/prebuilt/html/xeno3prm/apc_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/api-tags.html |2 +- ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +- ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +- ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +- ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +- ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +- ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +- ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +- ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +- ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +- ...include_2asm_2xenomai_2syscall32_8h_source.html |2 +- ..._2include_2asm_2xenomai_2machine_8h_source.html |2 +- ...include_2asm_2xenomai_2syscall32_8h_source.html | 14 +- ...m_2include_2asm_2xenomai_2fptest_8h_source.html |2 +- ...lude_2asm_2xenomai_2uapi_2fptest_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/arp_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/assert_8h_source.html | 21 +- doc/prebuilt/html/xeno3prm/async_8c.html |4 +- doc/prebuilt/html/xeno3prm/async_8c__incl.map | 42 +- doc/prebuilt/html/xeno3prm/async_8c__incl.md5 |2 +- doc/prebuilt/html/xeno3prm/async_8c__incl.png | Bin 96323 - 117906 bytes doc/prebuilt/html/xeno3prm/atomic_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/bheap_8h_source.html|2 +- ...n_2include_2asm_2xenomai_2fptest_8h_source.html |2 +- ...lude_2asm_2xenomai_2uapi_2fptest_8h_source.html |2 +- .../boilerplate_2ancillaries_8h_source.html| 16 +- .../html/xeno3prm/boilerplate_2list_8h_source.html |2 +- .../html/xeno3prm/boilerplate_2lock_8h_source.html |2 +- .../html/xeno3prm/boilerplate_2time_8h_source.html |2 +- .../xeno3prm/boilerplate_2tunables_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/bufd_8h_source.html |2 +- .../html/xeno3prm/bufp-label_8c-example.html |6 +- .../html/xeno3prm/bufp-readwrite_8c-example.html |6 +- doc/prebuilt/html/xeno3prm/c1e_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/calibration_8c.html |2 +- doc/prebuilt/html/xeno3prm/can-rtt_8c-example.html |4 +- doc/prebuilt/html/xeno3prm/channel__range_8h.html |2 +- .../html/xeno3prm/channel__range_8h_source.html|2 +- doc/prebuilt/html/xeno3prm/classes.html|2 +- doc/prebuilt/html/xeno3prm/clockobj_8h_source.html |2 +- doc/prebuilt/html/xeno3prm/cluster_8h_source.html | 296 +++-- .../html/xeno3prm/cobalt-core_8h_source.html |8 +- .../html/xeno3prm/cobalt-posix_8h_source.html |2 +- .../html/xeno3prm/cobalt-rtdm_8h_source.html |2 +- .../cobalt_2boilerplate_2limits_8h_source.html |2 +- .../cobalt_2boilerplate_2trace_8h_source.html |2 +- .../cobalt_2kernel_2ancillaries_8h_source.html |2 +- .../xeno3prm/cobalt_2kernel_2compat_8h_source.html |6 +- .../xeno3prm/cobalt_2kernel_2init_8h_source.html |2 +- .../xeno3prm/cobalt_2kernel_2list_8h_source.html |2 +- .../xeno3prm/cobalt_2kernel_2lock_8h_source.html |2 +- .../cobalt_2kernel_2registry_8h_source.html|2 +- .../cobalt_2kernel_2rtdm_2autotune_8h_source.html |2 +- .../cobalt_2kernel_2rtdm_2can_8h_source.html
[Xenomai-git] Jan Kiszka : cobalt/kernel: Set commas in syscall tables inside the macros
Module: xenomai-3 Branch: master Commit: b58a8b9f0567c975a90e322538d0c11f8e823ebf URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b58a8b9f0567c975a90e322538d0c11f8e823ebf Author: Jan Kiszka jan.kis...@siemens.com Date: Thu Jul 16 18:41:51 2015 +0200 cobalt/kernel: Set commas in syscall tables inside the macros This enables automatic table generations as it makes removes the need to set or leave out commas from the table definition. The cobalt_sysmodes table does not strictly require the conversion but is changed as well to remain consistent. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- .../arch/x86/include/asm/xenomai/syscall32.h | 12 +- kernel/cobalt/posix/syscall.c | 391 ++-- 2 files changed, 201 insertions(+), 202 deletions(-) diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h index 8bd40d4..58b7336 100644 --- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h @@ -45,14 +45,14 @@ #define __syshand32x__(__name) ((cobalt_syshand)(cobalt32x_ ## __name)) #define __COBALT_CALL32x_INITHAND(__handler) \ - , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler + [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler, #define __COBALT_CALL32x_INITMODE(__mode) \ - , [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode + [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode, /* x32 default entry (no thunk) */ #define __COBALT_CALL32x_ENTRY(__name, __handler) \ - , [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler + [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler, /* x32 thunk installation */ #define __COBALT_CALL32x_pure_THUNK(__name)\ @@ -113,14 +113,14 @@ #define __syshand32emu__(__name) ((cobalt_syshand)(cobalt32emu_ ## __name)) #define __COBALT_CALL32emu_INITHAND(__handler) \ - , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler + [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler, #define __COBALT_CALL32emu_INITMODE(__mode)\ - , [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode + [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode, /* ia32 default entry (no thunk) */ #define __COBALT_CALL32emu_ENTRY(__name, __handler)\ - , [sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler + [sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler, /* ia32 thunk installation */ #define __COBALT_CALL32emu_THUNK(__name) \ diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c index 2d7ab1e..9677f41 100644 --- a/kernel/cobalt/posix/syscall.c +++ b/kernel/cobalt/posix/syscall.c @@ -590,224 +590,223 @@ static int cobalt_ni(void) #define __COBALT_NI__syshand__(ni) #define __COBALT_CALL_NI \ - [0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI\ + [0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI, \ __COBALT_CALL32_INITHAND(__COBALT_NI) #define __COBALT_CALL_NFLAGS \ - [0 ... __NR_COBALT_SYSCALLS-1] = 0 \ + [0 ... __NR_COBALT_SYSCALLS-1] = 0, \ __COBALT_CALL32_INITMODE(0) #define __COBALT_CALL_ENTRY(__name)\ - [sc_cobalt_ ## __name] = __syshand__(__name)\ + [sc_cobalt_ ## __name] = __syshand__(__name), \ __COBALT_CALL32_ENTRY(__name, __syshand__(__name)) #define __COBALT_MODE(__name, __mode) \ - [sc_cobalt_ ## __name] = __xn_exec_##__mode + [sc_cobalt_ ## __name] = __xn_exec_##__mode, #ifdef CONFIG_XENO_ARCH_SYS3264 #include syscall32.h #endif static const cobalt_syshand cobalt_syscalls[] = { - __COBALT_CALL_NI, - __COBALT_CALL_ENTRY(thread_create), - __COBALT_CALL_ENTRY(thread_getpid), - __COBALT_CALL_ENTRY(thread_setschedparam_ex), - __COBALT_CALL_ENTRY(thread_getschedparam_ex), - __COBALT_CALL_ENTRY(sched_weightprio), - __COBALT_CALL_ENTRY(sched_yield), - __COBALT_CALL_ENTRY(thread_setmode), - __COBALT_CALL_ENTRY(thread_setname), - __COBALT_CALL_ENTRY(thread_kill), - __COBALT_CALL_ENTRY(thread_getstat), - __COBALT_CALL_ENTRY(thread_join), - __COBALT_CALL_ENTRY(sem_init), - __COBALT_CALL_ENTRY(sem_destroy), - __COBALT_CALL_ENTRY(sem_post), - __COBALT_CALL_ENTRY(sem_wait), - __COBALT_CALL_ENTRY(sem_timedwait), - __COBALT_CALL_ENTRY(sem_trywait), - __COBALT_CALL_ENTRY(sem_getvalue), - __COBALT_CALL_ENTRY(sem_open), - __COBALT_CALL_ENTRY(sem_close), - __COBALT_CALL_ENTRY(sem_unlink), -
[Xenomai-git] Jan Kiszka : cobalt/posix/sem: Do not register named semaphores with process resources
Module: xenomai-3 Branch: master Commit: 1853acec4d2a790d47c8f1abebcec8eabb6fa9dc URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1853acec4d2a790d47c8f1abebcec8eabb6fa9dc Author: Jan Kiszka jan.kis...@siemens.com Date: Tue Jun 30 20:26:08 2015 +0200 cobalt/posix/sem: Do not register named semaphores with process resources Named semaphores are reclaimed via their own mechanism. Having them registered also as process-local resource will cause their destruction on process termination if no other process holds a reference. This is not conforming to the specification, and the smokey leaks tests fails due to this right now. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/sem.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c index 08c4cc3..1c47f2a 100644 --- a/kernel/cobalt/posix/sem.c +++ b/kernel/cobalt/posix/sem.c @@ -50,7 +50,8 @@ int __cobalt_sem_destroy(xnhandle_t handle) cobalt_mark_deleted(sem); xnregistry_remove(sem-resnode.handle); - cobalt_del_resource(sem-resnode); + if (!sem-pathname) + cobalt_del_resource(sem-resnode); if (xnsynch_destroy(sem-synchbase) == XNSYNCH_RESCHED) { xnsched_run(); ret = 1; @@ -106,9 +107,8 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sm, xnlock_get_irqsave(nklock, s); semq = cobalt_current_resources(pshared)-semq; - if (!list_empty(semq) - (sm-magic == COBALT_SEM_MAGIC || -sm-magic == COBALT_NAMED_SEM_MAGIC)) { + if ((sm-magic == COBALT_SEM_MAGIC !list_empty(semq)) || + sm-magic == COBALT_NAMED_SEM_MAGIC) { osem = xnregistry_lookup(sm-handle, NULL); if (cobalt_obj_active(osem, COBALT_SEM_MAGIC, typeof(*osem))) { ret = -EBUSY; @@ -126,7 +126,10 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sm, goto err_lock_put; sem-magic = COBALT_SEM_MAGIC; - cobalt_add_resource(sem-resnode, sem, pshared); + if (!name) + cobalt_add_resource(sem-resnode, sem, pshared); + else + sem-resnode.scope = NULL; sflags = flags SEM_FIFO ? 0 : XNSYNCH_PRIO; xnsynch_init(sem-synchbase, sflags, NULL); @@ -178,7 +181,7 @@ static int sem_destroy(struct cobalt_sem_shadow *sm) goto error; } - if (sem_kqueue(sem) != sem-resnode.scope) { + if (sem-resnode.scope sem_kqueue(sem) != sem-resnode.scope) { ret = -EPERM; goto error; } @@ -210,7 +213,7 @@ static inline int sem_trywait_inner(struct cobalt_sem *sem) return -EINVAL; if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_POSIX_SYNCHRO) - sem-resnode.scope != sem_kqueue(sem)) + sem-resnode.scope sem-resnode.scope != sem_kqueue(sem)) return -EPERM; if (atomic_sub_return(1, sem-state-value) 0) @@ -385,7 +388,7 @@ static int sem_getvalue(xnhandle_t handle, int *value) return -EINVAL; } - if (sem-resnode.scope != sem_kqueue(sem)) { + if (sem-resnode.scope sem-resnode.scope != sem_kqueue(sem)) { xnlock_put_irqrestore(nklock, s); return -EPERM; } ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/thread, copperplate: fetch per-thread user window from the global heap
Module: xenomai-3 Branch: master Commit: 81958c620029485f3533b72f42b31ffb05eae234 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=81958c620029485f3533b72f42b31ffb05eae234 Author: Philippe Gerum r...@xenomai.org Date: Thu Jul 16 21:24:33 2015 +0200 cobalt/thread, copperplate: fetch per-thread user window from the global heap The shared multi-processing mode requires user windows to be accessible from threads living in remote processes for signaling monitors. Therefore, the kernel memory this window is allocated from must belong to the global heap, instead of the per-process, private heap. --- include/cobalt/kernel/thread.h |6 +- include/copperplate/threadobj.h | 24 +++- kernel/cobalt/posix/process.c | 10 +- lib/cobalt/current.c|4 ++-- lib/copperplate/syncobj.c |3 ++- lib/copperplate/threadobj.c | 25 +++-- 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h index 1ba0c1b..2a06fd2 100644 --- a/include/cobalt/kernel/thread.h +++ b/include/cobalt/kernel/thread.h @@ -176,7 +176,11 @@ struct xnthread { void (*entry)(void *cookie); /* Thread entry routine */ void *cookie; /* Cookie to pass to the entry routine */ - struct xnthread_user_window *u_window; /* Data visible from userland. */ + /** +* Thread data visible from userland through a window on the +* global heap. +*/ + struct xnthread_user_window *u_window; struct xnthread_personality *personality; diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h index aa2c201..2ec0289 100644 --- a/include/copperplate/threadobj.h +++ b/include/copperplate/threadobj.h @@ -39,7 +39,14 @@ struct xnthread_user_window; struct threadobj_corespec { xnhandle_t handle; - struct xnthread_user_window *u_window; + union { + struct { + __u32 u_winoff; + } shrd; + struct { + struct xnthread_user_window *u_window; + } priv; + }; }; struct threadobj_stat { @@ -75,6 +82,21 @@ void threadobj_save_timeout(struct threadobj_corespec *corespec, */ } +#ifdef CONFIG_XENO_PSHARED + +struct xnthread_user_window * +threadobj_get_window(struct threadobj_corespec *corespec); + +#else /* !CONFIG_XENO_PSHARED */ + +static inline struct xnthread_user_window * +threadobj_get_window(struct threadobj_corespec *corespec) +{ + return corespec-priv.u_window; +} + +#endif /* !CONFIG_XENO_PSHARED */ + #else /* CONFIG_XENO_MERCURY */ #include sys/time.h diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c index 828e9e5..1d2309d 100644 --- a/kernel/cobalt/posix/process.c +++ b/kernel/cobalt/posix/process.c @@ -614,7 +614,7 @@ static inline int disable_ondemand_memory(void) * initialized by a call to xnthread_init(). * * @param u_winoff will receive the offset of the per-thread - * u_window structure in the process shared heap associated to @a + * u_window structure in the global heap associated to @a * thread. This structure reflects thread state information visible * from userland through a shared memory window. * @@ -649,8 +649,7 @@ int cobalt_map_user(struct xnthread *thread, __u32 __user *u_winoff) if (ret) return ret; - sys_ppd = cobalt_ppd_get(0); - umm = sys_ppd-umm; + umm = cobalt_kernel_ppd.umm; u_window = cobalt_umm_alloc(umm, sizeof(*u_window)); if (u_window == NULL) return -ENOMEM; @@ -672,6 +671,7 @@ int cobalt_map_user(struct xnthread *thread, __u32 __user *u_winoff) init_uthread_info(thread); xnthread_set_state(thread, XNMAPPED); xndebug_shadow_init(thread); + sys_ppd = cobalt_ppd_get(0); atomic_inc(sys_ppd-refcnt); /* * -map_thread() handler is invoked after the TCB is fully @@ -1030,9 +1030,9 @@ static int handle_taskexit_event(struct task_struct *p) /* p == current */ xnsched_run(); if (xnthread_test_state(thread, XNUSER)) { - sys_ppd = cobalt_ppd_get(0); - cobalt_umm_free(sys_ppd-umm, thread-u_window); + cobalt_umm_free(cobalt_kernel_ppd.umm, thread-u_window); thread-u_window = NULL; + sys_ppd = cobalt_ppd_get(0); if (atomic_dec_and_test(sys_ppd-refcnt)) remove_process(cobalt_current_process()); } diff --git a/lib/cobalt/current.c b/lib/cobalt/current.c index 06888b0..a085456 100644 --- a/lib/cobalt/current.c +++ b/lib/cobalt/current.c @@ -39,7 +39,7 @@ static inline void __cobalt_set_tsd(xnhandle_t current, __u32 u_winoff) struct xnthread_user_window *window; cobalt_current = current; - window =
[Xenomai-git] Philippe Gerum : cobalt/synch: test information bits as returned by xnsynch_sleep_on() only
Module: xenomai-3 Branch: master Commit: a7549ffa1b3412f6b84c9550256bcb2c074727ef URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a7549ffa1b3412f6b84c9550256bcb2c074727ef Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 17 16:54:47 2015 +0200 cobalt/synch: test information bits as returned by xnsynch_sleep_on() only For consistency with xnsynch_acquire(), callers of xnsynch_sleep_on() MUST retrieve the information bits from the return value, instead of peeking into the current thread's TCB. --- kernel/cobalt/posix/cond.c | 14 +++--- kernel/cobalt/rtdm/drvlib.c | 38 ++ kernel/cobalt/synch.c |2 +- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c index 502df5d..7e115cf 100644 --- a/kernel/cobalt/posix/cond.c +++ b/kernel/cobalt/posix/cond.c @@ -125,8 +125,8 @@ static inline int cobalt_cond_timedwait_prologue(struct xnthread *cur, struct cobalt_mutex *mutex, xnticks_t abs_to) { + int err, ret; spl_t s; - int err; xnlock_get_irqsave(nklock, s); @@ -166,10 +166,10 @@ static inline int cobalt_cond_timedwait_prologue(struct xnthread *cur, /* Wait for another thread to signal the condition. */ if (abs_to != XN_INFINITE) - xnsynch_sleep_on(cond-synchbase, abs_to, -clock_flag(TIMER_ABSTIME, cond-attr.clock)); + ret = xnsynch_sleep_on(cond-synchbase, abs_to, + clock_flag(TIMER_ABSTIME, cond-attr.clock)); else - xnsynch_sleep_on(cond-synchbase, XN_INFINITE, XN_RELATIVE); + ret = xnsynch_sleep_on(cond-synchbase, XN_INFINITE, XN_RELATIVE); /* There are three possible wakeup conditions : - cond_signal / cond_broadcast, no status bit is set, and the function @@ -185,12 +185,12 @@ static inline int cobalt_cond_timedwait_prologue(struct xnthread *cur, err = 0; - if (xnthread_test_info(cur, XNBREAK)) + if (ret XNBREAK) err = -EINTR; - else if (xnthread_test_info(cur, XNTIMEO)) + else if (ret XNTIMEO) err = -ETIMEDOUT; - unlock_and_return: +unlock_and_return: xnlock_put_irqrestore(nklock, s); return err; diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c index 6c4bc0d..ca46531 100644 --- a/kernel/cobalt/rtdm/drvlib.c +++ b/kernel/cobalt/rtdm/drvlib.c @@ -769,8 +769,8 @@ int rtdm_event_timedwait(rtdm_event_t *event, nanosecs_rel_t timeout, rtdm_toseq_t *timeout_seq) { struct xnthread *thread; + int err = 0, ret; spl_t s; - int err = 0; if (!XENO_ASSERT(COBALT, !xnsched_unblockable_p())) return -EPERM; @@ -793,23 +793,21 @@ int rtdm_event_timedwait(rtdm_event_t *event, nanosecs_rel_t timeout, thread = xnthread_current(); - if (timeout_seq (timeout 0)) { + if (timeout_seq (timeout 0)) /* timeout sequence */ - xnsynch_sleep_on(event-synch_base, *timeout_seq, -XN_ABSOLUTE); - } else { + ret = xnsynch_sleep_on(event-synch_base, *timeout_seq, + XN_ABSOLUTE); + else /* infinite or relative timeout */ - xnsynch_sleep_on(event-synch_base, timeout, XN_RELATIVE); - } + ret = xnsynch_sleep_on(event-synch_base, timeout, XN_RELATIVE); - if (likely - (!xnthread_test_info(thread, XNTIMEO | XNRMID | XNBREAK))) { + if (likely(ret == 0)) { xnsynch_clear_status(event-synch_base, RTDM_EVENT_PENDING); xnselect_signal(event-select_block, 0); - } else if (xnthread_test_info(thread, XNTIMEO)) + } else if (ret XNTIMEO) err = -ETIMEDOUT; - else if (xnthread_test_info(thread, XNRMID)) + else if (ret XNRMID) err = -EIDRM; else /* XNBREAK */ err = -EINTR; @@ -1004,8 +1002,8 @@ int rtdm_sem_timeddown(rtdm_sem_t *sem, nanosecs_rel_t timeout, rtdm_toseq_t *timeout_seq) { struct xnthread *thread; + int err = 0, ret; spl_t s; - int err = 0; if (!XENO_ASSERT(COBALT, !xnsched_unblockable_p())) return -EPERM; @@ -1024,18 +1022,18 @@ int rtdm_sem_timeddown(rtdm_sem_t *sem, nanosecs_rel_t timeout, else { thread =
[Xenomai-git] Philippe Gerum : lib/cobalt: enable application built with large file support
Module: xenomai-3 Branch: master Commit: 19793e695cc39bcd9d442a5c86c4114231eab6f0 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=19793e695cc39bcd9d442a5c86c4114231eab6f0 Author: Philippe Gerum r...@xenomai.org Date: Fri Jul 24 09:51:22 2015 +0200 lib/cobalt: enable application built with large file support i.e. provide support for applications turning on -D_FILE_OFFSET_BITS=64. --- include/cobalt/fcntl.h |2 ++ include/cobalt/kernel/compat.h |2 +- include/cobalt/mqueue.h|2 -- include/cobalt/sys/mman.h |4 include/rtdm/rtdm.h|5 +++-- include/rtdm/uapi/rtdm.h |2 +- lib/cobalt/cobalt.wrappers |2 ++ lib/cobalt/rtdm.c | 45 +--- lib/cobalt/wrappers.c | 31 +++ 9 files changed, 78 insertions(+), 17 deletions(-) diff --git a/include/cobalt/fcntl.h b/include/cobalt/fcntl.h index 2a83a7a..d549893 100644 --- a/include/cobalt/fcntl.h +++ b/include/cobalt/fcntl.h @@ -29,6 +29,8 @@ extern C { COBALT_DECL(int, open(const char *path, int oflag, ...)); +COBALT_DECL(int, open64(const char *path, int oflag, ...)); + COBALT_DECL(int, fcntl(int fd, int cmd, ...)); #ifdef __cplusplus diff --git a/include/cobalt/kernel/compat.h b/include/cobalt/kernel/compat.h index 6304a85..7420804 100644 --- a/include/cobalt/kernel/compat.h +++ b/include/cobalt/kernel/compat.h @@ -78,8 +78,8 @@ typedef struct { } compat_fd_set; struct compat_rtdm_mmap_request { + u64 offset; compat_size_t length; - compat_off_t offset; int prot; int flags; }; diff --git a/include/cobalt/mqueue.h b/include/cobalt/mqueue.h index b335623..496632d 100644 --- a/include/cobalt/mqueue.h +++ b/include/cobalt/mqueue.h @@ -27,8 +27,6 @@ extern C { #endif -COBALT_DECL(int, open(const char *path, int oflag, ...)); - COBALT_DECL(mqd_t, mq_open(const char *name, int oflags, ...)); diff --git a/include/cobalt/sys/mman.h b/include/cobalt/sys/mman.h index f1cd704..1c4 100644 --- a/include/cobalt/sys/mman.h +++ b/include/cobalt/sys/mman.h @@ -21,6 +21,7 @@ #ifndef _COBALT_SYS_MMAN_H #define _COBALT_SYS_MMAN_H +#include sys/types.h #include cobalt/wrappers.h #ifdef __cplusplus @@ -30,6 +31,9 @@ extern C { COBALT_DECL(void *, mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)); +COBALT_DECL(void *, mmap64(void *addr, size_t length, int prot, int flags, + int fd, off64_t offset)); + #ifdef __cplusplus } #endif diff --git a/include/rtdm/rtdm.h b/include/rtdm/rtdm.h index dab4bf9..01f07fe 100644 --- a/include/rtdm/rtdm.h +++ b/include/rtdm/rtdm.h @@ -20,13 +20,14 @@ #ifndef _RTDM_RTDM_H #define _RTDM_RTDM_H +#include linux/types.h +#include sys/ioctl.h +#include sys/socket.h #include fcntl.h #include stddef.h #include stdint.h #include errno.h #include unistd.h -#include sys/ioctl.h -#include sys/socket.h #include boilerplate/wrappers.h /** diff --git a/include/rtdm/uapi/rtdm.h b/include/rtdm/uapi/rtdm.h index 2faa14f..eed3b36 100644 --- a/include/rtdm/uapi/rtdm.h +++ b/include/rtdm/uapi/rtdm.h @@ -197,8 +197,8 @@ struct _rtdm_setsockaddr_args { /* Internally used for mmap() */ struct _rtdm_mmap_request { + __u64 offset; size_t length; - off_t offset; int prot; int flags; }; diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index e66b9c1..4968340 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -47,6 +47,7 @@ --wrap mq_timedreceive --wrap mq_notify --wrap open +--wrap open64 --wrap socket --wrap close --wrap ioctl @@ -105,5 +106,6 @@ --wrap kill --wrap sleep --wrap mmap +--wrap mmap64 --wrap time --wrap fcntl diff --git a/lib/cobalt/rtdm.c b/lib/cobalt/rtdm.c index 4e1e24e..aced887 100644 --- a/lib/cobalt/rtdm.c +++ b/lib/cobalt/rtdm.c @@ -39,10 +39,9 @@ static inline int set_errno(int ret) return -1; } -COBALT_IMPL(int, open, (const char *path, int oflag, ...)) +static int do_open(const char *path, int oflag, mode_t mode) { int fd, oldtype; - va_list ap; /* * Don't dereference path, as it might be invalid. Leave it to @@ -55,12 +54,38 @@ COBALT_IMPL(int, open, (const char *path, int oflag, ...)) if (fd != -ENODEV fd != -ENOSYS) return set_errno(fd); + fd = __STD(open(path, oflag, mode)); + } + + return fd; +} + +COBALT_IMPL(int, open, (const char *path, int oflag, ...)) +{ + mode_t mode = 0; + va_list ap; + + if (oflag O_CREAT) { va_start(ap, oflag); - fd = __STD(open(path, oflag, va_arg(ap, mode_t))); + mode = va_arg(ap, int); va_end(ap); } - return fd; + return do_open(path,
[Xenomai-git] Jan Kiszka : cobalt/kernel: Generate cobalt_syscalls and cobalt_sysmodes
Module: xenomai-3 Branch: master Commit: a9c523592e7d96ccf6bdc99df4e1cacf99f3b795 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a9c523592e7d96ccf6bdc99df4e1cacf99f3b795 Author: Jan Kiszka jan.kis...@siemens.com Date: Thu Jul 2 22:22:13 2015 +0200 cobalt/kernel: Generate cobalt_syscalls and cobalt_sysmodes Avoid that information has to be provided multiple times, specifically the sensitive syscall modes. For that purpose, both entry points and modes are picked up by a script from COBALT_SYSCALL macros in all kernel/cobalt/posix/*.c files. These are translated into entries for both tables and filled into a generated header. syscall.c can then include the header and use the accumulating macros __COBALT_CALL_ENTRIES and __COBALT_CALL_MODES in its table definitions. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/Makefile | 12 ++ kernel/cobalt/posix/gen-syscall-entries.sh | 32 + kernel/cobalt/posix/syscall.c | 194 +--- scripts/prepare-kernel.sh |4 +- 4 files changed, 50 insertions(+), 192 deletions(-) diff --git a/kernel/cobalt/posix/Makefile b/kernel/cobalt/posix/Makefile index 3049be4..2da764a 100644 --- a/kernel/cobalt/posix/Makefile +++ b/kernel/cobalt/posix/Makefile @@ -22,4 +22,16 @@ xenomai-y := \ timer.o \ timerfd.o +syscall_entries := $(srctree)/$(src)/gen-syscall-entries.sh + +quiet_cmd_syscall_entries = GEN $@ + cmd_syscall_entries = $(CONFIG_SHELL) '$(syscall_entries)' $^ $@ + +$(obj)/syscall_entries.h: $(syscall_entries) $(wildcard $(srctree)/$(src)/*.c) + $(call if_changed,syscall_entries) + +target += syscall_entries.h + +$(obj)/syscall.o: $(obj)/syscall_entries.h + xenomai-$(CONFIG_XENO_ARCH_SYS3264) += compat.o syscall32.o diff --git a/kernel/cobalt/posix/gen-syscall-entries.sh b/kernel/cobalt/posix/gen-syscall-entries.sh new file mode 100755 index 000..0f99fff --- /dev/null +++ b/kernel/cobalt/posix/gen-syscall-entries.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +set -e + +shift + +awk ' +match($0, /COBALT_SYSCALL\([^,]*,[ \t]*[^,]*/) { + str=substr($0, RSTART + 15, RLENGTH - 15) + match(str, /[^, \t]*/) + syscall=substr(str, RSTART, RLENGTH) + + if (syscall == ) { + print Failed to find syscall name in line $0 /dev/stderr + exit 1 + } + + calls = calls __COBALT_CALL_ENTRY( syscall ) \\\n + modes = modes __COBALT_MODE( str ) \\\n + next +} + +/COBALT_SYSCALL\(/ { + print Failed to parse line $0 /dev/stderr + exit 1 +} + +END { + print #define __COBALT_CALL_ENTRIES \\\n calls /* end */ + print #define __COBALT_CALL_MODES \\\n modes /* end */ +} +' $* diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c index 9677f41..a128dea 100644 --- a/kernel/cobalt/posix/syscall.c +++ b/kernel/cobalt/posix/syscall.c @@ -608,103 +608,11 @@ static int cobalt_ni(void) #include syscall32.h #endif +#include syscall_entries.h + static const cobalt_syshand cobalt_syscalls[] = { __COBALT_CALL_NI - __COBALT_CALL_ENTRY(thread_create) - __COBALT_CALL_ENTRY(thread_getpid) - __COBALT_CALL_ENTRY(thread_setschedparam_ex) - __COBALT_CALL_ENTRY(thread_getschedparam_ex) - __COBALT_CALL_ENTRY(sched_weightprio) - __COBALT_CALL_ENTRY(sched_yield) - __COBALT_CALL_ENTRY(thread_setmode) - __COBALT_CALL_ENTRY(thread_setname) - __COBALT_CALL_ENTRY(thread_kill) - __COBALT_CALL_ENTRY(thread_getstat) - __COBALT_CALL_ENTRY(thread_join) - __COBALT_CALL_ENTRY(sem_init) - __COBALT_CALL_ENTRY(sem_destroy) - __COBALT_CALL_ENTRY(sem_post) - __COBALT_CALL_ENTRY(sem_wait) - __COBALT_CALL_ENTRY(sem_timedwait) - __COBALT_CALL_ENTRY(sem_trywait) - __COBALT_CALL_ENTRY(sem_getvalue) - __COBALT_CALL_ENTRY(sem_open) - __COBALT_CALL_ENTRY(sem_close) - __COBALT_CALL_ENTRY(sem_unlink) - __COBALT_CALL_ENTRY(sem_broadcast_np) - __COBALT_CALL_ENTRY(sem_inquire) - __COBALT_CALL_ENTRY(clock_getres) - __COBALT_CALL_ENTRY(clock_gettime) - __COBALT_CALL_ENTRY(clock_settime) - __COBALT_CALL_ENTRY(clock_nanosleep) - __COBALT_CALL_ENTRY(mutex_init) - __COBALT_CALL_ENTRY(mutex_check_init) - __COBALT_CALL_ENTRY(mutex_destroy) - __COBALT_CALL_ENTRY(mutex_lock) - __COBALT_CALL_ENTRY(mutex_timedlock) - __COBALT_CALL_ENTRY(mutex_trylock) - __COBALT_CALL_ENTRY(mutex_unlock) - __COBALT_CALL_ENTRY(cond_init) - __COBALT_CALL_ENTRY(cond_destroy) - __COBALT_CALL_ENTRY(cond_wait_prologue) - __COBALT_CALL_ENTRY(cond_wait_epilogue) - __COBALT_CALL_ENTRY(mq_open) - __COBALT_CALL_ENTRY(mq_close) - __COBALT_CALL_ENTRY(mq_unlink) - __COBALT_CALL_ENTRY(mq_getattr) - __COBALT_CALL_ENTRY(mq_timedsend)
[Xenomai-git] Philippe Gerum : copperplate/threadobj: inline window accessor (cobalt)
Module: xenomai-3 Branch: master Commit: 586b20042dcee4df5bbd78382f40b8732591460a URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=586b20042dcee4df5bbd78382f40b8732591460a Author: Philippe Gerum r...@xenomai.org Date: Sat Jul 18 10:39:52 2015 +0200 copperplate/threadobj: inline window accessor (cobalt) --- include/copperplate/threadobj.h |8 ++-- lib/copperplate/threadobj.c |6 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h index 2ec0289..38835f4 100644 --- a/include/copperplate/threadobj.h +++ b/include/copperplate/threadobj.h @@ -84,8 +84,12 @@ void threadobj_save_timeout(struct threadobj_corespec *corespec, #ifdef CONFIG_XENO_PSHARED -struct xnthread_user_window * -threadobj_get_window(struct threadobj_corespec *corespec); +static inline struct xnthread_user_window * +threadobj_get_window(struct threadobj_corespec *corespec) +{ + extern void *cobalt_umm_shared; + return cobalt_umm_shared + corespec-shrd.u_winoff; +} #else /* !CONFIG_XENO_PSHARED */ diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c index 335c9f8..47b3762 100644 --- a/lib/copperplate/threadobj.c +++ b/lib/copperplate/threadobj.c @@ -259,12 +259,6 @@ static inline int threadobj_setup_corespec(struct threadobj *thobj) return 0; } -struct xnthread_user_window * -threadobj_get_window(struct threadobj_corespec *corespec) -{ - return cobalt_umm_shared + corespec-shrd.u_winoff; -} - #else /* !CONFIG_XENO_PSHARED */ static inline int threadobj_setup_corespec(struct threadobj *thobj) ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : cobalt/kernel: Fix locking for xnthread info manipulations
Module: xenomai-3 Branch: master Commit: 1b78d7edd374a8ea8b4a0267e898e65b776beedb URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1b78d7edd374a8ea8b4a0267e898e65b776beedb Author: Jan Kiszka jan.kis...@siemens.com Date: Fri Jun 26 15:11:42 2015 +0200 cobalt/kernel: Fix locking for xnthread info manipulations nklock must be held when manipulating bits of xnthread::info. Not all callsites of xnthread_set/clear_info follow this rule so far, directly or indirectly, fix them (and possibly some other races along this). Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/posix/syscall.c |5 + kernel/cobalt/synch.c |2 ++ kernel/cobalt/thread.c|3 +++ 3 files changed, 10 insertions(+) diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c index 74b8c18..2d7ab1e 100644 --- a/kernel/cobalt/posix/syscall.c +++ b/kernel/cobalt/posix/syscall.c @@ -82,6 +82,9 @@ static void prepare_for_signal(struct task_struct *p, int sysflags) { int notify = 0; + spl_t s; + + xnlock_get_irqsave(nklock, s); if (xnthread_test_info(thread, XNKICKED)) { if (signal_pending(p)) { @@ -94,6 +97,8 @@ static void prepare_for_signal(struct task_struct *p, xnthread_clear_info(thread, XNKICKED); } + xnlock_put_irqrestore(nklock, s); + xnthread_test_cancel(); xnthread_relax(notify, SIGDEBUG_MIGRATE_SIGNAL); diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c index 7142fd2..ae4ceef 100644 --- a/kernel/cobalt/synch.c +++ b/kernel/cobalt/synch.c @@ -443,7 +443,9 @@ redo: if (likely(h == XN_NO_HANDLE)) { xnsynch_set_owner(synch, curr); xnthread_get_resource(curr); + xnlock_get_irqsave(nklock, s); xnthread_clear_info(curr, XNRMID | XNTIMEO | XNBREAK); + xnlock_put_irqrestore(nklock, s); return 0; } diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index 4cec6e7..7c8cb3a 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -1989,6 +1989,7 @@ void xnthread_relax(int notify, int reason) struct task_struct *p = current; int cpu __maybe_unused; siginfo_t si; + spl_t s; primary_mode_only(); @@ -2045,7 +2046,9 @@ void xnthread_relax(int notify, int reason) si.si_int = reason | sigdebug_marker; send_sig_info(SIGDEBUG, si, p); } + xnlock_get_irqsave(nklock, s); xnsynch_detect_claimed_relax(thread); + xnlock_put_irqrestore(nklock, s); } /* ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/regd: do command lookup for fusermount/mount
Module: xenomai-3 Branch: master Commit: 24f42351e0192eabe1229099c5dba226cee9d94c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=24f42351e0192eabe1229099c5dba226cee9d94c Author: Philippe Gerum r...@xenomai.org Date: Thu Jul 23 09:57:18 2015 +0200 copperplate/regd: do command lookup for fusermount/mount --- lib/copperplate/regd/regd.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/copperplate/regd/regd.c b/lib/copperplate/regd/regd.c index d86c855..8176c9a 100644 --- a/lib/copperplate/regd/regd.c +++ b/lib/copperplate/regd/regd.c @@ -268,8 +268,8 @@ fail_nopath: static void unmount(const char *path) { + char *cmd, *cmdpath; int flags, ret; - char *cmd; /* * Silence stderr while we run the shell command - it may complain @@ -279,7 +279,12 @@ static void unmount(const char *path) if (flags = 0) fcntl(2, F_SETFD, flags | FD_CLOEXEC); - ret = asprintf(cmd, /usr/bin/fusermount -uzq %s, path); + cmdpath = lookup_command(fusermount); + if (cmdpath == NULL) + return; + + ret = asprintf(cmd, %s -uzq %s, cmdpath, path); + free(cmdpath); if (ret 0) return; @@ -288,10 +293,12 @@ static void unmount(const char *path) if (ret != -1 WIFEXITED(ret) WEXITSTATUS(ret) == 0) return; - if (access(/usr/bin/umount, X_OK)) + cmdpath = lookup_command(umount); + if (cmdpath == NULL) return; - ret = asprintf(cmd, /usr/bin/umount -l %s, path); + ret = asprintf(cmd, %s -l %s, cmdpath, path); + free(cmdpath); if (ret 0) return; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git