Skip to contentSkip to conversation

Reentrant Interrupts on Freescale LS1021A

Xenomai Henry Bausley 2 participants 8 messages Mar 14, 2016 – Mar 25, 2016

lore
Share & tools
lore
#0 lore raw

For many years we have had a reentrant interrupt routine that has run on our single core AMCC460EX for ~7-8yrs. We received instructions on how to do this many years ago. See the link below

https://www.mail-archive.com/[email protected]&q=subject:%
22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% 22&o=newest&f=1

We have now changed to a Freescale dual core LS1021A ARM CPU. It now hangs on the LS1021A ARM. Is there anyway we can support reentrant interrupts on the LS1021A design?

We currently do this as we were instructed:

int your_isr(xnintr_t *intr)
{
unsigned long flags;

xnlock_clear_irqon(nklock);

... your code ...

xnlock_get_irqsave(nklock, flags); /* must re-lock on exit */ }

We are using xenomai-2.6.4 w/ linux 3.14.28

Any help would be greatly appreciated.

Thanks

Henry

Outbound scan for Spam or Virus by Barracuda at Delta Tau

#1 lore raw
Quoted 22 lines · Henry Bausley

For many years we have had a reentrant interrupt routine that has run on our single core AMCC460EX for ~7-8yrs. We received instructions on how to do this many years ago. See the link below

https://www.mail-archive.com/[email protected]&q=subject:%
22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% 22&o=newest&f=1

We have now changed to a Freescale dual core LS1021A ARM CPU. It now hangs on the LS1021A ARM. Is there anyway we can support reentrant interrupts on the LS1021A design?

We currently do this as we were instructed:

int your_isr(xnintr_t *intr)
{
unsigned long flags;

xnlock_clear_irqon(nklock);

Quoted 9 lines

... your code ...

xnlock_get_irqsave(nklock, flags); /* must re-lock on exit */ }

We are using xenomai-2.6.4 w/ linux 3.14.28

Any help would be greatly appreciated.

There is a per-IRQ lock since 2.3, so you should drop the code fiddling with the superlock, it's not locked on entry, and locking it on exit causes the hang.

You could try:

your_isr()

{
	hard_local_irq_enable();
	your code;
	hard_local_irq_disable();
}

That should be SMP-safe on your dual core board provided you don't re-enable the IRQ line in the GIC for the ongoing IRQ in your handler, of course. IOW, you won't be able to nest invocations of the same IRQ handler using that hack, but only allow other IRQs to preempt your handler. Hopefully this is what you are aiming at.

Btw, unless you changed the interrupt distributor settings for the onboard GIC, CPU0 should take all IRQs anyway.

PS: re-enabling IRQs in a Xenomai interrupt context is undocumented, and not officially supported. This is living on the edge, but I guess you already know it.

Signature · 1 line
Philippe.
#2 lore raw
Quoted 82 lines · Philippe Gerum

Content preview: On 03/14/2016 08:23 PM, Henry Bausley wrote: > > For many
years we have had a reentrant interrupt routine that has run on > our single
core AMCC460EX for ~7-8yrs. We received instructions on how > to do this
many years ago. See the link below > > > https://www.mail-archive.com/[email protected]&q=subject:%

Quoted 3 lines

22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% > 22&o=newest&f=1

Quoted 1 line

We have now changed to a Freescale dual core LS1021A ARM CPU. It now

hangs on the LS1021A ARM. Is there anyway we can support reentrant > interrupts

on the LS1021A design? > > We currently do this as we were instructed: >

Quoted 2 lines

