01 Nov, 2011

1 commit

  • Recent commit "irq: Track the owner of irq descriptor" in
    commit ID b6873807a7143b7 placed module.h into linux/irq.h
    but we are trying to limit module.h inclusion to just C files
    that really need it, due to its size and number of children
    includes. This targets just reversing that include.

    Add in the basic "struct module" since that is all we really need
    to ensure things compile. In theory, b687380 should have added the
    module.h include to the irqdesc.h header as well, but the implicit
    module.h everywhere presence masked this from showing up. So give
    it the "struct module" as well.

    As for the C files, irqdesc.c is only using THIS_MODULE, so it
    does not need module.h - give it export.h instead. The C file
    irq/manage.c is now (as of b687380) using try_module_get and
    module_put and so it needs module.h (which it already has).

    Also convert the irq_alloc_descs variants to macros, since all
    they really do is is call the __irq_alloc_descs primitive.
    This avoids including export.h and no debug info is lost.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

03 Oct, 2011

1 commit

  • The ARM GIC interrupt controller offers per CPU interrupts (PPIs),
    which are usually used to connect local timers to each core. Each CPU
    has its own private interface to the GIC, and only sees the PPIs that
    are directly connect to it.

    While these timers are separate devices and have a separate interrupt
    line to a core, they all use the same IRQ number.

    For these devices, request_irq() is not the right API as it assumes
    that an IRQ number is visible by a number of CPUs (through the
    affinity setting), but makes it very awkward to express that an IRQ
    number can be handled by all CPUs, and yet be a different interrupt
    line on each CPU, requiring a different dev_id cookie to be passed
    back to the handler.

    The *_percpu_irq() functions is designed to overcome these
    limitations, by providing a per-cpu dev_id vector:

    int request_percpu_irq(unsigned int irq, irq_handler_t handler,
    const char *devname, void __percpu *percpu_dev_id);
    void free_percpu_irq(unsigned int, void __percpu *);
    int setup_percpu_irq(unsigned int irq, struct irqaction *new);
    void remove_percpu_irq(unsigned int irq, struct irqaction *act);
    void enable_percpu_irq(unsigned int irq);
    void disable_percpu_irq(unsigned int irq);

    The API has a number of limitations:
    - no interrupt sharing
    - no threading
    - common handler across all the CPUs

    Once the interrupt is requested using setup_percpu_irq() or
    request_percpu_irq(), it must be enabled by each core that wishes its
    local interrupt to be delivered.

    Based on an initial patch by Thomas Gleixner.

    Signed-off-by: Marc Zyngier
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/1316793788-14500-2-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

28 Jul, 2011

1 commit

  • Interrupt descriptors can be allocated from modules. The interrupts
    are used by other modules, but we have no refcount on the module which
    provides the interrupts and there is no way to establish one on the
    device level as the interrupt using module is agnostic to the fact
    that the interrupt is provided by a module rather than by some builtin
    interrupt controller.

    To prevent removal of the interrupt providing module, we can track the
    owner of the interrupt descriptor, which also provides the relevant
    irq chip functions in the irq descriptor.

    request/setup_irq() can now acquire a refcount on the owner module to
    prevent unloading. free_irq() drops the refcount.

    Signed-off-by: Sebastian Andrzej Siewior
    Link: http://lkml.kernel.org/r/20110711101731.GA13804@Chamillionaire.breakpoint.cc
    Signed-off-by: Thomas Gleixner

    Sebastian Andrzej Siewior
     

18 May, 2011

1 commit

  • generic_handle_irq() is missing a NULL pointer check for the result of
    irq_to_desc. This was a not a big problem, but we want to expose it to
    drivers, so we better have sanity checks in place. Add a return value
    as well, which indicates that the irq number was valid and the handler
    was invoked.

    Based on the pure code move from Jonathan Cameron.

    Signed-off-by: Thomas Gleixner
    Cc: Jonathan Cameron

    Thomas Gleixner
     

23 Apr, 2011

2 commits


29 Mar, 2011

1 commit


24 Mar, 2011

3 commits


11 Mar, 2011

1 commit


26 Feb, 2011

1 commit

  • For level type interrupts we need to track how many threads are on
    flight to avoid useless interrupt storms when not all thread handlers
    have finished yet. Keep track of the woken threads and only unmask
    when there are no more threads in flight.

    Yes, I'm lazy and using a bitfield. But not only because I'm lazy, the
    main reason is that it's way simpler than using a refcount. A refcount
    based solution would need to keep track of various things like
    crashing the irq thread, spurious interrupts coming in,
    disables/enables, free_irq() and some more. The bitfield keeps the
    tracking simple and makes things just work. It's also nicely confined
    to the thread code pathes and does not require additional checks all
    over the place.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    LKML-Reference:

    Thomas Gleixner
     

