* Re: [Xenomai-help] Thread policy and priority in secondary mode
[not found] <5D63919D95F87E4D9D34FF7748CE2C2A0137F4FC@ARVMAIL1.mra.roland-man.biz>
@ 2008-07-23 14:26 ` Philippe Gerum
0 siblings, 0 replies; 6+ messages in thread
From: Philippe Gerum @ 2008-07-23 14:26 UTC (permalink / raw)
To: roderik.wildenburg; +Cc: xenomai
roderik.wildenburg@domain.hid wrote:
>> __real_pthread_setschedparam(). Note: this will propagate the
>> priority to the underlying Xenomai thread as well.
>>
>
> Does this mean that the Xenomai thread will run with the new (Linux)
> priority when it returns to primary mode ?
Yes. However, the propagation only occurs when the skin and Linux have
compatible priority scales, which is the case with the POSIX skin.
> And the other way round :
> when a posix thread switches to secondary mode (without using
> __real_pthread_setschedparam), does it run in Linux with the priority
> set in Xenomai (with pthread_setschedparam)?
Yes.
> Or better : what is the Linux-prority when a Xenomai thread (posix or or
> any other Xenomai thread)switches to secondaary mode ?
>
It depends on the skin. When the priority scales are compatible (i.e. a given
priority level exists in both and scales are both upwarding, like POSIX skin <->
Linux, and native skin <-> Linux), you get the same priority level in both
modes, and changing the priority from one mode affects the other mode as well.
When they are not compatible, the skin-based priority is "normalized" and
applied to the Linux side when needed (e.g. when VxWorks taskPrioritySet() is
invoked), but __real_pthread_setschedparam does not trigger the converse
propagation (since 2.4.4 actually, because experience showed that propagating in
that case made little sense, and would beget weird behaviours). The way priority
levels are normalized depends on the skin.
> Best regrads
> Roderik
>
> Achtung: Neue E-Mail-Adresse! Attention: New e-mail-address! roderik.wildenburg@domain.hid
> --------------------------------------------------------
> manroland AG
> Vorsitzender des Aufsichtsrates: Hanno C. Fiedler
> Vorstand: Gerd Finkbeiner (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle
> Sitz der Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592
> USt-Ident-Nr. DE 250200933
>
--
Philippe.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Thread policy and priority in secondary mode
@ 2008-07-25 7:40 roderik.wildenburg
2008-07-25 8:09 ` Wolfgang Grandegger
2008-07-25 9:19 ` Philippe Gerum
0 siblings, 2 replies; 6+ messages in thread
From: roderik.wildenburg @ 2008-07-25 7:40 UTC (permalink / raw)
To: xenomai
> >> __real_pthread_setschedparam(). Note: this will propagate the
> >> priority to the underlying Xenomai thread as well.
> >>
> >
> > Does this mean that the Xenomai thread will run with the new (Linux)
> > priority when it returns to primary mode ?
>
> Yes. However, the propagation only occurs when the skin and Linux have
> compatible priority scales, which is the case with the POSIX skin.
>
> > And the other way round :
> > when a posix thread switches to secondary mode (without using
> > __real_pthread_setschedparam), does it run in Linux with
> the priority
> > set in Xenomai (with pthread_setschedparam)?
>
> Yes.
>
> > Or better : what is the Linux-prority when a Xenomai thread
> (posix or or
> > any other Xenomai thread)switches to secondaary mode ?
> >
>
> It depends on the skin. When the priority scales are
> compatible (i.e. a given
> priority level exists in both and scales are both upwarding,
> like POSIX skin <->
> Linux, and native skin <-> Linux), you get the same priority
> level in both
> modes, and changing the priority from one mode affects the
> other mode as well.
>
> When they are not compatible, the skin-based priority is
> "normalized" and
> applied to the Linux side when needed (e.g. when VxWorks
> taskPrioritySet() is
> invoked), but __real_pthread_setschedparam does not trigger
> the converse
> propagation (since 2.4.4 actually, because experience showed
> that propagating in
> that case made little sense, and would beget weird
> behaviours). The way priority
> levels are normalized depends on the skin.
>
Do you know how a Linux priority, set with pthread_setschedparam
(real_pthread_setschedparam),
correlates with the priorities shown by "ps l". In our case we realized
that ps does not show the priority set with pthread_setschedparam. Is
there a command which shows the "real" priority ?
Best regrads
Roderik
Achtung: Neue E-Mail-Adresse! Attention: New e-mail-address! roderik.wildenburg@domain.hid
--------------------------------------------------------
manroland AG
Vorsitzender des Aufsichtsrates: Hanno C. Fiedler
Vorstand: Gerd Finkbeiner (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle
Sitz der Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592
USt-Ident-Nr. DE 250200933
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Thread policy and priority in secondary mode
2008-07-25 7:40 roderik.wildenburg
@ 2008-07-25 8:09 ` Wolfgang Grandegger
2008-07-25 9:19 ` Philippe Gerum
1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Grandegger @ 2008-07-25 8:09 UTC (permalink / raw)
To: roderik.wildenburg; +Cc: xenomai
roderik.wildenburg@domain.hid wrote:
>>>> __real_pthread_setschedparam(). Note: this will propagate the
>>>> priority to the underlying Xenomai thread as well.
>>>>
>>> Does this mean that the Xenomai thread will run with the new (Linux)
>>> priority when it returns to primary mode ?
>> Yes. However, the propagation only occurs when the skin and Linux have
>> compatible priority scales, which is the case with the POSIX skin.
>>
>>> And the other way round :
>>> when a posix thread switches to secondary mode (without using
>>> __real_pthread_setschedparam), does it run in Linux with
>> the priority
>>> set in Xenomai (with pthread_setschedparam)?
>> Yes.
>>
>>> Or better : what is the Linux-prority when a Xenomai thread
>> (posix or or
>>> any other Xenomai thread)switches to secondaary mode ?
>>>
>> It depends on the skin. When the priority scales are
>> compatible (i.e. a given
>> priority level exists in both and scales are both upwarding,
>> like POSIX skin <->
>> Linux, and native skin <-> Linux), you get the same priority
>> level in both
>> modes, and changing the priority from one mode affects the
>> other mode as well.
>>
>> When they are not compatible, the skin-based priority is
>> "normalized" and
>> applied to the Linux side when needed (e.g. when VxWorks
>> taskPrioritySet() is
>> invoked), but __real_pthread_setschedparam does not trigger
>> the converse
>> propagation (since 2.4.4 actually, because experience showed
>> that propagating in
>> that case made little sense, and would beget weird
>> behaviours). The way priority
>> levels are normalized depends on the skin.
>>
>
> Do you know how a Linux priority, set with pthread_setschedparam
> (real_pthread_setschedparam),
> correlates with the priorities shown by "ps l". In our case we realized
> that ps does not show the priority set with pthread_setschedparam. Is
> there a command which shows the "real" priority ?
With 2.6 you can list the priority with:
# ps -meo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
But it's normally not available with the busybox ps command. Then you
can look into /proc/<id>/stat directly. Here is the kernel's printk
statement:
http://lxr.linux.no/linux/fs/proc/array.c#L472
Unfortunately, this will not work for 2.4 either. The only simple way I
see is to write a little program using sched_getscheduler() to read the
RT priority and policy for the specified pid.
Wolfgang.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Thread policy and priority in secondary mode
2008-07-25 7:40 roderik.wildenburg
2008-07-25 8:09 ` Wolfgang Grandegger
@ 2008-07-25 9:19 ` Philippe Gerum
1 sibling, 0 replies; 6+ messages in thread
From: Philippe Gerum @ 2008-07-25 9:19 UTC (permalink / raw)
To: roderik.wildenburg; +Cc: xenomai
roderik.wildenburg@domain.hid wrote:
>>>> __real_pthread_setschedparam(). Note: this will propagate the
>>>> priority to the underlying Xenomai thread as well.
>>>>
>>> Does this mean that the Xenomai thread will run with the new (Linux)
>>> priority when it returns to primary mode ?
>> Yes. However, the propagation only occurs when the skin and Linux have
>> compatible priority scales, which is the case with the POSIX skin.
>>
>>> And the other way round :
>>> when a posix thread switches to secondary mode (without using
>>> __real_pthread_setschedparam), does it run in Linux with
>> the priority
>>> set in Xenomai (with pthread_setschedparam)?
>> Yes.
>>
>>> Or better : what is the Linux-prority when a Xenomai thread
>> (posix or or
>>> any other Xenomai thread)switches to secondaary mode ?
>>>
>> It depends on the skin. When the priority scales are
>> compatible (i.e. a given
>> priority level exists in both and scales are both upwarding,
>> like POSIX skin <->
>> Linux, and native skin <-> Linux), you get the same priority
>> level in both
>> modes, and changing the priority from one mode affects the
>> other mode as well.
>>
>> When they are not compatible, the skin-based priority is
>> "normalized" and
>> applied to the Linux side when needed (e.g. when VxWorks
>> taskPrioritySet() is
>> invoked), but __real_pthread_setschedparam does not trigger
>> the converse
>> propagation (since 2.4.4 actually, because experience showed
>> that propagating in
>> that case made little sense, and would beget weird
>> behaviours). The way priority
>> levels are normalized depends on the skin.
>>
>
> Do you know how a Linux priority, set with pthread_setschedparam
> (real_pthread_setschedparam),
> correlates with the priorities shown by "ps l". In our case we realized
> that ps does not show the priority set with pthread_setschedparam. Is
> there a command which shows the "real" priority ?
>
Try this:
ps -eo pid,tid,class,rtprio,pri,stat,comm
The priority level you want to look at is listed under the RTPRIO column, not
the PRI one.
Xenomai-wise, do
$ cat /proc/xenomai/sched
The first value of the PRI field (== ps's RTPRIO) is the priority value
according to the nucleus core (0-257 range); when skin priority levels have to
be normalized to fit the Linux scale, a second value between parenthesis is
appended, giving the original, non-converted, level set by the skin.
> Best regrads
> Roderik
>
> Achtung: Neue E-Mail-Adresse! Attention: New e-mail-address! roderik.wildenburg@domain.hid
> --------------------------------------------------------
> manroland AG
> Vorsitzender des Aufsichtsrates: Hanno C. Fiedler
> Vorstand: Gerd Finkbeiner (Vorsitzender), Dr. Ingo Koch, Dr. Markus Rall, Paul Steidle
> Sitz der Gesellschaft: Offenbach am Main, Registergericht: Amtsgericht Offenbach HRB-Nr. 42592
> USt-Ident-Nr. DE 250200933
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
>
--
Philippe.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Xenomai-help] Thread policy and priority in secondary mode
@ 2008-07-23 10:03 Wolfgang Grandegger
2008-07-23 12:25 ` Philippe Gerum
0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Grandegger @ 2008-07-23 10:03 UTC (permalink / raw)
To: xenomai-help
Hello,
when a Xenomai POSIX thread switches to secondary mode, how can I define
the policy and priority under which it should run under the Linux
scheduler, especially, with SCHED_FIFO.
The Xenomai POSIX API function pthread_setschedparam() described in
http://www.xenomai.org/documentation/trunk/html/api/group__posix__sched.html#g95276f88e1a2cae7a37f792123a99144
does switch the thread to primary mode when the SCHED_FIFO policy is
specified and therefore cannot be use for the secondary mode.
Wolfgang.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-07-25 9:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5D63919D95F87E4D9D34FF7748CE2C2A0137F4FC@ARVMAIL1.mra.roland-man.biz>
2008-07-23 14:26 ` [Xenomai-help] Thread policy and priority in secondary mode Philippe Gerum
2008-07-25 7:40 roderik.wildenburg
2008-07-25 8:09 ` Wolfgang Grandegger
2008-07-25 9:19 ` Philippe Gerum
-- strict thread matches above, loose matches on Subject: below --
2008-07-23 10:03 Wolfgang Grandegger
2008-07-23 12:25 ` Philippe Gerum
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.