10 Dec, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (42 commits)
    tree-wide: fix misspelling of "definition" in comments
    reiserfs: fix misspelling of "journaled"
    doc: Fix a typo in slub.txt.
    inotify: remove superfluous return code check
    hdlc: spelling fix in find_pvc() comment
    doc: fix regulator docs cut-and-pasteism
    mtd: Fix comment in Kconfig
    doc: Fix IRQ chip docs
    tree-wide: fix assorted typos all over the place
    drivers/ata/libata-sff.c: comment spelling fixes
    fix typos/grammos in Documentation/edac.txt
    sysctl: add missing comments
    fs/debugfs/inode.c: fix comment typos
    sgivwfb: Make use of ARRAY_SIZE.
    sky2: fix sky2_link_down copy/paste comment error
    tree-wide: fix typos "couter" -> "counter"
    tree-wide: fix typos "offest" -> "offset"
    fix kerneldoc for set_irq_msi()
    spidev: fix double "of of" in comment
    comment typo fix: sybsystem -> subsystem
    ...

    Linus Torvalds
     

09 Dec, 2009

1 commit


08 Dec, 2009

1 commit


06 Dec, 2009

1 commit


04 Dec, 2009

2 commits


20 Nov, 2009

1 commit


18 Nov, 2009

1 commit


08 Nov, 2009

2 commits

  • If a parent directory (ie /proc/irq/) could not be created
    we should not attempt to create subdirectories. Otherwise it
    would lead that "smp_affinity" and "spurious" entries are may be
    registered under /proc root instead of a proper place.

    Signed-off-by: Cyrill Gorcunov
    Cc: Rusty Russell
    Cc: Yinghai Lu
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Cyrill Gorcunov
     
  • Prarit reported:
    =================================
    [ INFO: inconsistent lock state ]
    2.6.32-rc5 #1
    ---------------------------------
    inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
    swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
    (&irq_desc_lock_class){?.-...}, at: [] try_one_irq+0x32/0x138
    {IN-HARDIRQ-W} state was registered at:
    [] __lock_acquire+0x2fc/0xd5d
    [] lock_acquire+0xf3/0x12d
    [] _spin_lock+0x40/0x89
    [] handle_level_irq+0x30/0x105
    [] handle_irq+0x95/0xb7
    [] do_IRQ+0x6a/0xe0
    [] ret_from_intr+0x0/0x16
    irq event stamp: 195096
    hardirqs last enabled at (195096): [] _spin_unlock_irq+0x3a/0x5c
    hardirqs last disabled at (195095): [] _spin_lock_irq+0x29/0x95
    softirqs last enabled at (195088): [] __do_softirq+0x1c1/0x1ef
    softirqs last disabled at (195093): [] call_softirq+0x1c/0x30

    other info that might help us debug this:
    1 lock held by swapper/0:
    #0: (kernel/irq/spurious.c:21){+.-...}, at: []
    run_timer_softirq+0x1a9/0x315

    stack backtrace:
    Pid: 0, comm: swapper Not tainted 2.6.32-rc5 #1
    Call Trace:
    [] valid_state+0x187/0x1ae
    [] mark_lock+0x129/0x253
    [] __lock_acquire+0x370/0xd5d
    [] lock_acquire+0xf3/0x12d
    [] _spin_lock+0x40/0x89
    [] try_one_irq+0x32/0x138
    [] poll_all_shared_irqs+0x41/0x6d
    [] poll_spurious_irqs+0x1c/0x49
    [] run_timer_softirq+0x239/0x315
    [] __do_softirq+0x102/0x1ef
    [] call_softirq+0x1c/0x30
    [] do_softirq+0x59/0xca
    [] irq_exit+0x58/0xae
    [] smp_apic_timer_interrupt+0x94/0xba
    [] apic_timer_interrupt+0x13/0x20

    The reason is that try_one_irq() is called from hardirq context with
    interrupts disabled and from softirq context (poll_all_shared_irqs())
    with interrupts enabled.

    Disable interrupts before calling it from poll_all_shared_irqs().

    Reported-and-tested-by: Prarit Bhargava
    Signed-off-by: Yong Zhang
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Yong Zhang
     

04 Nov, 2009

2 commits


12 Oct, 2009

1 commit


12 Sep, 2009

1 commit


29 Aug, 2009

1 commit


27 Aug, 2009