int your_isr(xnintr_t *intr) > { > unsigned long flags; > > xnlock_clear_irqon(nklock);

Quoted 1 line

... your code ... > > xnlock_get_irqsave(nklock, flags); /* must re-lock

on exit */ > } > > We are using xenomai-2.6.4 w/ linux 3.14.28 > > Any help would be greatly appreciated. > [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1457986755
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27841
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------

Quoted 22 lines · Henry Bausley

For many years we have had a reentrant interrupt routine that has run on our single core AMCC460EX for ~7-8yrs. We received instructions on how to do this many years ago. See the link below

https://www.mail-archive.com/[email protected]&q=subject:%
22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% 22&o=newest&f=1

We have now changed to a Freescale dual core LS1021A ARM CPU. It now hangs on the LS1021A ARM. Is there anyway we can support reentrant interrupts on the LS1021A design?

We currently do this as we were instructed:

int your_isr(xnintr_t *intr)
{
unsigned long flags;

xnlock_clear_irqon(nklock);

Quoted 9 lines

... your code ...

xnlock_get_irqsave(nklock, flags); /* must re-lock on exit */ }

We are using xenomai-2.6.4 w/ linux 3.14.28

Any help would be greatly appreciated.

There is a per-IRQ lock since 2.3, so you should drop the code fiddling with the superlock, it's not locked on entry, and locking it on exit causes the hang.

You could try:

your_isr()

{
	hard_local_irq_enable();
	your code;
	hard_local_irq_disable();
}

That should be SMP-safe on your dual core board provided you don't re-enable the IRQ line in the GIC for the ongoing IRQ in your handler, of course. IOW, you won't be able to nest invocations of the same IRQ handler using that hack, but only allow other IRQs to preempt your handler. Hopefully this is what you are aiming at.

Quoted 7 lines

Btw, unless you changed the interrupt distributor settings for the onboard GIC, CPU0 should take all IRQs anyway.

PS: re-enabling IRQs in a Xenomai interrupt context is undocumented, and not officially supported. This is living on the edge, but I guess you already know it.

We have in deed been nesting invocations of the same IRQ handler and are trying to do the same. Is there a different hack we can use to achieve that?

As you indicated calling hard_local_irq_enable()/hard_local_irq_disable() won't accomplish nested invocations of the same IRQ handler and our test confirmed that.

Outbound scan for Spam or Virus by Barracuda at Delta Tau

#3 lore raw
Quoted 91 lines · Henry Bausley
Quoted 82 lines · Philippe Gerum

Content preview: On 03/14/2016 08:23 PM, Henry Bausley wrote: > > For many
years we have had a reentrant interrupt routine that has run on > our single
core AMCC460EX for ~7-8yrs. We received instructions on how > to do this
many years ago. See the link below > > > https://www.mail-archive.com/[email protected]&q=subject:%

Quoted 3 lines

22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% > 22&o=newest&f=1

Quoted 1 line

We have now changed to a Freescale dual core LS1021A ARM CPU. It now

hangs on the LS1021A ARM. Is there anyway we can support reentrant > interrupts

on the LS1021A design? > > We currently do this as we were instructed: >

Quoted 2 lines

int your_isr(xnintr_t *intr) > { > unsigned long flags; > > xnlock_clear_irqon(nklock);

Quoted 1 line

... your code ... > > xnlock_get_irqsave(nklock, flags); /* must re-lock

on exit */ > } > > We are using xenomai-2.6.4 w/ linux 3.14.28 > > Any help would be greatly appreciated. > [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1457986755
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27841
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------

Quoted 22 lines · Henry Bausley

For many years we have had a reentrant interrupt routine that has run on our single core AMCC460EX for ~7-8yrs. We received instructions on how to do this many years ago. See the link below

https://www.mail-archive.com/[email protected]&q=subject:%
22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% 22&o=newest&f=1

We have now changed to a Freescale dual core LS1021A ARM CPU. It now hangs on the LS1021A ARM. Is there anyway we can support reentrant interrupts on the LS1021A design?

We currently do this as we were instructed:

int your_isr(xnintr_t *intr)
{
unsigned long flags;

xnlock_clear_irqon(nklock);

Quoted 9 lines

... your code ...

xnlock_get_irqsave(nklock, flags); /* must re-lock on exit */ }

We are using xenomai-2.6.4 w/ linux 3.14.28

Any help would be greatly appreciated.

There is a per-IRQ lock since 2.3, so you should drop the code fiddling with the superlock, it's not locked on entry, and locking it on exit causes the hang.

You could try:

your_isr()

{
	hard_local_irq_enable();
	your code;
	hard_local_irq_disable();
}

That should be SMP-safe on your dual core board provided you don't re-enable the IRQ line in the GIC for the ongoing IRQ in your handler, of course. IOW, you won't be able to nest invocations of the same IRQ handler using that hack, but only allow other IRQs to preempt your handler. Hopefully this is what you are aiming at.

Quoted 7 lines

Btw, unless you changed the interrupt distributor settings for the onboard GIC, CPU0 should take all IRQs anyway.

PS: re-enabling IRQs in a Xenomai interrupt context is undocumented, and not officially supported. This is living on the edge, but I guess you already know it.

Quoted 9 lines

We have in deed been nesting invocations of the same IRQ handler and are trying to do the same. Is there a different hack we can use to achieve that?

As you indicated calling hard_local_irq_enable()/hard_local_irq_disable() won't accomplish nested invocations of the same IRQ handler and our test confirmed that.

Check xnintr_irq_handler(). You would need to unlock xnirqs[irq].lock prior to calling the handler, issue xnarch_end_irq() for enabling the IRQ line, run the handler, then lock back the per-irq lock right after it has returned.

This can only work with edge IRQs, CONFIG_XENO_OPT_SHIRQ must be off, and this hack would open a race with the code detaching IRQ descriptors, so you need a way to synchronize properly with your IRQ handler before calling xnintr_detach().

Signature · 1 line
Philippe.
#4 lore raw
Quoted 155 lines · Philippe Gerum

Content preview: On 03/14/2016 10:24 PM, Henry Bausley wrote: > On Mon, 2016-03-14
at 21:19 +0100, Philippe Gerum wrote: >> Content preview: On 03/14/2016 08:23 PM, Henry Bausley wrote: > > For many >> years we have had a reentrant interrupt routine that has run on > our single >> core AMCC460EX for ~7-8yrs. We received instructions on how > to do this >> many years ago. See the link below >

Quoted 4 lines
Quoted 4 lines

https://www.mail-archive.com/[email protected]&q=subject:%

Quoted 3 lines

22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% > 22&o=newest&f=1

Quoted 1 line

We have now changed to a Freescale dual core LS1021A ARM CPU. It now

hangs on the LS1021A ARM. Is there anyway we can support reentrant >

interrupts >> on the LS1021A design? > > We currently do this as we were

   instructed: > >> > int your_isr(xnintr_t *intr) > { > unsigned long flags;
    > > xnlock_clear_irqon(nklock); >> > > ... your code ... > > xnlock_get_irqsave(nklock,
    flags); /* must re-lock >> on exit */ > } > > We are using xenomai-2.6.4

w/ linux 3.14.28 > > Any help >> would be greatly appreciated. > [...] >>

Quoted 1 line
Quoted 1 line

Content analysis details: (-1.0 points, 5.0 required) >> >> pts rule name

    description >> ---- >> -1.0 ALL_TRUSTED Passed through trusted hosts only
    via SMTP >> X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82] >> X-Barracuda-Start-Time:
    1457986755 >> X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
Quoted 1 line
Quoted 1 line

X-Virus-Scanned: by bsmtpd at deltatau.com >> X-Barracuda-BRTS-Status:

1 >> X-Barracuda-Spam-Score: 0.00 >> X-Barracuda-Spam-Status: No, SCORE=0.00
using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0
tests= >> X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27841

Quoted 1 line
Quoted 1 line

Rule breakdown below >> pts rule name description >> ---- >> >> On 03/14/2016

08:23 PM, Henry Bausley wrote: >>> >>> For many years we have had a reentrant interrupt routine that has run on >>> our single [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------

 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
  0.0 IP_LINK_PLUS           URI: Dotted-decimal IP address followed by CGI
  0.0 NORMAL_HTTP_TO_IP      URI: URI host has a public dotted-decimal IPv4

address
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1458112390
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=IP_LINK_PLUS, NORMAL_HTTP_TO_IP
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27890
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------
0.00 NORMAL_HTTP_TO_IP URI: Uses a dotted-decimal IP address in URL
0.00 IP_LINK_PLUS URI: Dotted-decimal IP address followed by CGI

Quoted 91 lines · Henry Bausley
Quoted 82 lines · Philippe Gerum

Content preview: On 03/14/2016 08:23 PM, Henry Bausley wrote: > > For many
years we have had a reentrant interrupt routine that has run on > our single
core AMCC460EX for ~7-8yrs. We received instructions on how > to do this
many years ago. See the link below > > > https://www.mail-archive.com/[email protected]&q=subject:%

Quoted 3 lines

22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% > 22&o=newest&f=1

Quoted 1 line

We have now changed to a Freescale dual core LS1021A ARM CPU. It now

hangs on the LS1021A ARM. Is there anyway we can support reentrant > interrupts

on the LS1021A design? > > We currently do this as we were instructed: >

Quoted 2 lines

int your_isr(xnintr_t *intr) > { > unsigned long flags; > > xnlock_clear_irqon(nklock);

Quoted 1 line

... your code ... > > xnlock_get_irqsave(nklock, flags); /* must re-lock

on exit */ > } > > We are using xenomai-2.6.4 w/ linux 3.14.28 > > Any help would be greatly appreciated. > [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1457986755
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27841
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------

Quoted 22 lines · Henry Bausley

For many years we have had a reentrant interrupt routine that has run on our single core AMCC460EX for ~7-8yrs. We received instructions on how to do this many years ago. See the link below

https://www.mail-archive.com/[email protected]&q=subject:%
22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% 22&o=newest&f=1

We have now changed to a Freescale dual core LS1021A ARM CPU. It now hangs on the LS1021A ARM. Is there anyway we can support reentrant interrupts on the LS1021A design?

We currently do this as we were instructed:

int your_isr(xnintr_t *intr)
{
unsigned long flags;

xnlock_clear_irqon(nklock);

Quoted 9 lines

... your code ...

xnlock_get_irqsave(nklock, flags); /* must re-lock on exit */ }

We are using xenomai-2.6.4 w/ linux 3.14.28

Any help would be greatly appreciated.

There is a per-IRQ lock since 2.3, so you should drop the code fiddling with the superlock, it's not locked on entry, and locking it on exit causes the hang.

You could try:

your_isr()

{
	hard_local_irq_enable();
	your code;
	hard_local_irq_disable();
}

That should be SMP-safe on your dual core board provided you don't re-enable the IRQ line in the GIC for the ongoing IRQ in your handler, of course. IOW, you won't be able to nest invocations of the same IRQ handler using that hack, but only allow other IRQs to preempt your handler. Hopefully this is what you are aiming at.

Quoted 7 lines

Btw, unless you changed the interrupt distributor settings for the onboard GIC, CPU0 should take all IRQs anyway.

PS: re-enabling IRQs in a Xenomai interrupt context is undocumented, and not officially supported. This is living on the edge, but I guess you already know it.

Quoted 9 lines

We have in deed been nesting invocations of the same IRQ handler and are trying to do the same. Is there a different hack we can use to achieve that?

As you indicated calling hard_local_irq_enable()/hard_local_irq_disable() won't accomplish nested invocations of the same IRQ handler and our test confirmed that.

Check xnintr_irq_handler(). You would need to unlock xnirqs[irq].lock prior to calling the handler, issue xnarch_end_irq() for enabling the IRQ line, run the handler, then lock back the per-irq lock right after it has returned.

Quoted 5 lines

This can only work with edge IRQs, CONFIG_XENO_OPT_SHIRQ must be off, and this hack would open a race with the code detaching IRQ descriptors, so you need a way to synchronize properly with your IRQ handler before calling xnintr_detach().

I think I am following instructions but still I am not reentering the ISR. CONFIG_XENO_OPT_SHIRQ is not enabled. Is there something I am missing I did the following.

static void xnintr_irq_handler(unsigned irq, void *cookie) {
.
.
.

        if (irq == PHASEIRQ)                     
        {                                            
          xnlock_put(&xnirqs[PHASEIRQ].lock);
          xnarch_end_irq(PHASEIRQ);
        }          
                    
	s = intr->isr(intr);

        if (irq == PHASEIRQ)
          xnlock_get(&xnirqs[PHASEIRQ].lock);
	if (unlikely(s == XN_ISR_NONE)) {

.
.
.

Outbound scan for Spam or Virus by Barracuda at Delta Tau

#5 lore raw
Quoted 191 lines · Henry Bausley
Quoted 155 lines · Philippe Gerum

Content preview: On 03/14/2016 10:24 PM, Henry Bausley wrote: > On Mon, 2016-03-14
at 21:19 +0100, Philippe Gerum wrote: >> Content preview: On 03/14/2016 08:23 PM, Henry Bausley wrote: > > For many >> years we have had a reentrant interrupt routine that has run on > our single >> core AMCC460EX for ~7-8yrs. We received instructions on how > to do this >> many years ago. See the link below >

Quoted 4 lines
Quoted 4 lines

https://www.mail-archive.com/[email protected]&q=subject:%

Quoted 3 lines

22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% > 22&o=newest&f=1

Quoted 1 line

We have now changed to a Freescale dual core LS1021A ARM CPU. It now

hangs on the LS1021A ARM. Is there anyway we can support reentrant >

interrupts >> on the LS1021A design? > > We currently do this as we were

   instructed: > >> > int your_isr(xnintr_t *intr) > { > unsigned long flags;
    > > xnlock_clear_irqon(nklock); >> > > ... your code ... > > xnlock_get_irqsave(nklock,
    flags); /* must re-lock >> on exit */ > } > > We are using xenomai-2.6.4

w/ linux 3.14.28 > > Any help >> would be greatly appreciated. > [...] >>

Quoted 1 line
Quoted 1 line

Content analysis details: (-1.0 points, 5.0 required) >> >> pts rule name

    description >> ---- >> -1.0 ALL_TRUSTED Passed through trusted hosts only
    via SMTP >> X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82] >> X-Barracuda-Start-Time:
    1457986755 >> X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
Quoted 1 line
Quoted 1 line

X-Virus-Scanned: by bsmtpd at deltatau.com >> X-Barracuda-BRTS-Status:

1 >> X-Barracuda-Spam-Score: 0.00 >> X-Barracuda-Spam-Status: No, SCORE=0.00
using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0
tests= >> X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27841

Quoted 1 line
Quoted 1 line

Rule breakdown below >> pts rule name description >> ---- >> >> On 03/14/2016

08:23 PM, Henry Bausley wrote: >>> >>> For many years we have had a reentrant interrupt routine that has run on >>> our single [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------

 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
  0.0 IP_LINK_PLUS           URI: Dotted-decimal IP address followed by CGI
  0.0 NORMAL_HTTP_TO_IP      URI: URI host has a public dotted-decimal IPv4

address
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1458112390
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=IP_LINK_PLUS, NORMAL_HTTP_TO_IP
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27890
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------
0.00 NORMAL_HTTP_TO_IP URI: Uses a dotted-decimal IP address in URL
0.00 IP_LINK_PLUS URI: Dotted-decimal IP address followed by CGI

Quoted 91 lines · Henry Bausley
Quoted 82 lines · Philippe Gerum

Content preview: On 03/14/2016 08:23 PM, Henry Bausley wrote: > > For many
years we have had a reentrant interrupt routine that has run on > our single
core AMCC460EX for ~7-8yrs. We received instructions on how > to do this
many years ago. See the link below > > > https://www.mail-archive.com/[email protected]&q=subject:%

Quoted 3 lines

22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% > 22&o=newest&f=1

Quoted 1 line

We have now changed to a Freescale dual core LS1021A ARM CPU. It now

hangs on the LS1021A ARM. Is there anyway we can support reentrant > interrupts

on the LS1021A design? > > We currently do this as we were instructed: >

Quoted 2 lines

int your_isr(xnintr_t *intr) > { > unsigned long flags; > > xnlock_clear_irqon(nklock);

Quoted 1 line

... your code ... > > xnlock_get_irqsave(nklock, flags); /* must re-lock

on exit */ > } > > We are using xenomai-2.6.4 w/ linux 3.14.28 > > Any help would be greatly appreciated. > [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1457986755
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27841
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------

Quoted 22 lines · Henry Bausley

For many years we have had a reentrant interrupt routine that has run on our single core AMCC460EX for ~7-8yrs. We received instructions on how to do this many years ago. See the link below

https://www.mail-archive.com/[email protected]&q=subject:%
22Re%5C%3A+%5C%5BXenomai%5C-help%5C%5D+Recurring+Interrupts% 22&o=newest&f=1

We have now changed to a Freescale dual core LS1021A ARM CPU. It now hangs on the LS1021A ARM. Is there anyway we can support reentrant interrupts on the LS1021A design?

We currently do this as we were instructed:

int your_isr(xnintr_t *intr)
{
unsigned long flags;

xnlock_clear_irqon(nklock);

Quoted 9 lines

... your code ...

xnlock_get_irqsave(nklock, flags); /* must re-lock on exit */ }

We are using xenomai-2.6.4 w/ linux 3.14.28

Any help would be greatly appreciated.

There is a per-IRQ lock since 2.3, so you should drop the code fiddling with the superlock, it's not locked on entry, and locking it on exit causes the hang.

You could try:

your_isr()

{
	hard_local_irq_enable();
	your code;
	hard_local_irq_disable();
}

That should be SMP-safe on your dual core board provided you don't re-enable the IRQ line in the GIC for the ongoing IRQ in your handler, of course. IOW, you won't be able to nest invocations of the same IRQ handler using that hack, but only allow other IRQs to preempt your handler. Hopefully this is what you are aiming at.

Quoted 7 lines

Btw, unless you changed the interrupt distributor settings for the onboard GIC, CPU0 should take all IRQs anyway.

PS: re-enabling IRQs in a Xenomai interrupt context is undocumented, and not officially supported. This is living on the edge, but I guess you already know it.

Quoted 9 lines

We have in deed been nesting invocations of the same IRQ handler and are trying to do the same. Is there a different hack we can use to achieve that?

As you indicated calling hard_local_irq_enable()/hard_local_irq_disable() won't accomplish nested invocations of the same IRQ handler and our test confirmed that.

Check xnintr_irq_handler(). You would need to unlock xnirqs[irq].lock prior to calling the handler, issue xnarch_end_irq() for enabling the IRQ line, run the handler, then lock back the per-irq lock right after it has returned.

Quoted 5 lines

This can only work with edge IRQs, CONFIG_XENO_OPT_SHIRQ must be off, and this hack would open a race with the code detaching IRQ descriptors, so you need a way to synchronize properly with your IRQ handler before calling xnintr_detach().

I think I am following instructions but still I am not reentering the ISR. CONFIG_XENO_OPT_SHIRQ is not enabled. Is there something I am missing I did the following.

static void xnintr_irq_handler(unsigned irq, void *cookie) {
.
.
.

        if (irq == PHASEIRQ)                     
        {                                            
          xnlock_put(&xnirqs[PHASEIRQ].lock);
          xnarch_end_irq(PHASEIRQ);
        }          
                    
	s = intr->isr(intr);

        if (irq == PHASEIRQ)
          xnlock_get(&xnirqs[PHASEIRQ].lock);
	if (unlikely(s == XN_ISR_NONE)) {

.
.
.

Quoted 7 lines

Outbound scan for Spam or Virus by Barracuda at Delta Tau

_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

What we are seeing is if we are in the intr->isr(intr) and another H/W interrupt occurs it is replayed after the current intr->isr(intr) is finished.

What we are trying to accomplish is when a second H/W interrupt occurs the current intr->isr(intr) is stopped and a second call to intr->isr(intr) gets processed then when finished the original intr->isr(intr) .

Is there a way to accomplish what we are trying to do?

#6 lore raw
Quoted 4 lines · Henry Bausley

What we are seeing is if we are in the intr->isr(intr) and another H/W interrupt occurs it is replayed after the current intr->isr(intr) is finished.

Quoted 8 lines

What we are trying to accomplish is when a second H/W interrupt occurs the current intr->isr(intr) is stopped and a second call to intr->isr(intr) gets processed then when finished the original intr->isr(intr) .

Is there a way to accomplish what we are trying to do?

You need to fixup the virtual interrupt state for the head domain to match the hardware IRQ state change. There are pipeline helpers combining both operations the proper way. e.g. in your handler:

ipipe_unstall_head(); /* enable IRQs (hw-wise and virtually) */
...
ipipe_stall_head(); /* disable IRQs for the head domain */

Signature · 1 line
Philippe.
#7 lore raw
Quoted 39 lines · Philippe Gerum

Content preview: On 03/22/2016 06:10 PM, Henry Bausley wrote: > What we are

    seeing is if we are in the intr->isr(intr) and another H/W > interrupt occurs
    it is replayed after the current intr->isr(intr) is > finished. > > What
   we are trying to accomplish is when a second H/W interrupt occurs > the current
    intr->isr(intr) is stopped and a second call to > intr->isr(intr) gets processed
    then when finished the original > intr->isr(intr) . > > > Is there a way

to accomplish what we are trying to do? > [...]

Content analysis details: (-1.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
X-Barracuda-Connect: sd-51317.xenomai.org[62.210.215.82]
X-Barracuda-Start-Time: 1458815113
X-Barracuda-URL: https://76.79.246.10:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at deltatau.com
X-Barracuda-BRTS-Status: 1
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=4.0 KILL_LEVEL=7.0 tests=
X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.28117
Rule breakdown below
pts rule name description
---- ---------------------- --------------------------------------------------

Quoted 4 lines · Henry Bausley

What we are seeing is if we are in the intr->isr(intr) and another H/W interrupt occurs it is replayed after the current intr->isr(intr) is finished.

Quoted 8 lines

What we are trying to accomplish is when a second H/W interrupt occurs the current intr->isr(intr) is stopped and a second call to intr->isr(intr) gets processed then when finished the original intr->isr(intr) .

Is there a way to accomplish what we are trying to do?

Quoted 8 lines

You need to fixup the virtual interrupt state for the head domain to match the hardware IRQ state change. There are pipeline helpers combining both operations the proper way. e.g. in your handler:

ipipe_unstall_head(); /* enable IRQs (hw-wise and virtually) */
...
ipipe_stall_head(); /* disable IRQs for the head domain */

Works perfect!!!

Thank you

Outbound scan for Spam or Virus by Barracuda at Delta Tau