irq consolidation
A message that is not in the archive (sent off-list or not yet received): 20030607040515.GB28914@krispykreme
Hi,
On ppc64 we can have lots of sparse irqs. At the moment we do a similar thing to sparc64 and provide a mapping function into the NR_IRQS sized array of irq descriptors.
At the moment we have NR_IRQS set at 512 which wastes a bit of memory on small machines. We also risk running out of slots on larger machines.
We are hoping to kill irq_desc[NR_IRQS] completely and instead allocate them on demand with some sort of hash to map an interrupt number to an irq_desc. Im working on top of Andrey Panin's irq consolidation patches in the hope that it goes in first and other architectures can benefit from these changes (I think SGI's ia64 boxes have similar issues as well as large x86)
It looks like we can do this with only a few changes:
1. move the proc/affinity stuff into the irq_desc.
2. create a for_each_irq() macro for iterating through irqs
The consolidation patch already creates the third piece, a macro for mapping from an interrupt number to an irq descriptor - irq_desc(IRQ)
Here is an untested, uncompiled, written on a plane patch that gives a general idea of what I want. Any complaints?
Anton
linux/irq.h renamed from linux/irq.h.orig +8 -0
@@ -56,12 +56,20 @@* * Pad this out to 32 bytes for cache and indexing reasons. */ +struct proc_irq_dir ; +struct proc_smp_affinity_entry ;typedef struct {unsigned int status;/* IRQ status */ hw_irq_controller *handler;struct irqaction *action;/* IRQ action list */ unsigned int depth;/* nested irq disables */ spinlock_t lock; +/* seldom used things at the end */ +struct proc_dir_entry *proc_irq_dir; +#ifdef CONFIG_SMP +struct proc_dir_entry *proc_smp_affinity_entry; +unsigned long irq_affinity; +#endif }____cacheline_aligned irq_desc_t ;extern irq_desc_t irq_desc [NR_IRQS ];
irq.c renamed from irq.c.orig +37 -21
154 lines not on this page · raw message
Quoted 3 lines · Anton Blanchard
We are hoping to kill irq_desc[NR_IRQS] completely and instead allocate them on demand with some sort of hash to map an interrupt number to an
irq_desc.
The same thought has crossed my mind as well for ARM; the hardware interrupt controllers are becoming more inteligent, and there is the possibility that system designers will mix inteligent interrupt controllers with standard types.
Also on ARM, we're currently defining NR_IRQS on a per-platform class and even a per-platform basis.
I've been wondering whether we even need to think about passing some alternative identifier of an IRQ line around, instead of a number.
Quoted 4 lines
Im working on top of Andrey Panin's irq consolidation patches in the hope that it goes in first and other architectures can benefit from these changes (I think SGI's ia64 boxes have similar issues as well as large x86)
I believe Andrey's IRQ consolidation provides a single flat IRQ structure. Unfortunately, this doesn't reflect the reality that we have on many ARM platforms - it remains the case that we need to decode IRQs on a multi-level basis.
Given the rate which ARM has progressed and evolved during the existing 2.4 lifespan, it doesn't make much difference to us whether these changes happen now or later. If it happens later, it will be during the 2.6 series of kernels, so "now" is preferable. Reality is such that ARM hardware moves a hell of a lot faster than x86 hardware.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Quoted 4 lines · Russell King
Quoted 3 lines · Anton Blanchard
We are hoping to kill irq_desc[NR_IRQS] completely and instead allocate them on demand with some sort of hash to map an interrupt number to an
irq_desc.
Anton don't you have an NR_IRQS sized interrupt stub you have to deal with on PPC64?
I was considering perhaps only statically allocating the 0-15 on i386 just to get it booting and then dynamically allocate the rest.
Zwane
--
function.linuxpower.ca
Quoted 6 lines
Anton don't you have an
NR_IRQSsized interrupt stub you have to deal with on PPC64?I was considering perhaps only statically allocating the 0-15 on i386 just to get it booting and then dynamically allocate the rest.
We usually have an 8259 but its wired up to the main interrupt controller. Even if we statically allocated 0-15, we still need a higher irq for that cascade.
Going all the way and removing NR_IRQS also catches problems like the random driver where we would only add randomness on 8259 (ie < 16) interrupts with a mixed static/dynamic scheme.
Anton
Quoted 5 lines
I believe Andrey's IRQ consolidation provides a single flat IRQ structure. Unfortunately, this doesn't reflect the reality that we have on many ARM platforms - it remains the case that we need to decode IRQs on a multi-level basis.
Yes its still a flat structure. On ppc32/64 we offset the interrupts on the main controller to provide a space for ISA interrupts to go. Not great but it works for us.
One thing Paul suggested was to have a flag to mark an interrupt as a cascade in the irq descriptor. If its set then we also provide a get_irq() method (perhaps stashed away in the ->action field). That gives us nested interrupt handling in generic code. (assuming you can partition your irq numbers somehow)
Anton
Quoted 9 lines · Anton Blanchard
Quoted 5 lines
I believe Andrey's IRQ consolidation provides a single flat IRQ structure. Unfortunately, this doesn't reflect the reality that we have on many ARM platforms - it remains the case that we need to decode IRQs on a multi-level basis.
Yes its still a flat structure. On ppc32/64 we offset the interrupts on the main controller to provide a space for ISA interrupts to go. Not great but it works for us.
May be I missed the point, but it isn't flat.
You can define HAVE_ARCH_IRQ_DESC and provide your own irq_desc(irq) function which will translate irq number to the corresponding irq_desc_t structure. You are free to implement any irq mappings behind the irq_desc(). NR_IRQS is used only as maximal irq number. So what is the problem ?
Quoted 7 lines
One thing Paul suggested was to have a flag to mark an interrupt as a cascade in the irq descriptor. If its set then we also provide a
get_irq()method (perhaps stashed away in the ->action field). That gives us nested interrupt handling in generic code. (assuming you can partition your irq numbers somehow)Anton
Signature · 2 lines
Andrey Panin | Linux and UNIX system administrator [email protected] | PGP key: wwwkeys.pgp.net
Quoted 8 lines
May be I missed the point, but it isn't flat.
You can define
HAVE_ARCH_IRQ_DESCand provide your ownirq_desc(irq)function which will translate irq number to the correspondingirq_desc_tstructure. You are free to implement any irq mappings behind theirq_desc().NR_IRQSis used only as maximal irq number. So what is the problem ?
We have been discussing passing an opaque value into request_irq like sparc64 does. It could be a pointer to the irq descriptor. rmk was interested in it since he can have heavily nested interrupt controllers and partitioning the NR_IRQS space is a pain in this case.
This will work on 32bit archs since we store irqs as ints everywhere, but will break on 64bit unless we do some tricks (like sparc64 is currently doing)
Anton