1 commit

  • Masking oneshot edge type interrupts is wrong as we might lose an
    interrupt which is issued when the threaded handler is handling the
    device. We can keep the irq unmasked safely as with edge type
    interrupts there is no danger of interrupt floods. If the threaded
    handler has not yet finished then IRQTF_RUNTHREAD is set which will
    keep the handler thread active.

    Debugged and verified in preempt-rt.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

25 Aug, 2009

1 commit


18 Aug, 2009

1 commit

  • The wake_up_process() of the new irq thread in __setup_irq() is too
    early as the irqaction is not yet fully initialized especially
    action->irq is not yet set. The interrupt thread might dereference the
    wrong irq descriptor.

    Move the wakeup after the action is installed and action->irq has been
    set.

    Reported-by: Michael Buesch
    Signed-off-by: Thomas Gleixner
    Tested-by: Michael Buesch

    Thomas Gleixner
     

17 Aug, 2009

3 commits

  • Interrupt chips which are behind a slow bus (i2c, spi ...) and
    demultiplex other interrupt sources need to run their interrupt
    handler in a thread.

    The demultiplexed interrupt handlers need to run in thread context as
    well and need to finish before the demux handler thread can reenable
    the interrupt line. So the easiest way is to run the sub device
    handlers in the context of the demultiplexing handler thread.

    To avoid that a separate thread is created for the subdevices the
    function set_nested_irq_thread() is provided which sets the
    IRQ_NESTED_THREAD flag in the interrupt descriptor.

    A driver which calls request_threaded_irq() must not be aware of the
    fact that the threaded handler is called in the context of the
    demultiplexing handler thread. The setup code checks the
    IRQ_NESTED_THREAD flag which was set from the irq chip setup code and
    does not setup a separate thread for the interrupt. The primary
    function which is provided by the device driver is replaced by an
    internal dummy function which warns when it is called.

    For the demultiplexing handler a helper function handle_nested_irq()
    is provided which calls the demux interrupt thread function in the
    context of the caller and does the proper interrupt accounting and
    takes the interrupt disabled status of the demultiplexed subdevice
    into account.

    Signed-off-by: Thomas Gleixner
    Cc: Mark Brown
    Cc: Dmitry Torokhov
    Cc: Trilok Soni
    Cc: Pavel Machek
    Cc: Brian Swetland
    Cc: Joonyoung Shim
    Cc: m.szyprowski@samsung.com
    Cc: t.fujak@samsung.com
    Cc: kyungmin.park@samsung.com,
    Cc: David Brownell
    Cc: Daniel Ribeiro
    Cc: arve@android.com
    Cc: Barry Song

    Thomas Gleixner
     
  • Some interrupt chips are connected to a "slow" bus (i2c, spi ...). The
    bus access needs to sleep and therefor cannot be called in atomic
    contexts.

    Some of the generic interrupt management functions like disable_irq(),
    enable_irq() ... call interrupt chip functions with the irq_desc->lock
    held and interrupts disabled. This does not work for such devices.

    Provide a separate synchronization mechanism for such interrupt
    chips. The irq_chip structure is extended by two optional functions
    (bus_lock and bus_sync_and_unlock).

    The idea is to serialize the bus access for those operations in the
    core code so that drivers which are behind that bus operated interrupt
    controller do not have to worry about it and just can use the normal
    interfaces. To achieve this we add two function pointers to the
    irq_chip: bus_lock and bus_sync_unlock.

    bus_lock() is called to serialize access to the interrupt controller
    bus.

    Now the core code can issue chip->mask/unmask ... commands without
    changing the fast path code at all. The chip implementation merily
    stores that information in a chip private data structure and
    returns. No bus interaction as these functions are called from atomic
    context.

    After that bus_sync_unlock() is called outside the atomic context. Now
    the chip implementation issues the bus commands, waits for completion
    and unlocks the interrupt controller bus.

    The irq_chip implementation as pseudo code:

    struct irq_chip_data {
    struct mutex mutex;
    unsigned int irq_offset;
    unsigned long mask;
    unsigned long mask_status;
    }

    static void bus_lock(unsigned int irq)
    {
    struct irq_chip_data *data = get_irq_desc_chip_data(irq);

    mutex_lock(&data->mutex);
    }

    static void mask(unsigned int irq)
    {
    struct irq_chip_data *data = get_irq_desc_chip_data(irq);

    irq -= data->irq_offset;
    data->mask |= (1 << irq);
    }

    static void unmask(unsigned int irq)
    {
    struct irq_chip_data *data = get_irq_desc_chip_data(irq);

    irq -= data->irq_offset;
    data->mask &= ~(1 << irq);
    }

    static void bus_sync_unlock(unsigned int irq)
    {
    struct irq_chip_data *data = get_irq_desc_chip_data(irq);

    if (data->mask != data->mask_status) {
    do_bus_magic_to_set_mask(data->mask);
    data->mask_status = data->mask;
    }
    mutex_unlock(&data->mutex);
    }

    The device drivers can use request_threaded_irq, free_irq, disable_irq
    and enable_irq as usual with the only restriction that the calls need
    to come from non atomic context.

    Signed-off-by: Thomas Gleixner
    Cc: Mark Brown
    Cc: Dmitry Torokhov
    Cc: Trilok Soni
    Cc: Pavel Machek
    Cc: Brian Swetland
    Cc: Joonyoung Shim
    Cc: m.szyprowski@samsung.com
    Cc: t.fujak@samsung.com
    Cc: kyungmin.park@samsung.com,
    Cc: David Brownell
    Cc: Daniel Ribeiro
    Cc: arve@android.com
    Cc: Barry Song

    Thomas Gleixner
     
  • For threaded interrupt handlers we expect the hard interrupt handler
    part to mask the interrupt on the originating device. The interrupt
    line itself is reenabled after the hard interrupt handler has
    executed.

    This requires access to the originating device from hard interrupt
    context which is not always possible. There are devices which can only
    be accessed via a bus (i2c, spi, ...). The bus access requires thread
    context. For such devices we need to keep the interrupt line masked
    until the threaded handler has executed.

    Add a new flag IRQF_ONESHOT which allows drivers to request that the
    interrupt is not unmasked after the hard interrupt context handler has
    been executed and the thread has been woken. The interrupt line is
    unmasked after the thread handler function has been executed.

    Note that for now IRQF_ONESHOT cannot be used with IRQF_SHARED to
    avoid complex accounting mechanisms.

    For oneshot interrupts the primary handler simply returns
    IRQ_WAKE_THREAD and does nothing else. A generic implementation
    irq_default_primary_handler() is provided to avoid useless copies all
    over the place. It is automatically installed when
    request_threaded_irq() is called with handler=NULL and
    thread_fn!=NULL.

    Signed-off-by: Thomas Gleixner
    Cc: Mark Brown
    Cc: Dmitry Torokhov
    Cc: Trilok Soni
    Cc: Pavel Machek
    Cc: Brian Swetland
    Cc: Joonyoung Shim
    Cc: m.szyprowski@samsung.com
    Cc: t.fujak@samsung.com
    Cc: kyungmin.park@samsung.com,
    Cc: David Brownell
    Cc: Daniel Ribeiro
    Cc: arve@android.com
    Cc: Barry Song

    Thomas Gleixner
     

