Skip to contentSkip to conversation

IO-APIC stall due to broken fasteoi handling

Xenomai-core Jan Kiszka 3 participants 11 messages Oct 4, 2007 IRQ

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi all,

after a really long search I'm now quite sure to have found the reason for the lockups I'm seeing over 2.6.22-i386. I'm yet struggling to understand why this issue is not visible over 2.6.19 and .20 for me, but maybe it is just far less likely there.

Here is a short write-up of the I-pipe trace I was able to catch with some hacking from a locked up box:

Scenario: I-pipe active, Xenomai not loaded or compiled out (but loading Xenomai just increases the probability)

1. IRQ 20 arrives, Linux starts serving it, but no one talks to the IO-APIC so far because this is a fasteoi type IRQ.

2. Linux reenables IRQs due to IRQF_DISABLED not set for IRQ 20.

3. IRQ 23 arrives and gets delivered as it is of higher priority in the APIC. From this point on, things start to fall apart.

4. I-pipe stops the delivery in __ipipe_synch_stage because the IPIPE_SYNC_FLAG is still set for the root domain. Linux switches back to the IRQ 20 handler so that the usual handling order gets inverted -- the first I-pipe bug.

5. IRQ 20 completes and sends an EOI to the APIC. Linux means that this is for IRQ 20, but the APIC considers it for IRQ 23!

6. IRQ 23 is re-enabled and arrives before its last event was handled. Thus two IRQ-23-events get merged into one, and eoi is only executed once instead of twice. This causes all IRQs < 23 being blocked from now on. :(

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

These bugs should impact at least x86_64 as well, not sure about how powerpc looks like.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#1 lore raw
Quoted 18 lines · Jan Kiszka

Hi all,

after a really long search I'm now quite sure to have found the reason for the lockups I'm seeing over 2.6.22-i386. I'm yet struggling to understand why this issue is not visible over 2.6.19 and .20 for me, but maybe it is just far less likely there.

Here is a short write-up of the I-pipe trace I was able to catch with some hacking from a locked up box:

Scenario: I-pipe active, Xenomai not loaded or compiled out (but loading Xenomai just increases the probability)

1. IRQ 20 arrives, Linux starts serving it, but no one talks to the IO-APIC so far because this is a fasteoi type IRQ.

2. Linux reenables IRQs due to IRQF_DISABLED not set for IRQ 20.

Quoted 8 lines

3. IRQ 23 arrives and gets delivered as it is of higher priority in the APIC. From this point on, things start to fall apart.

4. I-pipe stops the delivery in __ipipe_synch_stage because the IPIPE_SYNC_FLAG is still set for the root domain. Linux switches back to the IRQ 20 handler so that the usual handling order gets inverted -- the first I-pipe bug.

This means that the synchronization flag must become a per-IRQ thing; it was introduced to prevent timer IRQs from piling up on behalf of the syncer on overloaded low-end hardware.

Quoted 8 lines

5. IRQ 20 completes and sends an EOI to the APIC. Linux means that this is for IRQ 20, but the APIC considers it for IRQ 23!

6. IRQ 23 is re-enabled and arrives before its last event was handled. Thus two IRQ-23-events get merged into one, and eoi is only executed once instead of twice. This causes all IRQs < 23 being blocked from now on. :(

Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Quoted 2 lines

These bugs should impact at least x86_64 as well, not sure about how powerpc looks like.

Powerpc has the same problem, even if it already mask+acks fasteois to prevent interrupt flooding on MPIC hardware.

Quoted 3 lines

Jan

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

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }
 
 static int ioapic_retrigger_irq(unsigned int irq)
kernel/irq/chip.c +7 -1
index ba497a7..1560b4a 100644
@@ -422,8 +422,13 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
+#ifdef CONFIG_IPIPE
+	desc->chip->unmask(irq);
+out:
+#else
 out:
 	desc->chip->eoi(irq);
+#endif
 
 	spin_unlock(&desc->lock);
 }
@@ -533,11 +538,12 @@ void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc)
 
 void fastcall __ipipe_ack_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
+	desc->chip->eoi(irq);
 }
 
 void fastcall __ipipe_end_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
-	desc->chip->eoi(irq);
+	desc->chip->unmask(irq);
 }
 
 void fastcall __ipipe_ack_edge_irq(unsigned irq, struct irq_desc *desc)
