Round-robin scheduling on cobalt
Hi all,
When enabling rr schduling on cobalt via threadobj_set_rr(), the call will be forwarded to the cobalt-specific set_rr(). This function will then call pthread_setschedparam_ex(), which in turn calls libc_setschedparam() for updating the regular kernels view on the rr task. However, when using prios > 99, libc_setschedparam() will clip them for SCHED_COBALT / SCHED_RT, SCHED_TP, SCHED_SPORADIC, SCHED_QUOTA, but not for SCHED_RR, leading to an EINVAL error. Mercury maps rr scheduling to SCHED_FIFO. Shouldnt cobalt also register rr tasks as SCHED_FIFO and clip their prio? i.e. add SCHED_RR to the fall-through case list of in libc_setschedparam()?
Thanks in advance,
Matthias
----- Original Message -----
Quoted 20 lines
From: Matthias Schneider <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Sent: Saturday, May 17, 2014 1:49 PM
Subject: [Xenomai] Round-robin scheduling on cobaltHi all,
When enabling rr schduling on cobalt via threadobj_set_rr(), the call will be forwarded to the cobalt-specific
set_rr(). This function will then callpthread_setschedparam_ex(), which in turn callslibc_setschedparam()for updating the regular kernels view on the rr task. However, when using priosQuoted 1 line
99,
libc_setschedparam()will clip them forSCHED_COBALT/SCHED_RT,SCHED_TP,SCHED_SPORADIC,SCHED_QUOTA, but not forSCHED_RR, leading to an EINVAL error. Mercury maps rr scheduling toSCHED_FIFO. Shouldnt cobalt also register rr tasks
asSCHED_FIFOand clip their prio? i.e. addSCHED_RRto the fall-through case list of inlibc_setschedparam()?
Quoted 4 lines
Thanks in advance,
Matthias
My observation is shows a situation slightly more complicate than described before. Scheduling policies are being set as follows:
threadobj_init() sets either : SCHED_OTHER when prio = 0 or SCHED_RT otherwise (which maps to SCHED_COBALT on cobalt and SCHED_FIFO on mercury). set_rr may change the policy to SCHED_RR on cobalt or SCHED_FIFO on mercury.
However, considering cobalt specific prios > 99, it seems that task with prios > 99 with SCHED_RT do actually work, but task with SCHED_RR seem to only to run into the issue described by my previous email, but also the cobalt core itself seems to expect something <=99 here:
get_policy_param():
[...]
case SCHED_RR:
[...]
if (prio < XNSCHED_FIFO_MIN_PRIO(1) ||
prio > XNSCHED_FIFO_MAX_PRIO(99))
return NULL;
but not XNSCHED_RT_MAX_PRIO(257) as I would have expected.
This leads to an EINVAL in the cobalt call for sc_cobalt_thread_setschedparam_ex in the same way like libc_setschedparam.
Is the max prio on cobalt only 99 for RR tasks, while non-RR (i.e. SCHED_RT/SCHED_COBALT) tasks can go higher?
Thanks in advance,
Matthias
Quoted 47 lines · Matthias Schneider
----- Original Message -----
Quoted 20 lines
From: Matthias Schneider <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Sent: Saturday, May 17, 2014 1:49 PM
Subject: [Xenomai] Round-robin scheduling on cobaltHi all,
When enabling rr schduling on cobalt via
threadobj_set_rr(), the call will be forwarded to the cobalt-specificset_rr(). This function will then callpthread_setschedparam_ex(), which in turn callslibc_setschedparam()for updating the regular kernels view on the rr task. However, when using priosQuoted 1 line
99,
libc_setschedparam()will clip them forSCHED_COBALT/SCHED_RT,SCHED_TP,SCHED_SPORADIC,SCHED_QUOTA, but not forSCHED_RR, leading to an EINVAL error. Mercury maps rr scheduling toSCHED_FIFO. Shouldnt cobalt also register rr tasks
asSCHED_FIFOand clip their prio? i.e. addSCHED_RRto the fall-through case list of inlibc_setschedparam()?Quoted 4 lines
Thanks in advance,
Matthias
My observation is shows a situation slightly more complicate than described before. Scheduling policies are being set as follows:
threadobj_init()sets either :SCHED_OTHERwhen prio = 0 orSCHED_RTotherwise (which maps toSCHED_COBALTon cobalt andSCHED_FIFOon mercury).set_rrmay change the policy toSCHED_RRon cobalt orSCHED_FIFOon mercury.However, considering cobalt specific prios > 99, it seems that task with prios > 99 with
SCHED_RTdo actually work, but task withSCHED_RRseem to only to run into the issue described by my previous email, but also the cobalt core itself seems to expect something <=99 here:
get_policy_param():
[...]
caseSCHED_RR:
[...]
if (prio <XNSCHED_FIFO_MIN_PRIO(1)||prio > XNSCHED_FIFO_MAX_PRIO(99)) return NULL;
Quoted 8 lines
but not
XNSCHED_RT_MAX_PRIO(257)as I would have expected.This leads to an EINVAL in the cobalt call for
sc_cobalt_thread_setschedparam_exin the same way likelibc_setschedparam.Is the max prio on cobalt only 99 for RR tasks, while non-RR (i.e. SCHED_RT/SCHED_COBALT) tasks can go higher?
Yes. SCHED_RR and SCHED_FIFO have the same priority scale than their counterpart in the host kernel, [1..99]. SCHED_COBALT has access to the full range of priorities defined by the Cobalt core, i.e. 257.
Signature · 1 line
Philippe.
----- Original Message -----
Quoted 73 lines
From: Philippe Gerum <[email protected]>
To: Matthias Schneider <[email protected]>; "[email protected]" <[email protected]> Cc:
Sent: Saturday, May 17, 2014 5:35 PM
Subject: Re: [Xenomai] Round-robin scheduling on cobaltQuoted 11 lines · Matthias Schneider
----- Original Message -----
Quoted 9 lines
From: Matthias Schneider <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Sent: Saturday, May 17, 2014 1:49 PM
Subject: [Xenomai] Round-robin scheduling on cobaltHi all,
When enabling rr schduling on cobalt via threadobj_set_rr(), the call
will be
Quoted 2 lines
Quoted 2 lines
forwarded to the cobalt-specific
set_rr(). This function will then callpthread_setschedparam_ex(), which in turn callslibc_setschedparam()for
Quoted 1 line
Quoted 1 line
updating the regular kernels view on the rr task. However, when using
prios
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
99,
libc_setschedparam()will clip them forSCHED_COBALT/SCHED_RT,
SCHED_TP,Quoted 1 line
Quoted 1 line
SCHED_SPORADIC,SCHED_QUOTA, but not forSCHED_RR, leading to an EINVALerror.
Quoted 1 line
Quoted 1 line
Mercury maps rr scheduling to
SCHED_FIFO. Shouldnt cobalt also registerrr
Quoted 2 lines
Quoted 2 lines
tasks
asSCHED_FIFOand clip their prio? i.e. addSCHED_RRto thefall-through case
Quoted 11 lines
Quoted 6 lines
list of in
libc_setschedparam()?Thanks in advance,
Matthias
My observation is shows a situation slightly more complicate than described before. Scheduling policies are being set as follows:
threadobj_init()sets either :SCHED_OTHERwhen prio = 0 orSCHED_RTotherwise
Quoted 2 lines
(which maps to
SCHED_COBALTon cobalt andSCHED_FIFOon mercury).set_rrmay change the policy toSCHED_RRon cobalt orSCHED_FIFOonmercury.
Quoted 2 lines
However, considering cobalt specific prios > 99, it seems that task with
prios >
Quoted 1 line
99 with
SCHED_RTdo actually work, but task withSCHED_RRseem to only torun
Quoted 1 line
into the issue described by my previous email, but also the cobalt core
itself
Quoted 10 lines
seems to expect something <=99 here:
get_policy_param():
[...]
caseSCHED_RR:
[...]
if (prio <XNSCHED_FIFO_MIN_PRIO(1)||
prio >XNSCHED_FIFO_MAX_PRIO(99))
return NULL;Quoted 3 lines
but not
XNSCHED_RT_MAX_PRIO(257)as I would have expected.This leads to an EINVAL in the cobalt call for
sc_cobalt_thread_setschedparam_exQuoted 2 lines
in the same way like
libc_setschedparam.
Quoted 11 lines
Quoted 3 lines
Is the max prio on cobalt only 99 for RR tasks, while non-RR (i.e. SCHED_RT/SCHED_COBALT) tasks can go higher?
Yes.
SCHED_RRandSCHED_FIFOhave the same priority scale than their counterpart in the host kernel, [1..99].SCHED_COBALThas access to the full range of priorities defined by the Cobalt core, i.e. 257.Signature · 1 line
Philippe.
How does this play with the existing skins?
PSOS enables rr based on the T_TSLICE flag. However, psos_task_normalize_priority() is based on threadobj_high_prio only. i.e. I can create a task with T_SLICE and a prio > 99 and it will cause the described the problem, right?
Same should go for VxWorks. There additionally kernelTimeSlice() may cause a problem enabling RR on tasks that have already been started, that may also have a prio > 99.
Arent both SCHED_RR and SCHED_COBALT scheduled by the cobalt core (contrary to to use SCHED_FIFO and userspace RR in mercury?)
Regards,
Matthias
Quoted 87 lines · Matthias Schneider
----- Original Message -----
Quoted 81 lines
From: Philippe Gerum <[email protected]>
To: Matthias Schneider <[email protected]>; "[email protected]" <[email protected]> Cc:
Sent: Saturday, May 17, 2014 5:35 PM
Subject: Re: [Xenomai] Round-robin scheduling on cobaltQuoted 11 lines · Matthias Schneider
----- Original Message -----
Quoted 9 lines
From: Matthias Schneider <[email protected]>
To: "[email protected]" <[email protected]> Cc:
Sent: Saturday, May 17, 2014 1:49 PM
Subject: [Xenomai] Round-robin scheduling on cobaltHi all,
When enabling rr schduling on cobalt via
threadobj_set_rr(), the callwill be
Quoted 2 lines
Quoted 2 lines
forwarded to the cobalt-specific
set_rr(). This function will then callpthread_setschedparam_ex(), which in turn callslibc_setschedparam()for
Quoted 1 line
Quoted 1 line
updating the regular kernels view on the rr task. However, when using
prios
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
99,
libc_setschedparam()will clip them forSCHED_COBALT/SCHED_RT,
SCHED_TP,Quoted 1 line
Quoted 1 line
SCHED_SPORADIC,SCHED_QUOTA, but not forSCHED_RR, leading to an EINVALerror.
Quoted 1 line
Quoted 1 line
Mercury maps rr scheduling to
SCHED_FIFO. Shouldnt cobalt also registerrr
Quoted 2 lines
Quoted 2 lines
tasks
asSCHED_FIFOand clip their prio? i.e. addSCHED_RRto thefall-through case
Quoted 11 lines
Quoted 6 lines
list of in
libc_setschedparam()?Thanks in advance,
Matthias
My observation is shows a situation slightly more complicate than described before. Scheduling policies are being set as follows:
threadobj_init()sets either :SCHED_OTHERwhen prio = 0 orSCHED_RTotherwise
Quoted 2 lines
(which maps to
SCHED_COBALTon cobalt andSCHED_FIFOon mercury).set_rrmay change the policy toSCHED_RRon cobalt orSCHED_FIFOonmercury.
Quoted 2 lines
However, considering cobalt specific prios > 99, it seems that task with
prios >
Quoted 1 line
99 with
SCHED_RTdo actually work, but task withSCHED_RRseem to only torun
Quoted 1 line
into the issue described by my previous email, but also the cobalt core
itself
Quoted 6 lines
seems to expect something <=99 here:
get_policy_param():
[...]
caseSCHED_RR:
[...]Quoted 7 lines
if (prio < XNSCHED_FIFO_MIN_PRIO(1) || prio > XNSCHED_FIFO_MAX_PRIO(99)) return NULL;but not
XNSCHED_RT_MAX_PRIO(257)as I would have expected.This leads to an EINVAL in the cobalt call for
sc_cobalt_thread_setschedparam_exQuoted 5 lines
in the same way like
libc_setschedparam.Is the max prio on cobalt only 99 for RR tasks, while non-RR (i.e. SCHED_RT/SCHED_COBALT) tasks can go higher?
Yes.
SCHED_RRandSCHED_FIFOhave the same priority scale than their counterpart in the host kernel, [1..99].SCHED_COBALThas access to the full range of priorities defined by the Cobalt core, i.e. 257.
Quoted 6 lines
Quoted 3 lines
--
Philippe.How does this play with the existing skins?
In short: not implemented yet. Copperplate reflects the current limitation of the Cobalt core, which cannot enable timeslicing over SCHED_COBALT yet. It's been on the todo list for some time, likely too long.
Signature · 1 line
Philippe.