• Eric W. Biederman's avatar
    [PATCH] i386: In assign_irq_vector look at all vectors before giving up · 8339f000
    Eric W. Biederman authored
    When the world was a simple and static place setting up irqs was easy.
    It sufficed to allocate a linux irq number and a find a free cpu
    vector we could receive that linux irq on.  In those days it was
    a safe assumption that any allocated vector was actually in use
    so after one global pass through all of the vectors we would have
    none left.
    
    These days things are much more dynamic with interrupt controllers
    (in the form of MSI or MSI-X) appearing on plug in cards and linux
    irqs appearing and disappearing.  As these irqs come and go vectors
    are allocated and freed,  invalidating the ancient assumption that all
    allocated vectors stayed in use forever.
    
    So this patch modifies the vector allocator to walk through every
    possible vector before giving up, and to check to see if a vector
    is in use before assigning it.  With these changes we stop leaking
    freed vectors and it becomes possible to allocate and free irq vectors
    all day long.
    
    This changed was modeled after the vector allocator on x86_64 where
    this limitation has already been removed.  In essence we don't update
    the static variables that hold the position of the last vector we
    allocated until have successfully allocated another vector.  This
    allows us to detect if we have completed one complete scan through
    all of the possible vectors.
    Acked-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
    Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    8339f000
io_apic.c 70.9 KB