Signature · 1 line
Philippe.
author
#3 lore raw
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 7 lines
Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

Will give it a try later. Meanwhile...

arch/i386/kernel/io_apic.c static void ack_ioapic_quirk_irq(unsigned int irq) · line 2027

Quoted 12 lines
arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }

...I have problems understanding this hunk. Typo? Should this read __unmask_IO_APIC_irq?

Quoted 25 lines
arch/i386/kernel/io_apic.c +0 -0
 static int ioapic_retrigger_irq(unsigned int irq)
kernel/irq/chip.c +5 -0
index ba497a7..1560b4a 100644
@@ -422,8 +422,13 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
+#ifdef CONFIG_IPIPE
+	desc->chip->unmask(irq);
+out:
+#else
 out:
 	desc->chip->eoi(irq);
+#endif
 
 	spin_unlock(&desc->lock);
 }
@@ -533,11 +538,12 @@ void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc)
 
 void fastcall __ipipe_ack_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {

kernel/irq/chip.c void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc) · line 549

Quoted 10 lines
kernel/irq/chip.c +2 -1
+	desc->chip->eoi(irq);
 }
 
 void fastcall __ipipe_end_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
-	desc->chip->eoi(irq);
+	desc->chip->unmask(irq);
 }
 
 void fastcall __ipipe_ack_edge_irq(unsigned irq, struct irq_desc *desc)

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 19 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 7 lines
Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

Will give it a try later. Meanwhile...

Quoted 1 line
Quoted 15 lines

arch/i386/kernel/io_apic.c static void ack_ioapic_quirk_irq(unsigned int irq) · line 2027

Quoted 11 lines
arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }

...I have problems understanding this hunk. Typo? Should this read __unmask_IO_APIC_irq?

No, you want to mask it here. EOI in the IO-APIC case goes through some quirks which you want to apply immediately on behalf of the primary I-pipe ack handler, basically to work around some IO-APIC errata. Then, either the high priority domain (__ipipe_end_fasteoi_irq) or the root one (handle_fasteoi_irq) will unmask the IRQ as needed, whichever comes first (and only).

Quoted 38 lines
Quoted 25 lines
arch/i386/kernel/io_apic.c +0 -0
 static int ioapic_retrigger_irq(unsigned int irq)
kernel/irq/chip.c +5 -0
index ba497a7..1560b4a 100644
@@ -422,8 +422,13 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
+#ifdef CONFIG_IPIPE
+	desc->chip->unmask(irq);
+out:
+#else
 out:
 	desc->chip->eoi(irq);
+#endif
 
 	spin_unlock(&desc->lock);
 }
@@ -533,11 +538,12 @@ void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc)
 
 void fastcall __ipipe_ack_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {

kernel/irq/chip.c void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc) · line 549

Quoted 10 lines
kernel/irq/chip.c +2 -1
+	desc->chip->eoi(irq);
 }
 
 void fastcall __ipipe_end_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
-	desc->chip->eoi(irq);
+	desc->chip->unmask(irq);
 }
 
 void fastcall __ipipe_ack_edge_irq(unsigned irq, struct irq_desc *desc)

Jan

Signature · 1 line
Philippe.
author
#5 lore raw
Quoted 32 lines · Philippe Gerum
Quoted 16 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 6 lines
Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

Will give it a try later. Meanwhile...

Quoted 14 lines

arch/i386/kernel/io_apic.c static void ack_ioapic_quirk_irq(unsigned int irq) · line 2027

Quoted 11 lines
arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }

...I have problems understanding this hunk. Typo? Should this read __unmask_IO_APIC_irq?

Quoted 6 lines

No, you want to mask it here. EOI in the IO-APIC case goes through some quirks which you want to apply immediately on behalf of the primary I-pipe ack handler, basically to work around some IO-APIC errata. Then, either the high priority domain (__ipipe_end_fasteoi_irq) or the root one (handle_fasteoi_irq) will unmask the IRQ as needed, whichever comes first (and only).

ack_ioapic_quirk_irq == eio for fasteoi, so it is specifically executed on exit of handle_fasteoi_irq. I still don't see why you want to leave the IRQ masked here.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#6 lore raw
Quoted 40 lines · Jan Kiszka
Quoted 32 lines · Philippe Gerum
Quoted 16 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 6 lines
Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