14 Aug, 2009

1 commit

  • free_irq() can remove an irqaction while the corresponding interrupt
    is in progress, but free_irq() sets action->thread to NULL
    unconditionally, which might lead to a NULL pointer dereference in
    handle_IRQ_event() when the hard interrupt context tries to wake up
    the handler thread.

    Prevent this by moving the thread stop after synchronize_irq(). No
    need to set action->thread to NULL either as action is going to be
    freed anyway.

    This fixes a boot crash reported against preempt-rt which uses the
    mainline irq threads code to implement full irq threading.

    [ tglx: removed local irqthread variable ]

    Signed-off-by: Linus Torvalds
    Signed-off-by: Thomas Gleixner

    Linus Torvalds
     

09 Aug, 2009

1 commit


08 Aug, 2009

1 commit


04 Aug, 2009

1 commit


23 Jul, 2009

1 commit

  • Since genirq: Delegate irq affinity setting to the irq thread
    (591d2fb02ea80472d846c0b8507007806bdd69cc) compilation with
    CONFIG_SMP=n fails with following error:

    /usr/src/linux-2.6/kernel/irq/manage.c:
    In function 'irq_thread_check_affinity':
    /usr/src/linux-2.6/kernel/irq/manage.c:475:
    error: 'struct irq_desc' has no member named 'affinity'
    make[4]: *** [kernel/irq/manage.o] Error 1

    That commit adds a new function irq_thread_check_affinity() which
    uses struct irq_desc.affinity which is only available for CONFIG_SMP=y.
    Move that function under #ifdef CONFIG_SMP.

    [ tglx@brownpaperbag: compile and boot tested on UP and SMP ]

    Signed-off-by: Bruno Premont
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Bruno Premont
     

