2.6.18-rt7: PowerPC: fix breakage in threaded fasteoi type IRQ handlers
Subsystems (3)
PATCH 1/1 2.6.18-rt7: PowerPC: fix breakage in threaded fasteoi type IRQ handlers
As fasteoi type chips never had to define their ack() method before the recent Ingo's change to handle_fasteoi_irq(), any attempt to execute handler in thread resulted in the kernel crash. So, define their ack() methods to be the same as their eoi() ones...
---
Since there was no feedback on three solutions I suggested, I'm going the way of least resistance and making the fasteoi type chips behave the way that handle_fasteoi_irq() is expecting from them...
arch/powerpc/platforms/cell/interrupt.c | 1 + arch/powerpc/platforms/iseries/irq.c | 1 + arch/powerpc/platforms/pseries/xics.c | 2 ++ arch/powerpc/sysdev/mpic.c | 1 + 4 files changed, 5 insertions(+)
arch/powerpc/platforms/cell/interrupt.c +1 -0
@@ -83,6 +83,7 @@ static struct irq_chip iic_chip = { .typename = " CELL-IIC ", .mask = iic_mask, .unmask = iic_unmask, + .ack = iic_eoi, .eoi = iic_eoi, };
arch/powerpc/platforms/iseries/irq.c +1 -0
@@ -282,6 +282,7 @@ static struct irq_chip iseries_pic = { .shutdown = iseries_shutdown_IRQ, .unmask = iseries_enable_IRQ, .mask = iseries_disable_IRQ, + .ack = iseries_end_IRQ, .eoi = iseries_end_IRQ };
arch/powerpc/platforms/pseries/xics.c +2 -0
@@ -477,6 +477,7 @@ static struct irq_chip xics_pic_direct = .startup = xics_startup, .mask = xics_mask_irq, .unmask = xics_unmask_irq, + .ack = xics_eoi_direct, .eoi = xics_eoi_direct, .set_affinity = xics_set_affinity };
@@ -487,6 +488,7 @@ static struct irq_chip xics_pic_lpar = { .startup = xics_startup, .mask = xics_mask_irq, .unmask = xics_unmask_irq, + .ack = xics_eoi_lpar, .eoi = xics_eoi_lpar, .set_affinity = xics_set_affinity };
arch/powerpc/sysdev/mpic.c +1 -0
@@ -718,6 +718,7 @@ static int mpic_set_irq_type(unsigned instatic struct irq_chip mpic_irq_chip = { .mask = mpic_mask_irq, .unmask = mpic_unmask_irq, + .ack = mpic_end_irq, .eoi = mpic_end_irq, .set_type = mpic_set_irq_type, };
Quoted 11 lines · Sergei Shtylyov
As fasteoi type chips never had to define their
ack()method before the recent Ingo's change tohandle_fasteoi_irq(), any attempt to execute handler in thread resulted in the kernel crash. So, define theirack()methods to be the same as theireoi()ones...Signed-off-by Sergei Shtylyov <[email protected]>---
Since there was no feedback on three solutions I suggested, I'm going the way of least resistance and making the fasteoi type chips behave the way thathandle_fasteoi_irq()is expecting from them...
Wait wait wait .... Can somebody (Ingo ?) explain me why the fasteoi handler is being changed and what is the rationale for adding an ack that was not necessary before ?
Cheers,
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines · Sergei Shtylyov
As fasteoi type chips never had to define their
ack()method before the recent Ingo's change tohandle_fasteoi_irq(), any attempt to execute handler in thread resulted in the kernel crash. So, define theirack()methods to be the same as theireoi()ones...Signed-off-by Sergei Shtylyov <[email protected]>
Quoted 8 lines
Quoted 4 lines
---
Since there was no feedback on three solutions I suggested, I'm going the way of least resistance and making the fasteoi type chips behave the way thathandle_fasteoi_irq()is expecting from them...Wait wait wait .... Can somebody (Ingo ?) explain me why the fasteoi handler is being changed and what is the rationale for adding an ack that was not necessary before ?
To be more precise, I don't see in what circumstances a fasteoi type PIC would need an ack routine that does something different than the eoi... and if it always does the same thing, why not just call eoi ?
Ben.
Hello.
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines
Quoted 6 lines
As fasteoi type chips never had to define their
ack()method before the recent Ingo's change tohandle_fasteoi_irq(), any attempt to execute handler in thread resulted in the kernel crash. So, define theirack()methods to be the same as theireoi()ones...Signed-off-by Sergei Shtylyov <[email protected]>
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
---
Since there was no feedback on three solutions I suggested, I'm going the way of least resistance and making the fasteoi type chips behave the way thathandle_fasteoi_irq()is expecting from them...Wait wait wait .... Can somebody (Ingo ?) explain me why the fasteoi handler is being changed and what is the rationale for adding an ack that was not necessary before ?
It's changed in the RT patch for the case of threaded IRQ. This patch is
not for the mainline kernels.
Quoted 3 lines
To be more precise, I don't see in what circumstances a fasteoi type PIC would need an ack routine that does something different than the eoi... and if it always does the same thing, why not just call eoi ?
Because Ingo decided that calling mask() and ack() methods was a better
than calling mask() and eoi(). Here's the thread:
http://ozlabs.org/pipermail/linuxppc-dev/2006-October/026546.html
Quoted 1 line
Ben.
WBR, Sergei
Quoted 3 lines · Benjamin Herrenschmidt
Wait wait wait .... Can somebody (Ingo ?) explain me why the fasteoi handler is being changed and what is the rationale for adding an ack that was not necessary before ?
dont worry, it's -rt only stuff.
Ingo
Quoted 7 lines · Ingo Molnar
Quoted 3 lines · Benjamin Herrenschmidt
Wait wait wait .... Can somebody (Ingo ?) explain me why the fasteoi handler is being changed and what is the rationale for adding an ack that was not necessary before ?
dont worry, it's -rt only stuff.
Still, I'm curious :-) Besides, there have been people talking about having -rt work on ppc64 so ...
What do you need an ack() for on fasteoi ? On all fasteoi controllers I have, ack is implicit by obtaining the vector number and all there is is an eoi...
Cheers,
Ben.
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 1 line
dont worry, it's -rt only stuff.
Still, I'm curious :-) Besides, there have been people talking about having -rt work on ppc64 so ...
ok :)
Quoted 3 lines
What do you need an
ack()for on fasteoi ? On all fasteoi controllers I have, ack is implicit by obtaining the vector number and all there is is an eoi...
it's a compatibility hack only. Threaded handlers are a different type of flow, but often the fasteoi handler is not changed to the threaded handler so i changed it to be a threaded handler too.
threaded handlers need a mask() + an ack(), because that's the correct model to map them to kernel threads - threaded handlers can be delayed for a long time if something higher-prio is preempting them.
Ingo
Hello.
Quoted 3 lines · Ingo Molnar
Quoted 1 line
What do you need an
ack()for on fasteoi ? On all fasteoi controllers I have, ack is implicit by obtaining the vector number and all there is is an eoi...it's a compatibility hack only. Threaded handlers are a different type of flow, but often the fasteoi handler is not changed to the threaded handler so i changed it to be a threaded handler too.
The fasteoi flow seem to only had been used for x86 IOAPIC in the RT patch
only *before* PPC took to using them in the mainline...
Quoted 1 line
threaded handlers need a
mask()+ anack(), because that's the correct
Not all of them. This could be customized on type-by-type basis. I.e. we
could call eoi() instead of ack() for fasteoi chips without having to resort to the duplicated ack/eoi handlers.
Quoted 3 lines
model to map them to kernel threads - threaded handlers can be delayed for a long time if something higher-prio is preempting them.
Ingo
WBR, Sergei
Quoted 2 lines · Sergei Shtylyov
The fasteoi flow seem to only had been used for x86 IOAPIC in the RT patch
only *before* PPC took to using them in the mainline...
I don't think so, I asked for the fasteoi to be created while porting ppc to genirq :-)
Quoted 5 lines
Quoted 1 line
threaded handlers need a
mask()+ anack(), because that's the correctNot all of them. This could be customized on type-by-type basis. I.e. we
could calleoi()instead ofack()for fasteoi chips without having to resort to the duplicated ack/eoi handlers.
I still don't see how ack() makes sense in the context of a fasteoi... You can either just not EOI until it's handled, but you'll indeed introduce delays for other interrupts of the same priority or lower, or you can mask() and then eoi(), which is, I think, what Apple does, to deliver the interrupt to a thread (and later unmask).
In any case, I don't see the need for a separate ack().
Ben.
Hello.
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines
The fasteoi flow seem to only had been used for x86 IOAPIC in the RT patch
only *before* PPC took to using them in the mainline...I don't think so, I asked for the fasteoi to be created while porting ppc to genirq :-)
Oh, I was unaware of such details. :-)
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
threaded handlers need a
mask()+ anack(), because that's the correctNot all of them. This could be customized on type-by-type basis. I.e. we
could calleoi()instead ofack()for fasteoi chips without having to resort to the duplicated ack/eoi handlers.I still don't see how
ack()makes sense in the context of a fasteoi...
It doesn't make sense even in the context of 8259 with its level/edge
flows. That's what I'm talking about...
Quoted 5 lines
You can either just not EOI until it's handled, but you'll indeed introduce delays for other interrupts of the same priority or lower, or you can
mask()and theneoi(), which is, I think, what Apple does, to deliver the interrupt to a thread (and later unmask).
In any case, I don't see the need for a separateack().
Yeah, that's what the threaded versions of flow handlers are doing. Except
they're calling ack() to actually EOI an IRQ.
Quoted 1 line
Ben.
WBR, Sergei
Quoted 3 lines
Yeah, that's what the threaded versions of flow handlers are doing. Except
they're callingack()to actually EOI an IRQ.
Ok well, them the fix is to fix them not the PIC code :-)
Ben.
Quoted 13 lines · Ingo Molnar
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 1 line
dont worry, it's -rt only stuff.
Still, I'm curious :-) Besides, there have been people talking about having -rt work on ppc64 so ...
ok :)
Quoted 3 lines
What do you need an
ack()for on fasteoi ? On all fasteoi controllers I have, ack is implicit by obtaining the vector number and all there is is an eoi...
Quoted 7 lines
it's a compatibility hack only. Threaded handlers are a different type of flow, but often the fasteoi handler is not changed to the threaded handler so i changed it to be a threaded handler too.
threaded handlers need a
mask()+ anack(), because that's the correct model to map them to kernel threads - threaded handlers can be delayed for a long time if something higher-prio is preempting them.
Well, the principle of controllers that do fasteoi is that all interrupts of the same priority or below are masked until eoi happens... so I still don't see why you need that...
Ben.
Quoted 8 lines
it's a compatibility hack only. Threaded handlers are a different type of flow, but often the fasteoi handler is not changed to the threaded handler so i changed it to be a threaded handler too.
threaded handlers need a
mask()+ anack(), because that's the correct model to map them to kernel threads - threaded handlers can be delayed for a long time if something higher-prio is preempting them.
I've re-read the old thread and I disagree with you there. I think the right approach was proposed initially by Daniel Walker.
If my understanding of "threaded handlers" is correct, that is delaying the delivery of the interrupt to a thread while restoring the ability to process further interrupts of the same or lower priority immediately.
There is no such thing as an explicit "ack" on fasteoi controllers. The ack is implicit with the reading of the vector (either via a special cycle on the bus or via reading the intack register for example on mpic).
So by doing a mask followed by an eoi, you essentially mask the interrupt preventing further delivery of that interrupt and lower the CPU priority in the PIC thus allowing processing of further interrupts.
Are there other fasteoi controllers than the ones I have on powerpc anyway ?
There is one thing I disagree with in the initial patch from Daniel however, it's the fact that he can't deal with fasteoi handlers that have no mask/unmask.
I have such a controller, on Cell, though currently I do have an empty mask and unmask for it, I've been thinking about removing them (and fixing callers to test for NULL). This is the Cell's top level controller and it is edge only (at this level, on Cell, all interrupts are messages).
Thus it can perfectly well cope with soft-masking (delayed disable if you prefer) and that is compatible with using a fasteoi handler. There should be no reason why that wouldn't work for -rt as well.
Ben.
Quoted 4 lines · Benjamin Herrenschmidt
If my understanding of "threaded handlers" is correct, that is delaying the delivery of the interrupt to a thread while restoring the ability to process further interrupts of the same or lower priority immediately.
correct. It's basically a different type of 'flow' of handling an interrupt. It's a host-side genirq-level detail that should have no irqchip level impact at all.
The only detail is that sometimes a threaded flow /cannot/ be implemented if the irqchip lacks certain methods. (such as a mask/unmask)
i.e. Sergei's patch tweaking the irqchip data structures is wrong - the correct approach is what i do for i386/x86_64: install a different "threaded" flow handler. I prefer this to tweaking the existing 'fasteoi' handler, to make the act of supporting a threaded flow design explicit. (and to allow a mixed threaded/non-threaded flow setup) I didnt take Daniel's prior patch for that reason: he tried to tweak the fasteoi flow handler - which is an almost good approach but not good enough :-)
Quoted 4 lines
There is no such thing as an explicit "ack" on fasteoi controllers. The ack is implicit with the reading of the vector (either via a special cycle on the bus or via reading the intack register for example on mpic).
well, even if it's coupled to the reading of the vector, there is an ack initiated by the host. This is not really a fundamental thing, it's API semantics of the hardware interface.
so the question is not 'is there an ACK' (all non-MSI-type-of IRQ delivery mechanisms have some sort of ACK mechanism), but what is the precise structure of ACK-ing an IRQ that the host recieves.
on PPC64, 'get the vector' initiates an ACK as well - is that done before handle_irq() is done?
Quoted 4 lines
So by doing a mask followed by an eoi, you essentially mask the interrupt preventing further delivery of that interrupt and lower the CPU priority in the PIC thus allowing processing of further interrupts.
correct, that's what should happen.
Quoted 2 lines
Are there other fasteoi controllers than the ones I have on powerpc anyway ?
well, if you mean the x86 APICs, there you get the vector 'for free' as part of the IRQ entry call sequence, and there's an EOI register in the local APIC that notifies the IRQ hardware, lowers the CPU priority, etc. We have that as an ->eoi handler right now.
Ingo
Hello.
Quoted 1 line · Ingo Molnar
i.e. Sergei's patch tweaking the irqchip data structures is wrong - the correct approach is what i do for i386/x86_64: install a different "threaded" flow handler.
Let me remind you that the patch was following *your* change inhandle_fasteoi_irq(). Do not present it as my own invention.
Quoted 1 line
I prefer this to tweaking the existing 'fasteoi' handler, to make the act of supporting a threaded flow design
You do, indeed? :-)
Quoted 1 line
explicit. (and to allow a mixed threaded/non-threaded flow setup) I didnt take Daniel's prior patch for that reason: he tried to tweak the fasteoi flow handler - which is an almost good approach but not good enough :-)
Yeah, your way was *really* better. :-/
Quoted 1 line
on PPC64, 'get the vector' initiates an ACK as well - is that done before
handle_irq()is done?
Exactly. How else do_IRQ() would know the vector?
Quoted 3 lines
Quoted 1 line
So by doing a mask followed by an eoi, you essentially mask the interrupt preventing further delivery of that interrupt and lower the CPU priority in the PIC thus allowing processing of further interrupts.
correct, that's what should happen.
eoi() would be a more proper name than ack() then.
Quoted 3 lines
Quoted 1 line
Are there other fasteoi controllers than the ones I have on powerpc anyway ?
well, if you mean the x86 APICs, there you get the vector 'for free' as part of the IRQ entry call sequence, and there's an EOI register in the local APIC that notifies the IRQ hardware, lowers the CPU priority, etc. We have that as an ->eoi handler right now.
Yes. And my perception from that fragment of RT patch was that fasteoi was
targeted only at SMP interrupt controllers which like IOAPIC are sensible enough to not trouble the other CPUs with an interrupt that's already been taken by a certain CPU for handling, i.e. that interrupt being effectively masked off until EOI arrives (well, that's so for the level triggered but not the edge-triggered IRQs, if I don't mistake), so there's no need for explicit masking and at the same time that interrupt isn't hindering the delivery of the lower-priority interrupts to any CPU (unlike that would be happening with 8259)...
Now it turns out that my understading was wrong, and fasteoi could even
fit for 8259 (according to Ben)?
Quoted 1 line
Ingo
WBR, Sergei
Quoted 4 lines · Sergei Shtylyov
Quoted 2 lines
on PPC64, 'get the vector' initiates an ACK as well - is that done before
handle_irq()is done?Exactly. How else
do_IRQ()would know the vector?
the reason i'm asking is that in this case masking is a bit late at this point and there's a chance for a repeat interrupt.
Ingo
Hello.
Quoted 5 lines · Ingo Molnar
Quoted 3 lines
Quoted 1 line
on PPC64, 'get the vector' initiates an ACK as well - is that done before
handle_irq()is done?Exactly. How else
do_IRQ()would know the vector?the reason i'm asking is that in this case masking is a bit late at this point and there's a chance for a repeat interrupt.
How's that? Acknowledge != EOI on OpenPIC (as well as 8259). Acknoledging sets the bit in the in-service register preventing all the
interrupts with same or lower prioriry from being accepted.
Quoted 1 line
Ingo
WBR, Sergei
Quoted 7 lines · Sergei Shtylyov
Hello.
Quoted 2 lines · Ingo Molnar
Quoted 2 lines
Quoted 2 lines
on PPC64, 'get the vector' initiates an ACK as well - is that done before
handle_irq()is done?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Exactly. How else
do_IRQ()would know the vector?the reason i'm asking is that in this case masking is a bit late at this point and there's a chance for a repeat interrupt.
How's that? Acknowledge != EOI on OpenPIC (as well as 8259).
Acknoledging sets the bit in the in-service register preventing all the interrupts with same or lower prioriry from being accepted.
ah, ok. The x86 APIC does that automatically, and only an EOI has to be passed. So i guess we are in wild agreement ;)
i'm hacking up something now to see whether it makes sense to introduce a central threaded flow type, or whether it's better the branch off the current flow types (as the code does it right now).
Ingo
Quoted 3 lines · Ingo Molnar
i'm hacking up something now to see whether it makes sense to introduce a central threaded flow type, or whether it's better the branch off the current flow types (as the code does it right now).
ok, a central flow type caused more problems than good - the main complication is that the handler needs to know the true 'flow' (edge/level/fasteoi, etc.) anyway, even in the threaded case.
So i rather went on making the existing flow handlers more threading-friendly, and undoing the x86_64 and i386 arch changes to make sure that the default handlers all work fine. Does the patch below (against -rt4) do the trick for your on PPC too?
[ also, i excluded old-style do_IRQ() platforms from irq threading -
those hopelessly mix all the flow types that makes robust threading support not really possible. ]
Ingo
arch/i386/kernel/io_apic.c +4 -14
@@ -1272,22 +1272,12 @@ static struct irq_chip ioapic_chip;static void ioapic_register_intr (int irq,int vector,unsigned long trigger) {if ((trigger ==IOAPIC_AUTO &&IO_APIC_irq_trigger (irq)) || - trigger ==IOAPIC_LEVEL ) { -#ifdef CONFIG_PREEMPT_HARDIRQS + trigger ==IOAPIC_LEVEL )set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_level_irq,"level-threaded" ); -#else -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_fasteoi_irq,"fasteoi" ); -#endif - }else { -#ifdef CONFIG_PREEMPT_HARDIRQS + handle_fasteoi_irq,"fasteoi" ); +else {set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge-threaded" ); -#else -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge" ); -#endif + handle_edge_irq,"edge" ); }set_intr_gate (vector, interrupt[irq]); }
arch/x86_64/kernel/io_apic.c +2 -12
@@ -787,22 +787,12 @@ static struct irq_chip ioapic_chip;static void ioapic_register_intr (int irq,int vector,unsigned long trigger) {if ((trigger ==IOAPIC_AUTO &&IO_APIC_irq_trigger (irq)) || - trigger ==IOAPIC_LEVEL ) { -#ifdef CONFIG_PREEMPT_HARDIRQS -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_level_irq,"level-threaded" ); -#else + trigger ==IOAPIC_LEVEL )set_irq_chip_and_handler_name (irq, &ioapic_chip, handle_fasteoi_irq,"fasteoi" ); -#endif - }else { -#ifdef CONFIG_PREEMPT_HARDIRQS -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge-threaded" ); -#else +else {set_irq_chip_and_handler_name (irq, &ioapic_chip, handle_edge_irq,"edge" ); -#endif } }
kernel/Kconfig.preempt +1 -1
@@ -105,7 +105,7 @@ config PREEMPT_SOFTIRQS config PREEMPT_HARDIRQS bool "Thread Hardirqs" default n -# depends on PREEMPT + depends on !GENERIC_HARDIRQS_NO__DO_IRQ help This option reduces the latency of the kernel by 'threading' hardirqs. This means that all (or selected) hardirqs will run
kernel/irq/chip.c +4 -2
@@ -238,8 +238,10 @@ static inline void mask_ack_irq(struct iif (desc->chip->mask_ack) desc->chip->mask_ack (irq);else { - desc->chip->mask (irq); - desc->chip->ack (irq); +if (desc->chip->mask) + desc->chip->mask (irq); +if (desc->chip->mask) + desc->chip->ack (irq); } }
kernel/irq/handle.c +0 -7
@@ -266,12 +266,6 @@ fastcall notrace unsigned int __do_IRQ(u goto out;/* -* hardirq redirection to the irqd process context: -*/ -if (redirect_hardirq (desc)) - goto out_no_end; - -/* * Edge triggered interrupts need to remember * pending events. * This applies to any hw interrupts that allow a second
@@ -303,7 +297,6 @@ out:* disabled while the handler was running. */ desc->chip->end (irq); -out_no_end:spin_unlock (&desc->lock);return 1 ;
Quoted 6 lines · Ingo Molnar
Index:
linux/kernel/irq/chip.c
===================================================================kernel/irq/chip.c +0
-0@@ -238,8 +238,10 @@ static inline void mask_ack_irq(struct iif (desc->chip->mask_ack)
kernel/irq/chip.c static inline void mask_ack_irq(struct i · line 246
Quoted 10 lines
kernel/irq/chip.c +4
-2desc->chip->mask_ack (irq); else { - desc->chip->mask (irq); - desc->chip->ack (irq); +if (desc->chip->mask) + desc->chip->mask (irq); +if (desc->chip->mask) + desc->chip->ack (irq); } }
Did you mean to check ->mask both times here?
Daniel
Quoted 10 lines · Daniel Walker
Review
Quoted 8 lines
(quoted diff) +4
-2- desc->chip->mask(irq); - desc->chip->ack(irq); + if (desc->chip->mask) + desc->chip->mask(irq); + if (desc->chip->mask) + desc->chip->ack(irq); } }Did you mean to check ->mask both times here?
good catch - fixed patch below.
Ingo
arch/i386/kernel/io_apic.c +4 -14
@@ -1272,22 +1272,12 @@ static struct irq_chip ioapic_chip;static void ioapic_register_intr (int irq,int vector,unsigned long trigger) {if ((trigger ==IOAPIC_AUTO &&IO_APIC_irq_trigger (irq)) || - trigger ==IOAPIC_LEVEL ) { -#ifdef CONFIG_PREEMPT_HARDIRQS + trigger ==IOAPIC_LEVEL )set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_level_irq,"level-threaded" ); -#else -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_fasteoi_irq,"fasteoi" ); -#endif - }else { -#ifdef CONFIG_PREEMPT_HARDIRQS + handle_fasteoi_irq,"fasteoi" ); +else {set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge-threaded" ); -#else -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge" ); -#endif + handle_edge_irq,"edge" ); }set_intr_gate (vector, interrupt[irq]); }
arch/x86_64/kernel/io_apic.c +2 -12
@@ -787,22 +787,12 @@ static struct irq_chip ioapic_chip;static void ioapic_register_intr (int irq,int vector,unsigned long trigger) {if ((trigger ==IOAPIC_AUTO &&IO_APIC_irq_trigger (irq)) || - trigger ==IOAPIC_LEVEL ) { -#ifdef CONFIG_PREEMPT_HARDIRQS -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_level_irq,"level-threaded" ); -#else + trigger ==IOAPIC_LEVEL )set_irq_chip_and_handler_name (irq, &ioapic_chip, handle_fasteoi_irq,"fasteoi" ); -#endif - }else { -#ifdef CONFIG_PREEMPT_HARDIRQS -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge-threaded" ); -#else +else {set_irq_chip_and_handler_name (irq, &ioapic_chip, handle_edge_irq,"edge" ); -#endif } }
kernel/Kconfig.preempt +1 -1
@@ -105,7 +105,7 @@ config PREEMPT_SOFTIRQS config PREEMPT_HARDIRQS bool "Thread Hardirqs" default n -# depends on PREEMPT + depends on !GENERIC_HARDIRQS_NO__DO_IRQ help This option reduces the latency of the kernel by 'threading' hardirqs. This means that all (or selected) hardirqs will run
kernel/irq/chip.c +4 -2
@@ -238,8 +238,10 @@ static inline void mask_ack_irq(struct iif (desc->chip->mask_ack) desc->chip->mask_ack (irq);else { - desc->chip->mask (irq); - desc->chip->ack (irq); +if (desc->chip->mask) + desc->chip->mask (irq); +if (desc->chip->ack) + desc->chip->ack (irq); } }
kernel/irq/handle.c +0 -7
@@ -266,12 +266,6 @@ fastcall notrace unsigned int __do_IRQ(u goto out;/* -* hardirq redirection to the irqd process context: -*/ -if (redirect_hardirq (desc)) - goto out_no_end; - -/* * Edge triggered interrupts need to remember * pending events. * This applies to any hw interrupts that allow a second
@@ -303,7 +297,6 @@ out:* disabled while the handler was running. */ desc->chip->end (irq); -out_no_end:spin_unlock (&desc->lock);return 1 ;
Hello.
Quoted 5 lines · Ingo Molnar
Quoted 1 line
i'm hacking up something now to see whether it makes sense to introduce a central threaded flow type, or whether it's better the branch off the current flow types (as the code does it right now).
ok, a central flow type caused more problems than good - the main complication is that the handler needs to know the true 'flow' (edge/level/fasteoi, etc.) anyway, even in the threaded case.
So i rather went on making the existing flow handlers more threading-friendly, and undoing the
x86_64and i386 arch changes to make sure that the default handlers all work fine. Does the patch below (against -rt4) do the trick for your on PPC too?
Not without my patch.
Quoted 20 lines
Ingo
Index:
linux/arch/i386/kernel/io_apic.c
===================================================================arch/i386/kernel/io_apic.c +1
-8@@ -1272,22 +1272,12 @@ static struct irq_chip ioapic_chip;static void ioapic_register_intr (int irq,int vector,unsigned long trigger) {if ((trigger ==IOAPIC_AUTO &&IO_APIC_irq_trigger (irq)) || - trigger ==IOAPIC_LEVEL ) { -#ifdef CONFIG_PREEMPT_HARDIRQS + trigger ==IOAPIC_LEVEL ) set_irq_chip_and_handler_name(irq, &ioapic_chip, - handle_level_irq,"level-threaded" ); -#else -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_fasteoi_irq,"fasteoi" ); -#endif - }else {
arch/i386/kernel/io_apic.c static struct irq_chip ioapic_chip; · line 1280
Quoted 10 lines
arch/i386/kernel/io_apic.c +3
-6-#ifdef CONFIG_PREEMPT_HARDIRQS + handle_fasteoi_irq, "fasteoi"); + else {set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge-threaded" ); -#else -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge" ); -#endif + handle_edge_irq,"edge" );
Hm, why force edge flow on edge-triggered IRQs?
Quoted 18 lines
arch/i386/kernel/io_apic.c +0
-0}set_intr_gate (vector, interrupt[irq]); }Index:
linux/arch/x86_64/kernel/io_apic.c
===================================================================arch/x86_64/kernel/io_apic.c +1
-5@@ -787,22 +787,12 @@ static struct irq_chip ioapic_chip;static void ioapic_register_intr (int irq,int vector,unsigned long trigger) {if ((trigger ==IOAPIC_AUTO &&IO_APIC_irq_trigger (irq)) || - trigger ==IOAPIC_LEVEL ) { -#ifdef CONFIG_PREEMPT_HARDIRQS -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_level_irq,"level-threaded" ); -#else + trigger ==IOAPIC_LEVEL ) set_irq_chip_and_handler_name(irq, &ioapic_chip,
arch/x86_64/kernel/io_apic.c static struct irq_chip ioapic_chip; · line 795
Quoted 10 lines
arch/x86_64/kernel/io_apic.c +1
-6handle_fasteoi_irq, "fasteoi"); -#endif - }else { -#ifdef CONFIG_PREEMPT_HARDIRQS -set_irq_chip_and_handler_name (irq, &ioapic_chip, - handle_edge_irq,"edge-threaded" ); -#else + else {set_irq_chip_and_handler_name (irq, &ioapic_chip, handle_edge_irq,"edge" );
Same here...
Quoted 10 lines
arch/x86_64/kernel/io_apic.c +0
-1-#endif } }Index:
linux/kernel/irq/chip.c
===================================================================kernel/irq/chip.c +0
-0@@ -238,8 +238,10 @@ static inline void mask_ack_irq(struct iif (desc->chip->mask_ack)
kernel/irq/chip.c static inline void mask_ack_irq(struct i · line 246
Quoted 10 lines
kernel/irq/chip.c +4
-2desc->chip->mask_ack (irq); else { - desc->chip->mask (irq); - desc->chip->ack (irq); +if (desc->chip->mask) + desc->chip->mask (irq); +if (desc->chip->mask) + desc->chip->ack (irq); } }
Hmm, that just won't do for PPC threaded fasteoi flows! What you'll get is
a threaded IRQ with EOI *never ever* issued, unless my PPC patch is also in...
WBR, Sergei
Quoted 7 lines · Sergei Shtylyov
Review
Quoted 5 lines
(quoted diff) +1
-4-#else - set_irq_chip_and_handler_name(irq, &ioapic_chip, - handle_edge_irq, "edge"); -#endif + handle_edge_irq, "edge");Hm, why force edge flow on edge-triggered IRQs?
it doesnt do that. This, ontop of -rt4 restores it to the vanilla arch code.
Quoted 7 lines
Quoted 7 lines
if (desc->chip->mask_ack) desc->chip->mask_ack(irq); else {(quoted diff) +2
-2- desc->chip->mask(irq); - desc->chip->ack(irq); + if (desc->chip->mask) + desc->chip->mask(irq);
Quoted 8 lines
Quoted 4 lines
(quoted diff) +2
-0+ if (desc->chip->mask) + desc->chip->ack(irq);} }Hmm, that just won't do for PPC threaded fasteoi flows! What you'll
get is a threaded IRQ with EOI *never ever* issued, unless my PPC patch is also in...
ok, how about the patch below in addition?
Ingo
kernel/irq/chip.c +1 -1
@@ -396,7 +398,7 @@ handle_fasteoi_irq(unsigned int irq, str*/ if (redirect_hardirq (desc)) {mask_ack_irq (desc, irq); - goto out_unlock; + goto out; } desc->status &= ~IRQ_PENDING ;
Quoted 5 lines · Ingo Molnar
Quoted 3 lines
Hmm, that just won't do for PPC threaded fasteoi flows! What you'll
get is a threaded IRQ with EOI *never ever* issued, unless my PPC patch is also in...ok, how about the patch below in addition?
or rather, the one below. Untested.
Ingo
kernel/irq/chip.c +4 -3
@@ -392,11 +394,12 @@ handle_fasteoi_irq(unsigned int irq, str desc->status |=IRQ_INPROGRESS ;/* -* In the threaded case we fall back to a mask+ack sequence: +* In the threaded case we fall back to a mask+eoi sequence: */ if (redirect_hardirq (desc)) { -mask_ack_irq (desc, irq); - goto out_unlock; +if (desc->chip->mask) + desc->chip->mask (irq); + goto out; } desc->status &= ~IRQ_PENDING ;
Hello.
Quoted 6 lines · Ingo Molnar
Quoted 4 lines
Quoted 2 lines
Hmm, that just won't do for PPC threaded fasteoi flows! What you'll
get is a threaded IRQ with EOI *never ever* issued, unless my PPC patch is also in...ok, how about the patch below in addition?
or rather, the one below. Untested.
Actually, it's been tested since it's close to Daniel's original variant.
Should do it.
Quoted 14 lines
Ingo
Index:
linux/kernel/irq/chip.c
===================================================================kernel/irq/chip.c +1
-1@@ -392,11 +394,12 @@ handle_fasteoi_irq(unsigned int irq, str desc->status |=IRQ_INPROGRESS ;/* -* In the threaded case we fall back to a mask+ack sequence: +* In the threaded case we fall back to a mask+eoi sequence:
kernel/irq/chip.c handle_fasteoi_irq(unsigned int irq, str · line 405
Quoted 10 lines
kernel/irq/chip.c +3
-2*/ if (redirect_hardirq (desc)) { -mask_ack_irq (desc, irq); - goto out_unlock; +if (desc->chip->mask) + desc->chip->mask (irq); + goto out; } desc->status &= ~IRQ_PENDING ;
WBR, Sergei
Hello.
Quoted 9 lines · Sergei Shtylyov
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Hmm, that just won't do for PPC threaded fasteoi flows! What you'll
get is a threaded IRQ with EOI *never ever* issued, unless my PPC patch is also in...ok, how about the patch below in addition?
or rather, the one below. Untested.
Actually, it's been tested since it's close to Daniel's original variant.
Should do it.
Can't say that about the interrupt controllers without mask() method --
that *really* needs testing...
Quoted 7 lines
Quoted 7 lines
Index:
linux/kernel/irq/chip.c
===================================================================kernel/irq/chip.c +0
-0@@ -392,11 +394,12 @@ handle_fasteoi_irq(unsigned int irq, str desc->status |=IRQ_INPROGRESS ;
Quoted 7 lines
kernel/irq/chip.c handle_fasteoi_irq(unsigned int irq, str · line 399
Quoted 7 lines
kernel/irq/chip.c +1
-3/* -* In the threaded case we fall back to a mask+ack sequence: +* In the threaded case we fall back to a mask+eoi sequence: */ if (redirect_hardirq (desc)) { -mask_ack_irq (desc, irq); - goto out_unlock;
That label would generate a warning though. Should be gotten rid of now.
Quoted 8 lines
kernel/irq/chip.c handle_fasteoi_irq(unsigned int irq, str · line 405
Quoted 8 lines
kernel/irq/chip.c +3
-0+if (desc->chip->mask) + desc->chip->mask (irq); + goto out; } desc->status &= ~IRQ_PENDING ;
WBR, Sergei
Quoted 5 lines · Sergei Shtylyov
Quoted 3 lines
kernel/irq/chip.c handle_fasteoi_irq(unsigned int irq, str · line 399
Quoted 3 lines
if (redirect_hardirq(desc)) {kernel/irq/chip.c +0
-2-mask_ack_irq (desc, irq); - goto out_unlock;That label would generate a warning though. Should be gotten rid of now.
yep, gone in my tree.
Ingo
Quoted 6 lines
Index:
linux/kernel/irq/chip.c
===================================================================
kernel/irq/chip.c static inline void mask_ack_irq(struct i · line 244
Quoted 9 lines
kernel/irq/chip.c +4
-2@@ -238,8 +238,10 @@ static inline void mask_ack_irq(struct iif (desc->chip->mask_ack) desc->chip->mask_ack (irq);else { - desc->chip->mask (irq); - desc->chip->ack (irq); +if (desc->chip->mask) + desc->chip->mask (irq); +if (desc->chip->mask) + desc->chip->ack (irq);
Looks like a typo to me :-)
Cheers,
Ben.
Quoted 9 lines · Ingo Molnar
Quoted 4 lines · Sergei Shtylyov
Quoted 2 lines
on PPC64, 'get the vector' initiates an ACK as well - is that done before
handle_irq()is done?Exactly. How else
do_IRQ()would know the vector?the reason i'm asking is that in this case masking is a bit late at this point and there's a chance for a repeat interrupt.
What do you mean by a bit late ?
You can't mask before you know what interrupt occured so you don't really have a choice there :-) I'm pretty sure that mask + eoi is what Apple does on Darwin too though.
Cheers,
Ben.
Quoted 8 lines · Ingo Molnar
correct. It's basically a different type of 'flow' of handling an interrupt. It's a host-side genirq-level detail that should have no irqchip level impact at all.
The only detail is that sometimes a threaded flow /cannot/ be implemented if the irqchip lacks certain methods. (such as a mask/unmask)
Quoted 9 lines
i.e. Sergei's patch tweaking the irqchip data structures is wrong - the correct approach is what i do for i386/x86_64: install a different "threaded" flow handler. I prefer this to tweaking the existing 'fasteoi' handler, to make the act of supporting a threaded flow design explicit. (and to allow a mixed threaded/non-threaded flow setup) I didnt take Daniel's prior patch for that reason: he tried to tweak the fasteoi flow handler - which is an almost good approach but not good enough :-)
It makes porting to powerpc for instance harder because some controllers have ack(), and some don't.. Some have mask(), and some don't.. So you end up with what Sergei is doing which is flat out make ack == eoi .. Where you have multiple irq chip types each one really needs an individual evaluation ..
I don't really agree with your method since it increase the porting effort, and I don't see a gain from it.. In fact the changes that you make seem like it would be more difficult to support a simple reversal from a thread to an interrupt context handler, since your permanently changing the "flow handler" , as you called it, no matter what the context is. So the person using this code will have to investigate this new flow handler, which will result is a very anti-climactic ending and lots of useless work since it's really making ack == eoi (at least for powerpc).
Daniel
Quoted 5 lines · Daniel Walker
It makes porting to powerpc for instance harder because some controllers have
ack(), and some don't.. Some havemask(), and some don't.. So you end up with what Sergei is doing which is flat out make ack == eoi .. Where you have multiple irq chip types each one really needs an individual evaluation ..
this isnt really a problem. The current situation is simply hacky, because right now there's no 'threaded' flow type at all. The x86 code just moves the code away from fasteoi:
#ifdef CONFIG_PREEMPT_HARDIRQS
set_irq_chip_and_handler_name(irq, &ioapic_chip,
handle_level_irq, "level-threaded");#else
set_irq_chip_and_handler_name(irq, &ioapic_chip,
handle_fasteoi_irq, "fasteoi");#endif
what should happen is a handle_thread_irq irq-flow handler that will first mask, and then ack or eoi (whichever callbacks is available), and thus can and will handle both fasteoi, edge and level irqs.
Ingo
Quoted 17 lines · Ingo Molnar
Quoted 5 lines · Daniel Walker
It makes porting to powerpc for instance harder because some controllers have
ack(), and some don't.. Some havemask(), and some don't.. So you end up with what Sergei is doing which is flat out make ack == eoi .. Where you have multiple irq chip types each one really needs an individual evaluation ..this isnt really a problem. The current situation is simply hacky, because right now there's no 'threaded' flow type at all. The x86 code just moves the code away from fasteoi:
#ifdef CONFIG_PREEMPT_HARDIRQS set_irq_chip_and_handler_name(irq, &ioapic_chip, handle_level_irq, "level-threaded");#else set_irq_chip_and_handler_name(irq, &ioapic_chip, handle_fasteoi_irq, "fasteoi");
Quoted 5 lines
#endif
what should happen is a
handle_thread_irqirq-flow handler that will first mask, and then ack or eoi (whichever callbacks is available), and thus can and will handle both fasteoi, edge and level irqs.
If it still calls for arch level changes, I have an aversion to those .. Maybe if it was internal to the set_irq_chip_and_handler_name() macro?
Daniel
Quoted 6 lines · Ingo Molnar
so the question is not 'is there an ACK' (all non-MSI-type-of IRQ delivery mechanisms have some sort of ACK mechanism), but what is the precise structure of ACK-ing an IRQ that the host recieves.
on PPC64, 'get the vector' initiates an ACK as well - is that done before
handle_irq()is done?
Yes.
Quoted 7 lines
Quoted 4 lines
So by doing a mask followed by an eoi, you essentially mask the interrupt preventing further delivery of that interrupt and lower the CPU priority in the PIC thus allowing processing of further interrupts.
correct, that's what should happen.
Quoted 7 lines
Quoted 2 lines
Are there other fasteoi controllers than the ones I have on powerpc anyway ?
well, if you mean the x86 APICs, there you get the vector 'for free' as part of the IRQ entry call sequence, and there's an EOI register in the local APIC that notifies the IRQ hardware, lowers the CPU priority, etc. We have that as an ->eoi handler right now.
Ok, so that's like me. Which means that what you need is a specific thre aded_fasteoi flow handler that does mask & eoi, not ack.
Note that I still think it would work in the absence of mask too if the controller only does edge interrupts, as it is the case for the cell.
Cheers,
Ben.
Hello.
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Benjamin Herrenschmidt
Quoted 2 lines
Wait wait wait .... Can somebody (Ingo ?) explain me why the fasteoi handler is being changed and what is the rationale for adding an ack that was not necessary before ?
Quoted 8 lines
Quoted 1 line
dont worry, it's -rt only stuff.
Still, I'm curious :-) Besides, there have been people talking about having -rt work on ppc64 so ...
What do you need an
ack()for on fasteoi ? On all fasteoi controllers I have, ack is implicit by obtaining the vector number and all there is is an eoi...
I must not that this whole ack() vs eoi() stuff is misleading. For example,
in 8259 driver, mask_ack() method actually sends EOI to PIC, not ACK's an IRQ -- the actual ACK is implicit on x86 and is used to read the interrupt vector form 8259 on PPC. So, IMO, there probably should only have been either ack() or eoi() method in the first place. Though I'm not familiar with ARM from which genirq stuff originated...
Quoted 2 lines
Cheers,
Ben.
WBR, Sergei
Quoted 6 lines · Sergei Shtylyov
I must not that this whole
ack()vseoi()stuff is misleading. For example,
in 8259 driver,mask_ack()method actually sends EOI to PIC, not ACK's an IRQ -- the actual ACK is implicit on x86 and is used to read the interrupt vector form 8259 on PPC. So, IMO, there probably should only have been eitherack()oreoi()method in the first place. Though I'm not familiar with ARM from which genirq stuff originated...
They are different concepts. Ack clears the event on the PIC, it's tyically necessary for resetting the edge detection logic for edge interrupts and has to happen before the handler is called.
On MPIC or XICS, this is implicit by reading the vector. On some more dumb controllers, this has to be done explicitely.
EOI is a more "high level" thing that some "intelligent" PICs that automatically raise the priority do to restore the priority to what it was before the interrupt occured.
Ben.
Hello.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines
I must not that this whole
ack()vseoi()stuff is misleading. For example,
in 8259 driver,mask_ack()method actually sends EOI to PIC, not ACK's an IRQ
-- the actual ACK is implicit on x86 and is used to read the interrupt vector
form 8259 on PPC. So, IMO, there probably should only have been eitherack()oreoi()method in the first place. Though I'm not familiar with ARM from which genirq stuff originated...They are different concepts. Ack clears the event on the PIC, it's tyically necessary for resetting the edge detection logic for edge interrupts and has to happen before the handler is called.
I know 8259. :-)
It also resets the corresponding IRQ bit in IRR, and sets it in ISR where
it's then cleared on EOI command.
Quoted 2 lines
On MPIC or XICS, this is implicit by reading the vector. On some more dumb controllers, this has to be done explicitely.
This is not implicit -- CPU has to read INTACK reg. on OpenPIC. Really
implicit method is in action on x86 where CPU issues dual ACK bus cycle to get the vector form 8259...
Quoted 3 lines
EOI is a more "high level" thing that some "intelligent" PICs that automatically raise the priority do to restore the priority to what it was before the interrupt occured.
Thank you, I know. Even 8259 has the notion of priority and EOI works the
same way here.
Quoted 1 line
Ben.
WBR, Sergei
Quoted 2 lines
This is not implicit -- CPU has to read INTACK reg. on OpenPIC.
Which is what I meant... "implicit by reading the vector".
Quoted 2 lines
Really implicit method is in action on x86 where CPU issues dual ACK bus cycle to get the vector form 8259...
Which you can do on OpenPIC too. It's the same idea. The concept that obtaining the vector performs the ack.
Quoted 6 lines
Quoted 3 lines
EOI is a more "high level" thing that some "intelligent" PICs that automatically raise the priority do to restore the priority to what it was before the interrupt occured.
Thank you, I know. Even 8259 has the notion of priority and EOI works the
same way here.
Ok, so why would you need an ack there then while eoi is just what you need ? :-)
Also, that's interesting what you are saying about 8259... I should be able to convert ppc's i8259 to use fasteoi too...
Ben.
Hello.
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines
Quoted 3 lines
EOI is a more "high level" thing that some "intelligent" PICs that automatically raise the priority do to restore the priority to what it was before the interrupt occured.
Thank you, I know. Even 8259 has the notion of priority and EOI works the
same way here.Ok, so why would you need an ack there then while eoi is just what you need ? :-)
Don't ask me, ask the genirq authors. :-)
Quoted 2 lines
Also, that's interesting what you are saying about 8259... I should be able to convert ppc's i8259 to use fasteoi too...
I'm not sure it's feasible. The idea behind level/edge flows is to
eliminate the interrupt priority I think. That's why they EOI ASAP (with the level handler masking IRQ before that) -- this way the other interrupts may come thru.
I used to think that fasteoi was intended for SMP PICs which are
intelligent enough to mask off the interrupts pending delivery or handling on CPUs and unmask them upon receiving EOI -- just like x86 IOAPIC does. This way, the acceptance of the lower priority interrupts shouldn't be hindered on the other CPUs. Maybe the scheme is different for OpenPIC (I know it has the different interrupt distribution scheme from IOAPIC)?
Quoted 1 line
Ben.
WBR, Sergei
Quoted 5 lines
I'm not sure it's feasible. The idea behind level/edge flows is to
eliminate the interrupt priority I think. That's why they EOI ASAP (with the level handler masking IRQ before that) -- this way the other interrupts may come thru.
Well, the idea behind the level/edge flow is not exactly that afaik. It's more like having tailored handlers for level/edge on PICs that are not intelligent to auto-mask with a priority mecanism (ie. dumb PICs which are very common in the embedded field, and for example, on ARM where genirq takes its roots).
Quoted 3 lines
I used to think that fasteoi was intended for SMP PICs which are
intelligent enough to mask off the interrupts pending delivery or handling on CPUs and unmask them upon receiving EOI -- just like x86 IOAPIC does.
In general, PICs that are intelligent enough to mask off, wether using something as you describe or using priorities. I don't feel the need of going through hoops to allow lower or same priority interrupts in. First, if you really need an interrupt to be serviced quick, then you can just give it a higher priority. In the general case however, I do -not- want to allow interrupts to stack up. Imagine a big IBM machine with hundreds interrupt lines, what happens to the kernel stack if we let them interrupt each other ?
Quoted 4 lines
This
way, the acceptance of the lower priority interrupts shouldn't be hindered on the other CPUs. Maybe the scheme is different for OpenPIC (I know it has the different interrupt distribution scheme from IOAPIC)?
I don't think there is a real need to let lower priority interrupts in on a CPU that is currently handling a higher priority one.
In the case of RT, though, with delayed delivery, then, the option to mask and EOI right away is always possible.
Ben.
Hello.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 2 lines
I'm not sure it's feasible. The idea behind level/edge flows is to
eliminate the interrupt priority I think. That's why they EOI ASAP (with the level handler masking IRQ before that) -- this way the other interrupts may come thru.Well, the idea behind the level/edge flow is not exactly that afaik. It's more like having tailored handlers for level/edge on PICs that are not intelligent to auto-mask with a priority mecanism (ie. dumb PICs which are very common in the embedded field, and for example, on ARM where genirq takes its roots).
That was a conclusion to which I came after looking at the 8259 code (that
PIC being full capable of the priority masking).
Quoted 11 lines
Quoted 2 lines
I used to think that fasteoi was intended for SMP PICs which are
intelligent enough to mask off the interrupts pending delivery or handling on CPUs and unmask them upon receiving EOI -- just like x86 IOAPIC does.In general, PICs that are intelligent enough to mask off, wether using something as you describe or using priorities. I don't feel the need of going through hoops to allow lower or same priority interrupts in. First, if you really need an interrupt to be serviced quick, then you can just give it a higher priority. In the general case however, I do -not- want to allow interrupts to stack up. Imagine a big IBM machine with hundreds interrupt lines, what happens to the kernel stack if we let them interrupt each other ?
Well, such machines are SMP usually... :-)
Quoted 4 lines
Quoted 1 line
This way, the acceptance of the lower priority interrupts shouldn't be hindered on the other CPUs. Maybe the scheme is different for OpenPIC (I know it has the different interrupt distribution scheme from IOAPIC)?
I don't think there is a real need to let lower priority interrupts in on a CPU that is currently handling a higher priority one.
Nevertheless, 8259 drivers are doing exactly this on UP machines -- and
they were doing this before and after genirq conversion...
Quoted 1 line
Ben.
WBR, Sergei
Hello.
Quoted 4 lines · Sergei Shtylyov
Quoted 2 lines
On MPIC or XICS, this is implicit by reading the vector. On some more dumb controllers, this has to be done explicitely.
This is not implicit -- CPU has to read INTACK reg. on OpenPIC. Really
Sorry, it's the same for x86 version of OpenPIC according to spec. I meant
the PPC implementation here.
Quoted 1 line
Quoted 1 line
Ben.
WBR, Sergei
Quoted 3 lines
Sorry, it's the same for x86 version of OpenPIC according to spec. I meant
the PPC implementation here.
Same OpenPIC.. it can deal with both INTACK cycles and reading from an INTACK register. On some PPC's, we actually have logic in the bridge to generate the INTACK cycle (which exist on PCI) though we only use that with 8259's currently as it's not really more efficient than just reading from the INTACK register of the OpenPIC.
Ben.
PATCH 1/1 PowerPC: revert fix for threaded fasteoi IRQ handlers
In reply to Sergei ShtylyovRevert the change to the "fasteoi" type chips as after handle_fasteoi_irq() had been fixed, they've become meaningless (and even dangerous -- as was the case with Celleb that has been fixed earlier)...
---
The patch in question wasn't even initially accepted but then was erroneously restored along with the TOD patch. I've asked to revert it but to no avail, so here's the formal patch to revert it at last...
arch/powerpc/platforms/iseries/irq.c | 1 - arch/powerpc/platforms/pseries/xics.c | 2 -- arch/powerpc/sysdev/mpic.c | 1 - 3 files changed, 4 deletions(-)
arch/powerpc/platforms/iseries/irq.c +0 -1
@@ -279,7 +279,6 @@ static struct irq_chip iseries_pic = { .shutdown = iseries_shutdown_IRQ, .unmask = iseries_enable_IRQ, .mask = iseries_disable_IRQ, - .ack = iseries_end_IRQ, .eoi = iseries_end_IRQ };
arch/powerpc/platforms/pseries/xics.c +0 -2
@@ -456,7 +456,6 @@ static struct irq_chip xics_pic_direct = .startup = xics_startup, .mask = xics_mask_irq, .unmask = xics_unmask_irq, - .ack = xics_eoi_direct, .eoi = xics_eoi_direct, .set_affinity = xics_set_affinity };
@@ -467,7 +466,6 @@ static struct irq_chip xics_pic_lpar = { .startup = xics_startup, .mask = xics_mask_irq, .unmask = xics_unmask_irq, - .ack = xics_eoi_lpar, .eoi = xics_eoi_lpar, .set_affinity = xics_set_affinity };
arch/powerpc/sysdev/mpic.c +0 -1
@@ -776,7 +776,6 @@ static int mpic_set_irq_type(unsigned instatic struct irq_chip mpic_irq_chip = { .mask = mpic_mask_irq, .unmask = mpic_unmask_irq, - .ack = mpic_end_irq, .eoi = mpic_end_irq, .set_type = mpic_set_irq_type, };
Re: [PATCH 2.6.21-rt2] PowerPC: revert fix for threaded fasteoi IRQ handlers
Quoted 10 lines · Hello, I wrote:
Revert the change to the "fasteoi" type chips as after
handle_fasteoi_irq()had been fixed, they've become meaningless (and even dangerous -- as was the case with Celleb that has been fixed earlier)...Signed-off-by Sergei Shtylyov <[email protected]>---
The patch in question wasn't even initially accepted but then was erroneously restored along with the TOD patch. I've asked to revert it but to no avail, so here's the formal patch to revert it at last...
Now that the -rt patch has been first release in the broken-out version,
let me tell you that the following 3 patches in the series can be just annihilated:
preempt-irqs-ppc-ack-irq-fixups.patch
preempt-irqs-ppc-fix-b5.patch
preempt-irqs-ppc-fix-more-fasteoi.patch
as all that the latter two are doing is undoing the former one.
WBR, Sergei
Re: [PATCH 2.6.21-rt2] PowerPC: revert fix for threaded fasteoi IRQ handlers
Quoted 9 lines · Sergei Shtylyov
Now that the -rt patch has been first release in the broken-out version,
let me tell you that the following 3 patches in the series can be just annihilated:preempt-irqs-ppc-ack-irq-fixups.patch
preempt-irqs-ppc-fix-b5.patch
preempt-irqs-ppc-fix-more-fasteoi.patchas all that the latter two are doing is undoing the former one.
Really ? I know for quite a while.
We kept some of those files to document contributions. Go read back on the LKML archives, where we were accused more than once not to keep track of these things.
They can be folded together and fixed up, one thing after the other please.
tglx
Re: [PATCH 2.6.21-rt2] PowerPC: revert fix for threaded fasteoi IRQ handlers
Hello.
Quoted 10 lines · Thomas Gleixner
Quoted 8 lines
Now that the -rt patch has been first release in the broken-out version,
let me tell you that the following 3 patches in the series can be just annihilated:preempt-irqs-ppc-ack-irq-fixups.patch
preempt-irqs-ppc-fix-b5.patch
preempt-irqs-ppc-fix-more-fasteoi.patchas all that the latter two are doing is undoing the former one.
Really ? I know for quite a while.
Just reminding. :-)
Quoted 3 lines
We kept some of those files to document contributions. Go read back on the LKML archives, where we were accused more than once not to keep track of these things.
Yeah, I figured that out. This case is somewhat special though since the
patch that started this should't even have been there in the firts place.
Quoted 2 lines
They can be folded together and fixed up, one thing after the other please.
OK, no hurry. :-)
Quoted 1 line
tglx
WBR, Sergei