Will give it a try later. Meanwhile...

Quoted 14 lines

arch/i386/kernel/io_apic.c static void ack_ioapic_quirk_irq(unsigned int irq) · line 2027

Quoted 11 lines
arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }

...I have problems understanding this hunk. Typo? Should this read __unmask_IO_APIC_irq?

Quoted 6 lines

No, you want to mask it here. EOI in the IO-APIC case goes through some quirks which you want to apply immediately on behalf of the primary I-pipe ack handler, basically to work around some IO-APIC errata. Then, either the high priority domain (__ipipe_end_fasteoi_irq) or the root one (handle_fasteoi_irq) will unmask the IRQ as needed, whichever comes first (and only).

Quoted 4 lines

ack_ioapic_quirk_irq == eio for fasteoi, so it is specifically executed on exit of handle_fasteoi_irq. I still don't see why you want to leave the IRQ masked here.

It is not executed on IRQ exit anymore when the I-pipe is enabled. The EOI handler is called earlier in the latter case to ack the LAPIC, then mask the interrupt source from the IO-APIC, waiting for the Linux handler to process the device which triggered the interrupt. The source is eventually unmasked when either the high priority domain or Linux is done with the interrupt.

Quoted 2 lines

Jan

Signature · 1 line
Philippe.
author
#7 lore raw
Quoted 44 lines · Philippe Gerum
Quoted 38 lines · Jan Kiszka
Quoted 31 lines · Philippe Gerum
Quoted 16 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 6 lines
Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

Will give it a try later. Meanwhile...

Quoted 14 lines

arch/i386/kernel/io_apic.c static void ack_ioapic_quirk_irq(unsigned int irq) · line 2027

Quoted 11 lines
arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }

...I have problems understanding this hunk. Typo? Should this read __unmask_IO_APIC_irq?

Quoted 6 lines

No, you want to mask it here. EOI in the IO-APIC case goes through some quirks which you want to apply immediately on behalf of the primary I-pipe ack handler, basically to work around some IO-APIC errata. Then, either the high priority domain (__ipipe_end_fasteoi_irq) or the root one (handle_fasteoi_irq) will unmask the IRQ as needed, whichever comes first (and only).

Quoted 4 lines

ack_ioapic_quirk_irq == eio for fasteoi, so it is specifically executed on exit of handle_fasteoi_irq. I still don't see why you want to leave the IRQ masked here.

Quoted 6 lines

It is not executed on IRQ exit anymore when the I-pipe is enabled. The EOI handler is called earlier in the latter case to ack the LAPIC, then mask the interrupt source from the IO-APIC, waiting for the Linux handler to process the device which triggered the interrupt. The source is eventually unmasked when either the high priority domain or Linux is done with the interrupt.

Ah, ok, too blind to see the full picture: handle_fasteoi_irq was changed in that direction.

Jan (who just kicked off a patched kernel rebuild)

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
author
#8 lore raw
In reply to Philippe Gerum
Quoted 51 lines · Philippe Gerum
Quoted 11 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }
 
 static int ioapic_retrigger_irq(unsigned int irq)
kernel/irq/chip.c +5 -0
index ba497a7..1560b4a 100644
@@ -422,8 +422,13 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
+#ifdef CONFIG_IPIPE
+	desc->chip->unmask(irq);
+out:
+#else
 out:
 	desc->chip->eoi(irq);
+#endif
 
 	spin_unlock(&desc->lock);
 }
@@ -533,11 +538,12 @@ void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc)
 
 void fastcall __ipipe_ack_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {

kernel/irq/chip.c void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc) · line 549

Quoted 10 lines
kernel/irq/chip.c +2 -1
+	desc->chip->eoi(irq);
 }
 
 void fastcall __ipipe_end_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
-	desc->chip->eoi(irq);
+	desc->chip->unmask(irq);
 }
 
 void fastcall __ipipe_ack_edge_irq(unsigned irq, struct irq_desc *desc)

Good news: The patches seems to stabilise the Xenomai-free use of I-pipe. I'm writing this mail while compiling a kernel on an i-pipe-enabled 2.6.22-box.

