Message-ID: Date: Mon, 13 Feb 2006 13:00:01 +0200 From: Dmitry Adamushko In-Reply-To: <43F03A1F.3040206@domain.hid> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2305_14212477.1139828401009" References: <43E9CE95.3070806@domain.hid> <43EAFD8B.7020400@domain.hid> <43EB1279.3040902@domain.hid> <43EB1741.9080809@domain.hid> <43EB63D7.2080507@domain.hid> <43EC9C5B.4030501@domain.hid> <43F03A1F.3040206@domain.hid> Subject: [Xenomai-core] Re: More on Shared interrupts List-Id: "Xenomai life and development \(bug reports, patches, discussions\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anders Blomdell Cc: xenomai@xenomai.org ------=_Part_2305_14212477.1139828401009 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 13/02/06, Anders Blomdell wrote: > > Dmitry Adamushko wrote: > > > > > > > > > > irq K | ----------- | ---o | // Linux only > > > > ... > > > > irq L | ---o | | // RT-only > > > > ... > > > > irq M | ---o------- | ---o | // Shared between domains > > > > ... > > > > irq N | ---o---o--- | | // Shared inside single domai= n > > > > ... > > > > irq O | ---o---o--- | ---o | // Shared between and inside > > single > > > > domain > > > > > > > > Xenomai currently handles the K & L cases, Dmitrys patch addresses > > the N > > > > case, with edge triggered interrupts the M (and O after Dmitry's > patch) > > > > case(s) might be handled by returning RT_INTR_CHAINED | > RT_INTR_ENABLE > > > > > > > > > > As you pointed out recently, using this combo for M (and thus O) > > might also be > > > unsafe, e.g. causing some implementation to send eoi twice or more > > (and the second > > > time while hw IRQs are off and the second IRQ is still pending) if > > more than a > > > single domain ends the current interrupt. This said, I've never trie= d > > that > > > actually, but this does seem a bit optimistic to always expect a > > proper behaviour > > > in this case (basically, it all depends on what "ending" the > > interrupt means hw-wise). > > > > > > Just to be sure I've got the things more or less clear. I feel there ar= e > > some holes in my understanding of the irq handling stuff, mainly > hw-wise. > > > > x86 + i8259A. > > > > In this case, .end handler does nothing more than enabling the IRQ line= . > > The "eoi" is sent in .ack right after disabling the IRQ line. > > > > Let's suppose we have the "M" case ("O" makes no difference here). > > > > When the ISR handler in Linux domain gets control : > > > > - the IRQ line is ON (it was already .end-ed in the primary domain in > case > > of XN_ISR_ENABLE | XN_ISR_CHAINED ). > > > > =3D=3D=3D > > Actually, it's possible to set IPIPE_PASS flag for > > the primary_domain.irqs[THIS_IRQ].control > > when THIS_IRQ is shared across domains. This way, there is no need > > to call propagate_irq() in xnintr_irq_handler(). Ok, it's not > > that important so far. > > =3D=3D=3D > > > > This is not how it happens when the IRQ is only handled in the > > Linux domain. But the ISR is still serialized (need not to be > > reentrant) because do_IRQ() takes care of it (by means > > of RUNNING and PENDING flags). > > > > So, I suppose, it's possible to use XN_ISR_ENABLE | XN_ISR_CHAINED in > that > > case? > Yes, but only if you disable interrupts from the Linux device (i.e. via > its > control registers, not via the APIC), otherwise the RT-handler will spin > since > the interrupt will never get deasserted. Then you are faced with finding > some > place to reenble those interrupts right after the Linux interrupts-handle= r > has run. Thanks. I'm just missing what really happens between PIC and hw devices at the time of CPU <--> PIC communication. Now it becomes clearer, nevertheles= s I have to find some good hw-related overview (tried but failed so far). -- > Best regards > > Anders Blomdell > -- Best regards, Dmitry Adamushko ------=_Part_2305_14212477.1139828401009 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
On 13/02/06, Anders Blomdell <anders.blomdell@domain.hid> wrote:
Dmitry Adamushko wrote:
>
>  > >
> &= nbsp;> >   irq K  | ----------- | ---o  = ;  |   // Linux only
>  > > =   ...
>  > >   irq L  | ---o        |   &nbs= p;     |   // RT-only
>  > >   ...
&g= t;  > >   irq M  | ---o------- | ---o    |   // Shared between domains
>=   > >   ...
>  > >   irq N  | ---o---o--- |         |   // Shared inside single domain
>  > >   ...>  > >   irq O  | ---o---o--- | ---o    |   // Shared between and inside
&= gt; single
>  > > domain
>  > >=
>  > > Xenomai currently handles the K & L cases= , Dmitrys patch addresses
> the N
>  > > case, = with edge triggered interrupts the M (and O after Dmitry's patch)
>  > > case(s) might be handled by returning RT_INTR= _CHAINED | RT_INTR_ENABLE
>  > >
>  &= gt;
>  > As you pointed out recently, using this combo f= or M (and thus O)
> might also be
>  > unsafe, e.g. causing some implementation to send e= oi twice or more
> (and the second
>  > time while= hw IRQs are off and the second IRQ is still pending) if
> more than = a
>  > single domain ends the current interrupt. This sa= id, I've never tried
> that
>  > actually, but this does seem a bit op= timistic to always expect a
> proper behaviour
>  >= ; in this case (basically, it all depends on what "ending" the> interrupt means hw-wise).
>
>
> Just to be sure I've got the things more or less c= lear. I feel there are
> some holes in my understanding of the irq ha= ndling stuff, mainly hw-wise.
>
> x86 + i8259A.
>
> In this case, .end handler does nothing more than enabling the IRQ lin= e.
> The "eoi" is sent in .ack right after disabling the IR= Q line.
>
> Let's suppose we have the "M" case ("= ;O" makes no difference here).
>
> When the ISR handler in Linux domain gets control :
>= ;
> - the IRQ line is ON (it was already .end-ed in the primary domai= n in case
>   of XN_ISR_ENABLE | XN_ISR_CHAINED ).
><= br>> =3D=3D=3D
>   Actually, it's possible to set IPIPE_PASS flag for
= >   the primary_domain.irqs[THIS_IRQ].control
> &nb= sp; when THIS_IRQ is shared across domains. This way, there is no need
&= gt;   to call propagate_irq() in xnintr_irq_handler(). Ok, it's n= ot
>   that important so far.
> =3D=3D=3D
>
&g= t;   This is not how it happens when the IRQ is only handled in t= he
>   Linux domain. But the ISR is still serialized (need = not to be
>   reentrant) because do_IRQ() takes care of it = (by means
>   of RUNNING and PENDING flags).
>
> So, I s= uppose, it's possible to use XN_ISR_ENABLE | XN_ISR_CHAINED in that
>= case?
Yes, but only if you disable interrupts from the Linux device (i.= e. via its
control registers, not via the APIC), otherwise the RT-handler will spi= n since
the interrupt will never get deasserted. Then you are faced with= finding some
place to reenble those interrupts right after the Linux in= terrupts-handler has run.

Thanks. I'm just missing what really happens between PIC and hw devices at the time of CPU <--> PIC communication. Now it becomes clearer, nevertheless I have to find some good hw-related overview (tried but failed so far).
 


--
Best = regards

Anders Blomdell


= --=20
Best regards,
Dmitry Adamushko ------=_Part_2305_14212477.1139828401009--