[Xenomai-git] 3.x build test report
next branch build test: git hash: f96f0548cce9b54eac5f60cab543c9598f4f2386 see: http://git.xenomai.org/xenomai-3.git/log/?id=f96f0548cce9b54eac5f60cab543c9598f4f2386 distcheck-bfin-linux-uclibc-gcc-4.3.5/cobalt: failed with 31 warnings/errors See http://xenomai.org/build-test-next/distcheck-bfin-linux-uclibc-gcc-4.3.5/cobalt/log.html#1 stable branch build test: git hash: 3e1ee65647cf24fef7bd66f82b0be9060907f2fe see: http://git.xenomai.org/xenomai-3.git/log/?id=3e1ee65647cf24fef7bd66f82b0be9060907f2fe Passed. ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: c821cbaa31c4a816615a82d7cbbd049987da6f1a URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c821cbaa31c4a816615a82d7cbbd049987da6f1a Author: Jan KiszkaDate: Tue Mar 8 14:41:28 2016 +0100 cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex Define the internal scheduling policy "current": it shall refer to the target thread's current scheduling policy. This will allow to model pthread_setschedprio on top of pthread_setschedparam_ex with only a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/uapi/sched.h|3 +++ kernel/cobalt/posix/thread.c | 10 ++ kernel/cobalt/trace/cobalt-posix.h |3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/cobalt/uapi/sched.h b/include/cobalt/uapi/sched.h index b672095..2a1df44 100644 --- a/include/cobalt/uapi/sched.h +++ b/include/cobalt/uapi/sched.h @@ -21,6 +21,9 @@ #define SCHED_COBALT 42 #define SCHED_WEAK 43 +/* for internal use */ +#define __SCHED_CURRENT44 + #ifndef SCHED_SPORADIC #define SCHED_SPORADIC 10 #define sched_ss_low_priority sched_u.ss.__sched_low_priority diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c index d87edb1..217b81b 100644 --- a/kernel/cobalt/posix/thread.c +++ b/kernel/cobalt/posix/thread.c @@ -242,6 +242,7 @@ struct xnthread_personality *cobalt_thread_finalize(struct xnthread *zombie) int __cobalt_thread_setschedparam_ex(struct cobalt_thread *thread, int policy, const struct sched_param_ex *param_ex) { + struct xnthread *base_thread = >threadbase; struct xnsched_class *sched_class; union xnsched_policy_param param; xnticks_t tslice; @@ -256,6 +257,15 @@ int __cobalt_thread_setschedparam_ex(struct cobalt_thread *thread, int policy, goto out; } + if (policy == __SCHED_CURRENT) { + policy = base_thread->base_class->policy; + if (xnthread_base_priority(base_thread) == 0) + policy = SCHED_NORMAL; + else if (base_thread->base_class == _class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(, policy, param_ex, ); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index 3d0e20c..cc0eb05 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -90,7 +90,8 @@ DECLARE_EVENT_CLASS(syscall_exit, {SCHED_QUOTA, "quota"},\ {SCHED_SPORADIC, "sporadic"}, \ {SCHED_COBALT, "cobalt"}, \ -{SCHED_WEAK, "weak"}) +{SCHED_WEAK, "weak"}, \ +{__SCHED_CURRENT, ""}) #define cobalt_print_sched_params(__policy, __p_ex)\ ({ \ ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : lib/cobalt: Wrap pthread_setschedprio for proper real-time support
Module: xenomai-3 Branch: next Commit: f96f0548cce9b54eac5f60cab543c9598f4f2386 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f96f0548cce9b54eac5f60cab543c9598f4f2386 Author: Jan KiszkaDate: Tue Mar 8 14:46:59 2016 +0100 lib/cobalt: Wrap pthread_setschedprio for proper real-time support Implement pthread_setschedprio on top of pthread_setschedparam_ex with the help of the new __SCHED_CURRENT policy. This ensures that prio changes are directly applied to the real-time core, and that with just a single syscall. Signed-off-by: Jan Kiszka --- include/cobalt/pthread.h |2 ++ lib/cobalt/cobalt.wrappers |1 + lib/cobalt/thread.c|9 + lib/cobalt/wrappers.c |6 ++ 4 files changed, 18 insertions(+) diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h index f1b1c8a..3e9bd47 100644 --- a/include/cobalt/pthread.h +++ b/include/cobalt/pthread.h @@ -53,6 +53,8 @@ COBALT_DECL(int, pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param)); +COBALT_DECL(int, pthread_setschedprio(pthread_t thread, int prio)); + COBALT_DECL(int, pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 75f29d6..19153ae 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -2,6 +2,7 @@ --wrap pthread_create --wrap pthread_setschedparam --wrap pthread_getschedparam +--wrap pthread_setschedprio --wrap pthread_yield --wrap sched_yield --wrap sched_get_priority_min diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c index 908516f..62ca0a0 100644 --- a/lib/cobalt/thread.c +++ b/lib/cobalt/thread.c @@ -650,6 +650,15 @@ int pthread_setschedparam_ex(pthread_t thread, return ret; } +COBALT_IMPL(int, pthread_setschedprio, (pthread_t thread, int prio)) +{ + struct sched_param_ex param_ex = { + .sched_priority = prio, + }; + + return pthread_setschedparam_ex(thread, __SCHED_CURRENT, _ex); +} + /** * Get the scheduling policy and parameters of the specified thread. * diff --git a/lib/cobalt/wrappers.c b/lib/cobalt/wrappers.c index 09c74e5..1f1664e 100644 --- a/lib/cobalt/wrappers.c +++ b/lib/cobalt/wrappers.c @@ -60,6 +60,12 @@ int __real_pthread_getschedparam(pthread_t thread, } __weak +int __real_pthread_setschedprio(pthread_t thread, int prio) +{ + return pthread_setschedprio(thread, prio); +} + +__weak int __real_sched_yield(void) { return sched_yield(); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git