All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Dmitry Adamushko <dmitry.adamushko@domain.hid>
Cc: Xenomai help <xenomai@xenomai.org>, apittaluga@domain.hid
Subject: Re: [Xenomai-help] xeno-2.3.1 shared interrups BUG?
Date: Tue, 19 Jun 2007 14:20:13 +0200	[thread overview]
Message-ID: <4677C9FD.2050507@domain.hid> (raw)
In-Reply-To: <4677C8A9.2010004@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

Jan Kiszka wrote:
> Dmitry Adamushko wrote:
>> On 19/06/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>>> apittaluga@domain.hid wrote:
>>>> Hi,
>>>> running a simple test application which spawns a periodic task
>>> writing on a
>>>> serial interface
>>>> the system hangs performing the rt_dev_close.
>>>> The test program ran fine with xeno 2.2.6 with "Shared Interrupts"
>>> enabled,
>>>> so as with
>>>> xeno 2.3.1 with "Shared Interrupts" disabled. It fails with xeno
>>> 2.3.1 with
>>>> "Shared Interrupts" enabled, so the problem seems to be in the shared
>>>> interrupts handling area.
>>>> kernel is 2.6.20 adeos patched
>>>>
>>>> Any suggestion?
>> Does the fix below eliminate the problem?
>>
>> The problem (allegedly) is cause by the following reinitialization at
>> the end of the loop:
>>
>> ...
>>                if (!(intr = intr->next))
>>                        intr = shirq->handlers;
>> ...
>>
>> 'end' may point to some of the elements ... and shirq->handlers may
>> become NULL (all elements have been deleted)..
> 
> Good catch.
> 
>> (white-space damaged version.. enclosed a normal one)
>>
>> --- ksrc/nucleus/intr.c-orig    2007-06-19 13:44:55.090623404 +0200
>> +++ ksrc/nucleus/intr.c 2007-06-19 13:45:53.867440067 +0200
>> @@ -273,7 +273,7 @@ static void xnintr_edge_shirq_handler(un
>>        xnintr_shirq_lock(shirq);
>>        intr = shirq->handlers;
>>
>> -       while (intr != end) {
>> +       while (intr && intr != end) {
>>                int ret, code;
>>
>>                xnstat_runtime_switch(sched,
>>
>>
> 
> But your patch looks incomplete: What if someone removes "end" but
> leaves other handlers behind while we are looping? Neither intr would
> then become NULL nor would we hit the end again. This seems to be more
> tricky...
> 
> Quick idea: mark the xnintr object as being removed, check for this
> state of "end" at the end of the while loop and null'ify "end" in this case.

May also race. So we need both your test and mine, I think. This looks
increasingly ugly, screaming for something different.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2007-06-19 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19  7:23 [Xenomai-help] xeno-2.3.1 shared interrups BUG? apittaluga
2007-06-19  7:44 ` Jan Kiszka
2007-06-19 11:52   ` Dmitry Adamushko
2007-06-19 12:14     ` Jan Kiszka
2007-06-19 12:20       ` Jan Kiszka [this message]
2007-06-19 12:41       ` Dmitry Adamushko
2007-06-19 13:00         ` Jan Kiszka
2007-06-19 13:28           ` Dmitry Adamushko
2007-06-20 22:10 ` Jan Kiszka

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=4677C9FD.2050507@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=apittaluga@domain.hid \
    --cc=dmitry.adamushko@domain.hid \
    --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.