Skip to contentSkip to conversation

Round-robin scheduling on cobalt

Xenomai Matthias Schneider 2 participants 5 messages May 17, 2014 – May 18, 2014

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

----- 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 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

Quoted 1 line

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()?

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

#2 lore raw
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 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

Quoted 1 line

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()?

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;
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_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?

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.
#3 lore raw

----- 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 cobalt

Quoted 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 cobalt

Hi 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 call pthread_setschedparam_ex(), which in turn calls libc_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 for SCHED_COBALT / SCHED_RT,

SCHED_TP,

Quoted 1 line
Quoted 1 line

SCHED_SPORADIC, SCHED_QUOTA, but not for SCHED_RR, leading to an EINVAL

error.

Quoted 1 line
Quoted 1 line

Mercury maps rr scheduling to SCHED_FIFO. Shouldnt cobalt also register

rr

Quoted 2 lines
Quoted 2 lines

tasks
as SCHED_FIFO and clip their prio? i.e. add SCHED_RR to the

fall-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_OTHER when prio = 0 or SCHED_RT

otherwise

Quoted 2 lines

(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.

Quoted 2 lines

However, considering cobalt specific prios > 99, it seems that task with

prios >

Quoted 1 line

99 with SCHED_RT do actually work, but task with SCHED_RR seem to only to

run

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():
[...]
case SCHED_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_ex

Quoted 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_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.

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

#4 lore raw
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 cobalt

Quoted 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 cobalt

Hi 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 call pthread_setschedparam_ex(), which in turn calls libc_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 for SCHED_COBALT / SCHED_RT,

SCHED_TP,

Quoted 1 line
Quoted 1 line

SCHED_SPORADIC, SCHED_QUOTA, but not for SCHED_RR, leading to an EINVAL

error.

Quoted 1 line
Quoted 1 line

Mercury maps rr scheduling to SCHED_FIFO. Shouldnt cobalt also register

rr

Quoted 2 lines
Quoted 2 lines

tasks
as SCHED_FIFO and clip their prio? i.e. add SCHED_RR to the

fall-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_OTHER when prio = 0 or SCHED_RT

otherwise

Quoted 2 lines

(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.

Quoted 2 lines

However, considering cobalt specific prios > 99, it seems that task with

prios >

Quoted 1 line

99 with SCHED_RT do actually work, but task with SCHED_RR seem to only to

run

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():
[...]
case SCHED_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_ex

Quoted 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_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.

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.