Skip to contentSkip to conversation

Shared interrupts

Xenomai Petr Cervenka 2 participants 6 messages Oct 11, 2012 – Oct 12, 2012

lore
Share & tools
lore
#0 lore raw

Hello everyone.

I have a problem when several devices share the same IRQ.
If there is one rt and one non-rt device, I have to return RTDM_IRQ_NONE | XN_ISR_PROPAGATE in my rtdm driver for rt device (when it was not handled by my driver). I know that I loose deterministic rt response latency in such case. When I return only RTDM_IRQ_NONE, the IRQ is disabled by Xenomai (with a message), probably because of infinite loop.

But when I share IRQ between 2 rt devices and return RTDM_IRQ_NONE | XN_ISR_PROPAGATE when it is not handled by my device, the IRQ gets disabled (perhaps by Linux, but thate is no message).

Concrete example:
1) interrupt occurs
first rt device handles interrupt and return RTDM_IRQ_HANDLED
second rt device doesn't handle the interrupt and return RTDM_IRQ_NONE | XN_ISR_PROPAGATE no second interrupt occurs

I'm using xenomai 2.5.6, adeos 2.6.38.8-x86-2.10-01

My primary questions:
Is there a possibility to have the rtdm driver compatible with both cases?

Do I loose deterministic rt latency when there is no non-rt device?
I think that all my interrupts should be handled by rt devices in such case, so no propagating to linux should happen. Am I wrong?

Petr

#1 lore raw
Quoted 5 lines · Petr Cervenka

I'm using xenomai 2.5.6, adeos 2.6.38.8-x86-2.10-01

My primary questions: Is there a possibility to have the rtdm driver compatible with both cases?

Well, yes, enable CONFIG_XENO_OPT_SHIRQ, and pass RTDM_IRQTYPE_SHARED when registering the irq handlers. And do not return XN_ISR_PROPAGATE.

Quoted 4 lines

Do I loose deterministic rt latency when there is no non-rt device? I think that all my interrupts should be handled by rt devices in such case, so no propagating to linux should happen. Am I wrong?

You are not wrong. But if you do not want propagation to linux, you should not return XN_ISR_PROPAGATE.

Signature · 1 line
                                                                Gilles.
#2 lore raw
Quoted 10 lines

Od: "Gilles Chanteperdrix" <[email protected]>
Komu: Petr Cervenka <[email protected]>
Datum: 11.10.2012 20:56
Předmět: Re: [Xenomai] Shared interrupts

CC: [email protected]

Quoted 3 lines · Petr Cervenka

I'm using xenomai 2.5.6, adeos 2.6.38.8-x86-2.10-01

Quoted 6 lines
Quoted 2 lines

My primary questions: Is there a possibility to have the rtdm driver compatible with both cases?

Well, yes, enable CONFIG_XENO_OPT_SHIRQ, and pass RTDM_IRQTYPE_SHARED when registering the irq handlers. And do not return XN_ISR_PROPAGATE.

Of course, I have enabled CONFIG_XENO_OPT_SHIRQ and I have passed RTDM_IRQTYPE_SHARED flag. But I can make running only one of those rt - nrt device combinations at a time. Two rt devices with shared IRQ work for me only when I do NOT return XN_ISR_PROPAGATE. Combination of rt and nrt device works only when I return XN_ISR_PROPAGATE.

Do I have something wrong in the other settings? Because it seems that an interrupt is spread among all rt devices (with same IRQ) and (perhaps) when there is one who doesn't handle it, it is propagated to linux and disabled. (In other words: one rt device handles interrupt, one not and than interrupt is disabled)

I think I want propagation of interrupt to linux, because if there is (rarely) a nrt device sharing same IRQ, it is usually critical for the PC to run.

Petr

#3 lore raw
Quoted 14 lines · Petr Cervenka
Quoted 14 lines

Od: "Gilles Chanteperdrix" <[email protected]>
Komu: Petr Cervenka <[email protected]>
Datum: 11.10.2012 20:56
Předmět: Re: [Xenomai] Shared interrupts

CC: [email protected]

Quoted 5 lines · Petr Cervenka

I'm using xenomai 2.5.6, adeos 2.6.38.8-x86-2.10-01

My primary questions: Is there a possibility to have the rtdm driver compatible with both cases?

Quoted 6 lines
Quoted 2 lines

Well, yes, enable CONFIG_XENO_OPT_SHIRQ, and pass RTDM_IRQTYPE_SHARED when registering the irq handlers. And do not return XN_ISR_PROPAGATE.

Of course, I have enabled CONFIG_XENO_OPT_SHIRQ and I have passed RTDM_IRQTYPE_SHARED flag. But I can make running only one of those rt - nrt device combinations at a time. Two rt devices with shared IRQ work for me only when I do NOT return XN_ISR_PROPAGATE.

That is the way it is supposed to work.

Quoted 1 line

Combination of rt and nrt device works only when I return XN_ISR_PROPAGATE.

Yes, I was talking about the rt devices only case. For the rt/nrt mixup, see the FAQ.

Signature · 1 line
					    Gilles.
#4 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

My primary questions: Is there a possibility to have the rtdm driver compatible with both cases?

So I assume, it is not possible.

Quoted 4 lines

Yes, I was talking about the rt devices only case. For the rt/nrt mixup, see the FAQ.

I have some suggestion on improvement in future version:
Allowing to setup for interrupt, that when no rt device handles the interrupt it could be passed to the linux. More specifically:
Similar flag to XN_ISR_PROPAGATE, but pass interrupt to linux only when it was not handled by any rt device at all.

Example:
Imagine system with 2 shared PCI slots (and no other). The user can use those slots for any combination of rt and nrt devices. This combination (or IRQ sharing) is not known in advance.

Petr

#5 lore raw
Quoted 6 lines · Petr Cervenka
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

My primary questions: Is there a possibility to have the rtdm driver compatible with both cases?

So I assume, it is not possible.

It is possible. What you want is, in case you have a nrt device, and in this case only, register a shared irq handler which simply returns XN_ISR_PROPAGATE | XN_ISR_NOENABLE, independently of the irq handler for the rt device.

But if you start doing that, it is probably better to do what is described in the FAQ (write an irq handler for the nrt device which really acknowledges the irq at device level, so that you can avoid returning XN_ISR_NOENABLE, and keep determinism).

Quoted 6 lines
Quoted 5 lines

Yes, I was talking about the rt devices only case. For the rt/nrt mixup, see the FAQ.

Quoted 7 lines

I have some suggestion on improvement in future version:
Allowing to setup for interrupt, that when no rt device handles the interrupt it could be passed to the linux. More specifically:
Similar flag to XN_ISR_PROPAGATE, but pass interrupt to linux only when it was not handled by any rt device at all.

Example:
Imagine system with 2 shared PCI slots (and no other). The user can use those slots for any combination of rt and nrt devices. This combination (or IRQ sharing) is not known in advance.

This will probably never happen. The case where rt/nrt devices are mixed up has absolutely no interest. If you do not need determinism for the rt device, do not use an rt driver.

Signature · 1 line
					    Gilles.