19 Feb, 2011

5 commits

  • sparc64 needs to call a preflow handler on certain interrupts befor
    calling the action chain. Integrate it into handle_fasteoi_irq. Must
    be enabled via CONFIG_IRQ_FASTEOI_PREFLOW. No impact when disabled.

    Signed-off-by: Thomas Gleixner
    Cc: David S. Miller

    Thomas Gleixner
     
  • If everything uses the right accessors, then enabling
    GENERIC_HARDIRQS_NO_COMPAT should just work. If not it will tell you.

    Don't be lazy and use the trick which I use in the core code!

    git grep status_use_accessors

    will unearth it in a split second. Offenders are tracked down and not
    slapped with stinking trouts. This time we use frozen shark for a
    better educational value.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Some chip implementations need to access certain status flags. With
    sparse irqs that requires a lookup of the irq descriptor. Add a state
    field which contains such flags.

    Name it in a way which will make coders happy to access it with the
    proper accessor functions. And it's easy to grep for.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • That field will contain internal state information which is not going
    to be exposed to anything outside the core code - except via accessor
    functions. I'm tired of everyone fiddling in irq_desc.status.

    core_internal_state__do_not_mess_with_it is clear enough, annoying to
    type and easy to grep for. Offenders will be tracked down and slapped
    with stinking trouts.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • The irq namespace has become quite convoluted. My bad. Clean it up
    and deprecate the old functions. All new functions follow the scheme:

    irq number based:
    irq_set/get/xxx/_xxx(unsigned int irq, ...)

    irq_data based:
    irq_data_set/get/xxx/_xxx(struct irq_data *d, ....)

    irq_desc based:
    irq_desc_get_xxx(struct irq_desc *desc)

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

23 Jan, 2011

1 commit

  • When initiating I/O on a multiqueue and multi-IRQ device, we may want
    to select a queue for which the response will be handled on the same
    or a nearby CPU. This requires a reverse-map of IRQ affinity. Add a
    notification mechanism to support this.

    This is based closely on work by Thomas Gleixner .

    Signed-off-by: Ben Hutchings
    Cc: linux-net-drivers@solarflare.com
    Cc: Tom Herbert
    Cc: David Miller
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Ben Hutchings
     

21 Jan, 2011

1 commit

  • All architectures are finally converted. Remove the cruft.

    Signed-off-by: Thomas Gleixner
    Cc: Richard Henderson
    Cc: Mike Frysinger
    Cc: David Howells
    Cc: Tony Luck
    Cc: Greg Ungerer
    Cc: Michal Simek
    Acked-by: David Howells
    Cc: Kyle McMartin
    Acked-by: Benjamin Herrenschmidt
    Cc: Chen Liqin
    Cc: "David S. Miller"
    Cc: Chris Metcalf
    Cc: Jeff Dike

    Thomas Gleixner
     

14 Jan, 2011

1 commit

  • Use modern per_cpu API to increment {soft|hard}irq counters, and use
    per_cpu allocation for (struct irq_desc)->kstats_irq instead of an array.

    This gives better SMP/NUMA locality and saves few instructions per irq.

    With small nr_cpuids values (8 for example), kstats_irq was a small array
    (less than L1_CACHE_BYTES), potentially source of false sharing.

    In the !CONFIG_SPARSE_IRQ case, remove the huge, NUMA/cache unfriendly
    kstat_irqs_all[NR_IRQS][NR_CPUS] array.

    Note: we still populate kstats_irq for all possible irqs in
    early_irq_init(). We probably could use on-demand allocations. (Code
    included in alloc_descs()). Problem is not all IRQS are used with a prior
    alloc_descs() call.

    kstat_irqs_this_cpu() is not used anymore, remove it.

    Signed-off-by: Eric Dumazet
    Reviewed-by: Christoph Lameter
    Cc: Ingo Molnar
    Cc: Andi Kleen
    Cc: Tejun Heo
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Dumazet
     

12 Oct, 2010

3 commits

  • The move_irq_desc() function was only used due to the problem that the
    allocator did not free the old descriptors. So the descriptors had to
    be moved in create_irq_nr(). That's history.

    The code would have never been able to move active interrupt
    descriptors on affinity settings. That can be done in a completely
    different way w/o all this horror.

    Remove all of it.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Ingo Molnar

    Thomas Gleixner
     
  • irq_2_iommu is now in the x86 code where it belongs. Remove all
    leftovers.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Ingo Molnar
    Acked-by: Suresh Siddha
    Cc: David Woodhouse
    Cc: Jesse Barnes

    Thomas Gleixner
     
  • Move irq_desc and internal functions out of irq.h

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Ingo Molnar

    Thomas Gleixner