From: Jan Kiszka <jan.kiszka@domain.hid>
To: rpm@xenomai.org
Cc: mathias_koehrer@domain.hid, xenomai@xenomai.org
Subject: Re: [Xenomai-core] [Xenomai-help] Sporadic PC freeze after rt_task_start
Date: Sun, 22 Jul 2007 18:44:42 +0200 [thread overview]
Message-ID: <46A3897A.6030703@domain.hid> (raw)
In-Reply-To: <1185007792.5998.100.camel@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]
Philippe Gerum wrote:
> On Fri, 2007-07-20 at 16:20 +0200, Jan Kiszka wrote:
>
>> OK, let's go through this another time, this time under the motto "get
>> the locking right". As a start (and a help for myself), here comes an
>> overview of the scheme the final version may expose - as long as there
>> are separate locks:
>>
>> gatekeeper_thread / xnshadow_relax:
>> rpilock, followed by nklock
>> (while xnshadow_relax puts both under irqsave...)
>>
>
> The relaxing thread must not be preempted in primary mode before it
> schedules out but after it has been linked to the RPI list, otherwise
> the root thread would benefit from a spurious priority boost. This said,
> in the UP case, we have no lock to contend for anyway, so the point of
> discussing whether we should have the rpilock or not is moot here.
>
>> xnshadow_unmap:
>> nklock, then rpilock nested
>>
>
> This one is the hardest to solve.
>
>> xnshadow_start:
>> rpilock, followed by nklock
>>
>> xnshadow_renice:
>> nklock, then rpilock nested
>>
>> schedule_event:
>> only rpilock
>>
>> setsched_event:
>> nklock, followed by rpilock, followed by nklock again
>>
>> And then there is xnshadow_rpi_check which has to be fixed to:
>> nklock, followed by rpilock (here was our lock-up bug)
>>
>
> rpilock -> nklock in fact.
Yes, meant it the other way around: The invocation of
xnpod_renice_root() must be moved out of nklock - which should be
trivial, correct?
> The last lockup was rather likely due to the
> gatekeeper's dangerous nesting of nklock -> rpilock -> nklock.
This path - as one of three with this ordering - surely triggered the
bug. But given the fact that the other two nestings of this kind are yet
unresolvable while our reversely ordered nesting in xnshadow_rpi_check
is, it is clear that the latter one is the weak point. So far we only
have a fix for Mathias' test case which stresses just a subset of all
rpilock paths appropriately.
>
>> That's a scheme which /should/ be safe. Unfortunately, I see no way to
>> get rid of the remaining nestings.
>>
>
> There is one, which consists of getting rid of the rpilock entirely. The
> purpose of such lock is to protect the RPI list when fixing the
> situation after a task migration in secondary mode triggered from the
> Linux side. Addressing the latter issue differently may solve the
> problem more elegantly than figuring out how to combine the two locks,
> or hammering the hot path with the nklock. Will look at this.
Even the better! Looking forward.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2007-07-22 16:44 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-10 8:00 [Xenomai-help] Sporadic PC freeze after rt_task_start M. Koehrer
2007-07-10 8:40 ` Jan Kiszka
2007-07-10 12:29 ` M. Koehrer
2007-07-10 12:41 ` Jan Kiszka
2007-07-10 14:40 ` M. Koehrer
2007-07-10 15:34 ` Jan Kiszka
2007-07-11 6:43 ` M. Koehrer
2007-07-11 7:32 ` Jan Kiszka
2007-07-11 12:45 ` M. Koehrer
2007-07-11 14:47 ` Jan Kiszka
2007-07-13 7:27 ` M. Koehrer
2007-07-13 8:26 ` Jan Kiszka
2007-07-16 7:07 ` M. Koehrer
2007-07-16 22:42 ` Jan Kiszka
2007-07-19 10:58 ` M. Koehrer
2007-07-19 11:27 ` Jan Kiszka
2007-07-19 12:19 ` Philippe Gerum
2007-07-19 12:40 ` Jan Kiszka
2007-07-19 13:55 ` [Xenomai-core] " Philippe Gerum
2007-07-19 15:14 ` Philippe Gerum
2007-07-19 15:35 ` Jan Kiszka
2007-07-19 16:03 ` Philippe Gerum
2007-07-19 17:18 ` Jan Kiszka
2007-07-19 18:24 ` Philippe Gerum
2007-07-19 20:15 ` Jan Kiszka
2007-07-19 21:35 ` Philippe Gerum
2007-07-20 14:20 ` Jan Kiszka
2007-07-20 18:33 ` Philippe Gerum
2007-07-21 8:49 ` Philippe Gerum
2007-07-22 16:44 ` Jan Kiszka [this message]
2007-07-19 17:57 ` Jan Kiszka
2007-07-21 20:15 ` Philippe Gerum
2007-07-20 7:03 ` M. Koehrer
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=46A3897A.6030703@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=mathias_koehrer@domain.hid \
--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.