From: Jan Kiszka <jan.kiszka@domain.hid>
To: Dmitry Adamushko <dmitry.adamushko@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Re: [PATCH] Shared interrupts (ready to merge)
Date: Tue, 21 Feb 2006 09:42:20 +0100 [thread overview]
Message-ID: <43FAD26C.2030904@domain.hid> (raw)
In-Reply-To: <b647ffbd0602200840v5f066d0bv@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 4044 bytes --]
Dmitry Adamushko wrote:
> N.B. Amongst other things, some thoughts about CHAINED with shared
> interrupts.
>
>
> On 20/02/06, Anders Blomdell <anders.blomdell@domain.hid> wrote:
>
>
>
>> A number of questions arise:
>>
>> 1. What happens if one of the shared handlers leaves the interrupt
>> asserted,
>> returns NOENABLE|HANDLED and another return only HANDLED?
>>
>> 2. What happens if one returns PROPAGATE and another returns HANDLED?
>
>
> Yep, each ISR may return a different value and all of them are
> accumulated in the "s" variable ( s |= intr->isr(intr); ).
>
> So the loop may end up with "s" which contains all of the possible bits:
>
> (e.g.
>
> isr1 - HANDLED | ENABLE
> isr2 - HANDLED (don't want the irq to be enabled)
> isr3 - CHAINED
>
> )
>
> s = HANDLED | ENABLE | CHAINED;
>
> Then CHAINED will be ignored because of the following code :
>
> + if (s & XN_ISR_ENABLE)
> + xnarch_end_irq(irq);
> + else if (s & XN_ISR_CHAINED) (*)
> + xnarch_chain_irq(irq);
Which may actually be fatal: consider one ISR intentionally not handling
an IRQ but propagating it while another ISR thinks it has to re-enable
it - bang! Anders' as well as my original suggestion were to ignore the
ENABLE in this case.
>
> the current code in the CVS doen not contain "else" in (*), so that ENABLE |
> CHAINED is possible, though it's a wrong combination.
>
> This said, we suppose that one knows what he is doing.
>
> In the case of a single ISR per line, it's not that difficult to achieve.
> But if there are a few ISRs, then one should analize and take into account
> all possible return values of all the ISRs, as each of them may affect
> others (e.g. if one returns CHAINED when another - HANDLED | ENABLE).
>
> So my feeling is that CHAINED should not be used by drivers which registered
> their ISRs as SHARED.
That's true for standard drivers, but we should not prevent special
corner-case designs which can be tuned to make even shared RT-IRQs +
propagation possible. Sharing does not necessarily mean that different
RT drivers are involved...
>
> Moreover, I actually see the only scenario of CHAINED (I provided it before)
> :
>
> all ISRs in the primary domain have reported UNHANDLED => nucleus
> propagates the interrupt down the pipeline with xnacrh_chain_irq().
> This call actually returns 1 upon successful propagation (some domain down
> the pipeline was interested in this irq) and 0 otherwise.
But this only means that some handler is registered down there, it
cannot predict if that handler will actually care about the event.
>
> Upon 0, this is a spurious irq (none of domains was interested in its
> handling).
>
> ok, let's suppose now :
>
> we have 2 ISRs on the same shared line :
>
> isr1 : HANDLED (will be enabled by rt task. Note, rt task must call
> xnarch_end_irq() and not just xnarch_enable_irq()! )
>
> isr2 : CHAINED
>
> So HANDLED | CHAINED is ok for the single ISR on the line, but it may lead
> to HANDLED | CHAINED | ENABLE in a case of the shared line.
>
> rt task that works jointly with isr1 just calls xnarch_end_irq() at some
> moment of time and some ISR in the linux domain does the same later => the
> line is .end-ed 2 times.
>
> ISR should never return CHAINED as to indicate _only_ that it is not
> interested in this irq, but ~HANDLED or NOINT (if we'll support it) instead.
>
> If the ISR nevertheless wants to propagate the IRQ to the Linux domain
> _explicitly_, it _must not_ register itself as SHARED, i.e. it _must_ be the
> only ISR on this line, otherwise that may lead to the IRQ line being .end-ed
> twice (lost interrupts in some cases).
>
>
> #define UNHANDLED 0
>> #define HANDLED_ENABLE 1
>> #define HANDLED_NOENABLE 2
>> #define PROPAGATE 3
>
>
> Yep, I'd agree with you. Moreover, PROPAGATE should not be used for shared
> interrupts.
>
>
> --
> Best regards,
> Dmitry Adamushko
>
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
next prev parent reply other threads:[~2006-02-21 8:42 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-15 17:39 [Xenomai-core] [PATCH] Shared interrupts (ready to merge) Dmitry Adamushko
2006-02-16 0:18 ` [Xenomai-core] " Jan Kiszka
2006-02-16 10:20 ` Dmitry Adamushko
2006-02-16 12:58 ` Jan Kiszka
2006-02-16 13:58 ` Dmitry Adamushko
2006-02-16 14:12 ` Jan Kiszka
2006-02-16 19:28 ` Dmitry Adamushko
2006-02-16 20:38 ` Jan Kiszka
2006-02-18 20:04 ` Dmitry Adamushko
2006-02-18 21:37 ` Jan Kiszka
2006-02-20 13:53 ` Anders Blomdell
2006-02-20 16:40 ` Dmitry Adamushko
2006-02-21 8:42 ` Jan Kiszka [this message]
2006-02-21 10:45 ` Dmitry Adamushko
[not found] ` <43FAD322.4060001@domain.hid>
2006-02-21 10:54 ` Dmitry Adamushko
2006-02-21 11:28 ` Anders Blomdell
2006-02-21 11:49 ` Jan Kiszka
2006-02-21 16:48 ` Dmitry Adamushko
2006-02-21 17:04 ` Anders Blomdell
2006-02-21 17:49 ` Jan Kiszka
2006-02-21 18:50 ` Anders Blomdell
2006-02-22 12:45 ` Dmitry Adamushko
2006-02-22 13:15 ` Anders Blomdell
2006-02-22 21:59 ` Jan Kiszka
2006-02-23 12:21 ` Philippe Gerum
2006-02-25 20:14 ` Dmitry Adamushko
2006-02-26 18:51 ` Jan Kiszka
2006-02-26 19:15 ` Philippe Gerum
2006-02-26 19:21 ` Jan Kiszka
2006-02-26 20:37 ` Philippe Gerum
2006-02-27 8:14 ` Anders Blomdell
2006-02-27 8:23 ` Jan Kiszka
2006-02-27 9:20 ` Philippe Gerum
2006-02-21 11:39 ` Anders Blomdell
2006-02-21 8:39 ` 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=43FAD26C.2030904@domain.hid \
--to=jan.kiszka@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.