Skip to contentSkip to conversation

x86: revert IRQs replay order

PATCH In review Jan Kiszka 2 participants 4 messages Oct 20, 2006

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 x86: revert IRQs replay order

While digging into a latency issue with multiple IRQs pending (patch will likely follow soon), I noticed that the replay order on x86 is the inverse of the hardware order. Instead of iterating from lowest IRQ number to highest, ipipe currently starts with the highest one. The attached patch fixes this.

Jan

include/asm-i386/ipipe.h +1 -2
Index: linux-2.6.17.13/include/asm-i386/ipipe.h
===================================================================
@@ -242,8 +242,7 @@ extern int __ipipe_tick_irq;
 
 static inline unsigned long __ipipe_ffnz(unsigned long ul)
 {
-      __asm__("bsrl %1, %0":"=r"(ul)
-      :	"r"(ul));
+	__asm__("bsfl %1, %0":"=r"(ul):"r"(ul));
 	return ul;
 }
 
#1 lore raw
Quoted 6 lines · Jan Kiszka

While digging into a latency issue with multiple IRQs pending (patch will likely follow soon), I noticed that the replay order on x86 is the inverse of the hardware order. Instead of iterating from lowest IRQ number to highest, ipipe currently starts with the highest one. The attached patch fixes this.

We want to give a priority boost to virtual IRQs over real ones, at least for the root domain. Since virqs are high-numbered, bsrl has been used on purpose to scan the pending IRQ mask. Additionally, low-numbered IRQs have higher priority only if you consider the ISA ones as managed by the 8259. Bringing the APIC into the picture, the APIC-based timer IRQ used by RTOSes over Adeos is a high-numbered one.

Quoted 20 lines

Jan
plain text document attachment (fix-x86-irq-replay-order.patch)
Index: linux-2.6.17.13/include/asm-i386/ipipe.h
===================================================================

include/asm-i386/ipipe.h +1 -2
@@ -242,8 +242,7 @@ extern int __ipipe_tick_irq;
 
 static inline unsigned long __ipipe_ffnz(unsigned long ul)
 {
-      __asm__("bsrl %1, %0":"=r"(ul)
-      :	"r"(ul));
+	__asm__("bsfl %1, %0":"=r"(ul):"r"(ul));
 	return ul;
 }
 

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Signature · 1 line
Philippe.
author
#2 lore raw
Quoted 10 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

While digging into a latency issue with multiple IRQs pending (patch will likely follow soon), I noticed that the replay order on x86 is the inverse of the hardware order. Instead of iterating from lowest IRQ number to highest, ipipe currently starts with the highest one. The attached patch fixes this.

We want to give a priority boost to virtual IRQs over real ones, at least for the root domain. Since virqs are high-numbered, bsrl has been

Hmm, are the virtual IRQs differently numbered on blackfin? Because there we have ffs behind __ipipe_ffnz.

Quoted 4 lines

used on purpose to scan the pending IRQ mask. Additionally, low-numbered IRQs have higher priority only if you consider the ISA ones as managed by the 8259. Bringing the APIC into the picture, the APIC-based timer IRQ used by RTOSes over Adeos is a high-numbered one.

Ok, so there is no simple way to emulate reality, thus we can simply leave it as it is. No problem.

Jan

#3 lore raw
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

While digging into a latency issue with multiple IRQs pending (patch will likely follow soon), I noticed that the replay order on x86 is the inverse of the hardware order. Instead of iterating from lowest IRQ number to highest, ipipe currently starts with the highest one. The attached patch fixes this.

Quoted 6 lines
Quoted 2 lines

We want to give a priority boost to virtual IRQs over real ones, at least for the root domain. Since virqs are high-numbered, bsrl has been

Hmm, are the virtual IRQs differently numbered on blackfin? Because there we have ffs behind __ipipe_ffnz.

They are not, but the priority boost for virqs is most significant on x86, this is why I did not bothered that much for other archs, including on the Blackfin. The point is that we want the root domain to process virqs sent by the RTOSes running on higher domains asap, at least before long and costly Linux interrupt handlers may run; e.g. the IDE interrupt handler on x86 (which gets even worse if you run that in PIO mode). On the contrary, the Linux domain handlers over Adeos/Blackfin are threaded; only a very simple primary handler wakes up the IRQ thread, so the worst incurred delay before processing the virqs is known, short and limited.

Quoted 14 lines
Quoted 4 lines

used on purpose to scan the pending IRQ mask. Additionally, low-numbered IRQs have higher priority only if you consider the ISA ones as managed by the 8259. Bringing the APIC into the picture, the APIC-based timer IRQ used by RTOSes over Adeos is a high-numbered one.

Ok, so there is no simple way to emulate reality, thus we can simply leave it as it is. No problem.

Jan

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Signature · 1 line
Philippe.