[Xenomai-git] Jan Kiszka : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 3a8f597f27f551bed669d0b5ae78872017709581 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3a8f597f27f551bed669d0b5ae78872017709581 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index 9b8f1ff..cc98a19 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -88,7 +88,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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: fc6016d5530b40453b697210b03823f184ff8815 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=fc6016d5530b40453b697210b03823f184ff8815 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index eaac70d..45f920f 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -88,7 +88,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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 575f1da2f77606db441dcb1cb5b5fdbde968dfcc URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=575f1da2f77606db441dcb1cb5b5fdbde968dfcc Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index eaac70d..45f920f 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -88,7 +88,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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 466425bb5c9ac7a4c0c9af047c801c4621ce9eb8 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=466425bb5c9ac7a4c0c9af047c801c4621ce9eb8 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index eaac70d..45f920f 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -88,7 +88,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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 38f65d16449e67ba8ab492e8df4bb90f07d71851 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=38f65d16449e67ba8ab492e8df4bb90f07d71851 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index eaac70d..45f920f 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -88,7 +88,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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 97bcd4b13e4366b07483d21fea3190a0a3054dee URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=97bcd4b13e4366b07483d21fea3190a0a3054dee Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index eaac70d..45f920f 100644 --- a/kernel/cobalt/trace/cobalt-posix.h +++ b/kernel/cobalt/trace/cobalt-posix.h @@ -88,7 +88,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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: bb893bb0e6a330cc7625219e828d0b7e79abae6f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bb893bb0e6a330cc7625219e828d0b7e79abae6f Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 1ed889b3332a23f890a1b05c9ae238636b1fa9c3 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1ed889b3332a23f890a1b05c9ae238636b1fa9c3 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 97b39bc46da70a15dbfe8f76b1912ba9afea219c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=97b39bc46da70a15dbfe8f76b1912ba9afea219c Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: f37f8a32a8526fdfc97b17271d3fab99d7b545e6 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f37f8a32a8526fdfc97b17271d3fab99d7b545e6 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: aa159447b55994e5623e5bece76bc3a7a102f9b9 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=aa159447b55994e5623e5bece76bc3a7a102f9b9 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: b943ac065d4814a707e286b974726b8c3ff38308 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b943ac065d4814a707e286b974726b8c3ff38308 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: c61187e8f1359555a24158a9f9340ae6218478dd URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c61187e8f1359555a24158a9f9340ae6218478dd Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 5f5dc8a43afbb28ba89c3100990d19119e66642f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5f5dc8a43afbb28ba89c3100990d19119e66642f Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 278e5dd0dc89706212b09a24d6243f3b30c3be8e URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=278e5dd0dc89706212b09a24d6243f3b30c3be8e Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 32cc4247e962bd78d7f8d99b3d4bcd72adf8df71 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=32cc4247e962bd78d7f8d99b3d4bcd72adf8df71 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 6f15f8670608edfbb714bf799d732860c3f0a4fd URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6f15f8670608edfbb714bf799d732860c3f0a4fd Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: next Commit: 762abc776d1bed4ac473bcea84711fee1505acaf URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=762abc776d1bed4ac473bcea84711fee1505acaf Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-3 Branch: wip/dovetail Commit: c821cbaa31c4a816615a82d7cbbd049987da6f1a URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c821cbaa31c4a816615a82d7cbbd049987da6f1a Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : 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 Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-jki Branch: for-forge Commit: 188ca70999794b5b97aeffc55721b3c106515996 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=188ca70999794b5b97aeffc55721b3c106515996 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-jki Branch: for-forge Commit: 3489d686f7f9b5fa1fc8ddb1559a0e391b28bc9a URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=3489d686f7f9b5fa1fc8ddb1559a0e391b28bc9a Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-jki Branch: for-forge Commit: 110b97a4770affa6f0888355fc5a7c57e12b4ab9 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=110b97a4770affa6f0888355fc5a7c57e12b4ab9 Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index 92f7245..75673d7 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-jki Branch: for-forge Commit: 2e4c540c4eb71eea6eae195d13f8e0df80aba31b URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=2e4c540c4eb71eea6eae195d13f8e0df80aba31b Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index 92f7245..75673d7 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 : cobalt/kernel: Introduce __SCHED_CURRENT policy to setschedparam_ex
Module: xenomai-jki Branch: for-forge Commit: 19f4b3bd01df924dae4b0d1a13036e9303dbfcca URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=19f4b3bd01df924dae4b0d1a13036e9303dbfcca Author: Jan Kiszka Date: 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 = &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 == &xnsched_class_rt && +xnthread_test_state(base_thread, XNRRB)) + policy = SCHED_RR; + } + tslice = thread->threadbase.rrperiod; sched_class = cobalt_sched_policy_param(¶m, policy, param_ex, &tslice); diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h index 92f7245..75673d7 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