From: Matthias Schneider <ma30002000@yahoo.de>
To: Philippe Gerum <rpm@xenomai.org>,
"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Issue in __threadobj_unlock_sched (forge/mercury)
Date: Sat, 17 May 2014 15:20:35 +0100 (BST) [thread overview]
Message-ID: <1400336435.71762.YahooMailNeo@web171605.mail.ir2.yahoo.com> (raw)
In-Reply-To: <536356E2.30308@xenomai.org>
----- Original Message -----
> From: Philippe Gerum <rpm@xenomai.org>
> To: Matthias Schneider <ma30002000@yahoo.de>; "xenomai@xenomai.org" <xenomai@xenomai.org>
> Cc:
> Sent: Friday, May 2, 2014 10:27 AM
> Subject: Re: [Xenomai] Issue in __threadobj_unlock_sched (forge/mercury)
>
> On 05/01/2014 04:23 PM, Matthias Schneider wrote:
>
>> b) threadobj_lock_sched() saves prio and policy and sets it to
>> SCHED_RT/threadobj_lock_prio
>
> Forcing SCHED_RT in threadobj_lock() is the core issue. Doing so allows
> SCHED_OTHER callers to hold that lock: does it make sense? Maybe it's
> handy so that client code does not have to care, on the other hand, this
> very much sounds like introducing priority inversion by design.
>
> What would be the use case for holding the sched lock over SCHED_OTHER?
>
>
> --
> Philippe.
>
There are some points I would like to raise about this issue:
a) the policy active before holding the "scheduler lock" is actually reapplied,
but the threadobj info about this is left inconsistent
b) independent from wether SCHED_OTHER is a use case, SCHED_RR and SCHED_RT/SCHED_FIFO
definitely are.
c) In my recently published FreeRTOS prototype, the "main" thread calling
TaskSchedulerStart is actually a SCHED_OTHER thread that takes the scheduler
lock
Nevertheless, please have a look at the code again, it seems like a simple bug
to me.
Consider the following:
current task is SCHED_RR, prio 5
threadobj_lock_sched()
-> SCHED_RT, prio 99
threadobj_unlock_sched()
-> SCHED_RR, prio 5
threadobj_lock_sched()
-> SCHED_RT, prio 99
threadobj_unlock_sched()
-> SCHED_RT(!), prio 5
Regards,
Matthias
next prev parent reply other threads:[~2014-05-17 14:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 11:42 [Xenomai] Issue in __threadobj_unlock_sched (forge/mercury) Matthias Schneider
2014-05-01 12:54 ` Philippe Gerum
2014-05-01 14:23 ` Matthias Schneider
2014-05-02 8:27 ` Philippe Gerum
2014-05-17 14:20 ` Matthias Schneider [this message]
2014-05-19 13:38 ` Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400336435.71762.YahooMailNeo@web171605.mail.ir2.yahoo.com \
--to=ma30002000@yahoo.de \
--cc=rpm@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.