21 Jul, 2009

1 commit

  • irq_set_thread_affinity() calls set_cpus_allowed_ptr() which might
    sleep, but irq_set_thread_affinity() is called with desc->lock held
    and can be called from hard interrupt context as well. The code has
    another bug as it does not hold a ref on the task struct as required
    by set_cpus_allowed_ptr().

    Just set the IRQTF_AFFINITY bit in action->thread_flags. The next time
    the thread runs it migrates itself. Solves all of the above problems
    nicely.

    Add kerneldoc to irq_set_thread_affinity() while at it.

    Signed-off-by: Thomas Gleixner
    LKML-Reference:

    Thomas Gleixner
     

05 Jul, 2009

1 commit


21 Jun, 2009

1 commit


12 Jun, 2009

3 commits

  • Ingo had

    [ 0.000000] ------------[ cut here ]------------
    [ 0.000000] WARNING: at mm/bootmem.c:537 alloc_arch_preferred_bootmem+0x2b/0x71()
    [ 0.000000] Hardware name: System Product Name
    [ 0.000000] Modules linked in:
    [ 0.000000] Pid: 0, comm: swapper Tainted: G W 2.6.30-tip-03087-g0bb2618-dirty #52506
    [ 0.000000] Call Trace:
    [ 0.000000] [] warn_slowpath_common+0x60/0x90
    [ 0.000000] [] warn_slowpath_null+0xd/0x10
    [ 0.000000] [] alloc_arch_preferred_bootmem+0x2b/0x71
    [ 0.000000] [] ___alloc_bootmem_nopanic+0x2b/0x9a
    [ 0.000000] [] ? lock_release+0xac/0xb2
    [ 0.000000] [] ___alloc_bootmem+0xe/0x2d
    [ 0.000000] [] __alloc_bootmem+0xa/0xc
    [ 0.000000] [] alloc_bootmem_cpumask_var+0x21/0x26
    [ 0.000000] [] early_irq_init+0x15/0x10d
    [ 0.000000] [] start_kernel+0x167/0x326
    [ 0.000000] [] __init_begin+0x6b/0x70
    [ 0.000000] ---[ end trace 4eaa2a86a8e2da23 ]---
    [ 0.000000] NR_IRQS:2304 nr_irqs:424
    [ 0.000000] CPU 0 irqstacks, hard=821e6000 soft=821e7000

    we need to update init_irq_default_affinity

    Signed-off-by: Yinghai Lu
    Signed-off-by: Pekka Enberg

    Yinghai Lu
     
  • Fixes the following problem:

    [ 0.000000] Experimental hierarchical RCU init done.
    [ 0.000000] NR_IRQS:4352 nr_irqs:256
    [ 0.000000] ------------[ cut here ]------------
    [ 0.000000] WARNING: at mm/bootmem.c:537 alloc_arch_preferred_bootmem+0x40/0x7e()
    [ 0.000000] Hardware name: To Be Filled By O.E.M.
    [ 0.000000] Pid: 0, comm: swapper Not tainted 2.6.30-tip-02161-g7a74539-dirty #59709
    [ 0.000000] Call Trace:
    [ 0.000000] [] ? alloc_arch_preferred_bootmem+0x40/0x7e
    [ 0.000000] [] warn_slowpath_common+0x88/0xcb
    [ 0.000000] [] warn_slowpath_null+0x27/0x3d
    [ 0.000000] [] alloc_arch_preferred_bootmem+0x40/0x7e
    [ 0.000000] [] ___alloc_bootmem_nopanic+0x4e/0xec
    [ 0.000000] [] ___alloc_bootmem+0x20/0x61
    [ 0.000000] [] __alloc_bootmem+0x1e/0x34
    [ 0.000000] [] early_irq_init+0x6d/0x118
    [ 0.000000] [] ? early_idt_handler+0x0/0x71
    [ 0.000000] [] start_kernel+0x192/0x394
    [ 0.000000] [] ? early_idt_handler+0x0/0x71
    [ 0.000000] [] x86_64_start_reservations+0xb4/0xcf
    [ 0.000000] [] ? __init_begin+0x0/0x140
    [ 0.000000] [] x86_64_start_kernel+0x158/0x17b
    [ 0.000000] ---[ end trace a7919e7f17c0a725 ]---
    [ 0.000000] Fast TSC calibration using PIT
    [ 0.000000] Detected 2002.510 MHz processor.
    [ 0.004000] Console: colour VGA+ 80x25

    Reported-by: Ingo Molnar
    Signed-off-by: Pekka Enberg

    Pekka Enberg
     
  • Don't hardcode to node zero for early boot IRQ setup memory allocations.

    [ penberg@cs.helsinki.fi: minor cleanups ]
    Cc: Ingo Molnar
    Cc: Johannes Weiner
    Cc: Linus Torvalds
    Signed-off-by: Yinghai Lu
    Signed-off-by: Pekka Enberg

    Yinghai Lu
     

