linux/kernel/irq
Thomas Gleixner 1f5a5b87f7 genirq: Implement a sane sparse_irq allocator
The current sparse_irq allocator has several short comings due to
failures in the design or the lack of it:

 - Requires iteration over the number of active irqs to find a free slot
   (Some architectures have grown their own workarounds for this)
 - Removal of entries is not possible
 - Racy between create_irq_nr and destroy_irq (plugged by horrible
   callbacks)
 - Migration of active irq descriptors is not possible
 - No bulk allocation of irq ranges
 - Sprinkeled irq_desc references all over the place outside of kernel/irq/
   (The previous chip functions series is addressing this issue)

Implement a sane allocator which fixes the above short comings (though
migration of active descriptors needs a full tree wide cleanup of the
direct and mostly unlocked access to irq_desc).

The new allocator still uses a radix_tree, but uses a bitmap for
keeping track of allocated irq numbers. That allows:

 - Fast lookup of a free slot
 - Allows the removal of descriptors
 - Prevents the create/destroy race
 - Bulk allocation of consecutive irq ranges
 - Basic design is ready for migration of life descriptors after
   further cleanups

The bitmap is also used in the SPARSE_IRQ=n case for lookup and
raceless (de)allocation of irq numbers. So it removes the requirement
for looping through the descriptor array to find slots.

Right now it uses sparse_irq_lock to protect the bitmap and the radix
tree, but after cleaning up all users we should be able convert that
to a mutex and to switch the radix_tree and decriptor allocations to
GFP_KERNEL.

[ Folded in a bugfix from Yinghai Lu ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
2010-10-12 16:39:07 +02:00
..
Kconfig genirq: Provide config option to disable deprecated code 2010-10-04 13:40:24 +02:00
Makefile genirq: Distangle kernel/irq/handle.c 2010-10-12 16:39:05 +02:00
autoprobe.c genirq: Provide compat handling for chip->set_type() 2010-10-04 12:43:47 +02:00
chip.c genirq: Provide default irq init flags 2010-10-12 16:39:06 +02:00
devres.c devres/irq: Fix devm_irq_match comment 2010-02-11 16:01:02 +01:00
dummychip.c genirq: Distangle kernel/irq/handle.c 2010-10-12 16:39:05 +02:00
handle.c genirq: Distangle kernel/irq/handle.c 2010-10-12 16:39:05 +02:00
internals.h genirq: Distangle irq.h 2010-10-12 16:39:04 +02:00
irqdesc.c genirq: Implement a sane sparse_irq allocator 2010-10-12 16:39:07 +02:00
manage.c genirq: Provide compat handling for chip->set_wake() 2010-10-04 12:43:48 +02:00
migration.c genirq: Provide compat handling for chip->set_affinity() 2010-10-04 12:43:46 +02:00
numa_migrate.c genirq: Convert core code to irq_data 2010-10-04 12:36:26 +02:00
pm.c genirq: Convert irq_desc.lock to raw_spinlock 2009-12-14 23:55:33 +01:00
proc.c genirq: Provide compat handling for chip->set_affinity() 2010-10-04 12:43:46 +02:00
resend.c genirq: Provide compat handling for chip->retrigger() 2010-10-04 12:43:50 +02:00
spurious.c genirq: Provide config option to disable deprecated code 2010-10-04 13:40:24 +02:00