Bad news: Loading Xenomai still causes a hard reboot after while. Maybe I was too quick with re-importing the no-COW bits. Now trying to revert them again to check if they are still involved in nasty page faults...

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
author
#9 lore raw
Quoted 66 lines · Jan Kiszka
Quoted 50 lines · Philippe Gerum
Quoted 11 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }
 
 static int ioapic_retrigger_irq(unsigned int irq)
kernel/irq/chip.c +5 -0
index ba497a7..1560b4a 100644
@@ -422,8 +422,13 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
+#ifdef CONFIG_IPIPE
+	desc->chip->unmask(irq);
+out:
+#else
 out:
 	desc->chip->eoi(irq);
+#endif
 
 	spin_unlock(&desc->lock);
 }
@@ -533,11 +538,12 @@ void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc)
 
 void fastcall __ipipe_ack_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {

kernel/irq/chip.c void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc) · line 549

Quoted 10 lines
kernel/irq/chip.c +2 -1
+	desc->chip->eoi(irq);
 }
 
 void fastcall __ipipe_end_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
-	desc->chip->eoi(irq);
+	desc->chip->unmask(irq);
 }
 
 void fastcall __ipipe_ack_edge_irq(unsigned irq, struct irq_desc *desc)

Good news: The patches seems to stabilise the Xenomai-free use of I-pipe. I'm writing this mail while compiling a kernel on an i-pipe-enabled 2.6.22-box.

Quoted 3 lines

Bad news: Loading Xenomai still causes a hard reboot after while. Maybe I was too quick with re-importing the no-COW bits. Now trying to revert them again to check if they are still involved in nasty page faults...

No-COW: not guilty.

The system still reboots or locks up when I modprobe e.g. xeno_rtdm before logging into X. I threw my laptop in some corner (other work is calling), but I will try to look into this over the weekend or so. I'm hoping we still get oopses/backtraces/whatever.

Jan

#10 lore raw
In reply to Philippe Gerum
Quoted 51 lines · Philippe Gerum
Quoted 7 lines · Philippe Gerum
Quoted 6 lines

Well, this trace also reveals a second bug that can cause nasty priority
inversion: a high-prio domains executes when a fasteoi-IRQ arrives for a low-prio domain. This will now block all IRQs until the low-prio domain was able to run its IRQ handler completely. Thus we must _mask_ fasteoi IRQs for low-prio domains while high-prio ones are running!

Quoted 5 lines

This code was actually there up to 2.6.17-1.5-02, and was removed at some point in the 2.6.19 series, due to some severe conflicts with the vanilla IO-APIC support which used to be a hell of a moving target at that time. I guess it's time to bring this code back.

Does the following work for you?

arch/i386/kernel/io_apic.c +2 -0
index 2ae79e9..517937b 100644
@@ -2022,6 +2022,8 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
 		__unmask_and_level_IO_APIC_irq(irq);
 		spin_unlock(&ioapic_lock);
 	}
+
+	__mask_IO_APIC_irq(irq);
 }
 
 static int ioapic_retrigger_irq(unsigned int irq)
kernel/irq/chip.c +5 -0
index ba497a7..1560b4a 100644
@@ -422,8 +422,13 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
+#ifdef CONFIG_IPIPE
+	desc->chip->unmask(irq);
+out:
+#else
 out:
 	desc->chip->eoi(irq);
+#endif
 
 	spin_unlock(&desc->lock);
 }
@@ -533,11 +538,12 @@ void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc)
 
 void fastcall __ipipe_ack_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {

kernel/irq/chip.c void fastcall __ipipe_end_level_irq(unsigned irq, struct irq_desc *desc) · line 549

Quoted 10 lines
kernel/irq/chip.c +2 -1
+	desc->chip->eoi(irq);
 }
 
 void fastcall __ipipe_end_fasteoi_irq(unsigned irq, struct irq_desc *desc)
 {
-	desc->chip->eoi(irq);
+	desc->chip->unmask(irq);
 }
 
 void fastcall __ipipe_ack_edge_irq(unsigned irq, struct irq_desc *desc)

FWIW, this patche fixes my known-to-crash I-pipe 2.6.20 configuration.

Signature · 1 line
					    Gilles Chanteperdrix.