11 Jun, 2009

1 commit

  • * 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (244 commits)
    Revert "x86, bts: reenable ptrace branch trace support"
    tracing: do not translate event helper macros in print format
    ftrace/documentation: fix typo in function grapher name
    tracing/events: convert block trace points to TRACE_EVENT(), fix !CONFIG_BLOCK
    tracing: add protection around module events unload
    tracing: add trace_seq_vprint interface
    tracing: fix the block trace points print size
    tracing/events: convert block trace points to TRACE_EVENT()
    ring-buffer: fix ret in rb_add_time_stamp
    ring-buffer: pass in lockdep class key for reader_lock
    tracing: add annotation to what type of stack trace is recorded
    tracing: fix multiple use of __print_flags and __print_symbolic
    tracing/events: fix output format of user stack
    tracing/events: fix output format of kernel stack
    tracing/trace_stack: fix the number of entries in the header
    ring-buffer: discard timestamps that are at the start of the buffer
    ring-buffer: try to discard unneeded timestamps
    ring-buffer: fix bug in ring_buffer_discard_commit
    ftrace: do not profile functions when disabled
    tracing: make trace pipe recognize latency format flag
    ...

    Linus Torvalds
     

23 May, 2009

1 commit

  • Presently non-legacy IRQs have their irq_desc allocated with
    kzalloc_node(). This assumes that all callers of irq_to_desc_node_alloc()
    will be sufficiently late in the boot process that kmalloc is available.

    While porting sparseirq support to sh this blew up immediately, as at the
    time that we register the CPU's interrupt vector map only bootmem is
    available. Check slab_is_available() to work out which path to use.

    [ Impact: fix SH early boot crash with sparseirq enabled ]

    Signed-off-by: Paul Mundt
    Acked-by: Yinghai Lu
    Cc: Andrew Morton
    Cc: Mel Gorman
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul Mundt
     

13 May, 2009

1 commit

  • Trying to implement a driver to use threaded irqs, I was confused when the
    return value to use that was described in the comment above
    request_threaded_irq was not defined.

    Turns out that the enum is IRQ_WAKE_THREAD where as the comment said
    IRQ_THREAD_WAKE.

    [Impact: do not confuse developers with wrong comments ]

    Signed-off-by: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Thomas Gleixner

    Steven Rostedt
     

12 May, 2009

1 commit


07 May, 2009

1 commit


02 May, 2009

1 commit

  • move_irq_desc() will try to move irq_desc to the home node if
    the allocated one is not correct, in create_irq_nr().

    ( This can happen on devices that are on different nodes that
    are using MSI, when drivers are loaded and unloaded randomly. )

    v2: fix non-smp build
    v3: add NUMA_IRQ_DESC to eliminate #ifdefs

    [ Impact: improve irq descriptor locality on NUMA systems ]

    Signed-off-by: Yinghai Lu
    Cc: Andrew Morton
    Cc: Suresh Siddha
    Cc: "Eric W. Biederman"
    Cc: Rusty Russell
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Yinghai Lu
     

01 May, 2009

1 commit


29 Apr, 2009

1 commit

  • "tracing: create automated trace defines" causes this compile error on s390,
    as reported by Sachin Sant against linux-next:

    kernel/built-in.o: In function `__do_softirq':
    (.text+0x1c680): undefined reference to `__tracepoint_softirq_entry'

    This happens because the definitions of the softirq tracepoints were moved
    from kernel/softirq.c to kernel/irq/handle.c. Since s390 doesn't support
    generic hardirqs handle.c doesn't get compiled and the definitions are
    missing.

    So move the tracepoints to softirq.c again.

    [ Impact: fix build failure on s390 ]

    Reported-by: Sachin Sant
    Signed-off-by: Heiko Carstens
    Cc: Steven Rostedt
    Cc: fweisbec@gmail.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Heiko Carstens