21 Jul, 2011

7 commits

  • The rcu callback __put_tree() just calls a kfree(),
    so we use kfree_rcu() instead of the call_rcu(__put_tree).

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney
    Cc: Al Viro
    Cc: Eric Paris
    Reviewed-by: Josh Triplett

    Lai Jiangshan
     
  • The rcu callback whitelist_item_free() just calls a kfree(),
    so we use kfree_rcu() instead of the call_rcu(whitelist_item_free).

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney
    Acked-by: James Morris
    Reviewed-by: Josh Triplett

    Lai Jiangshan
     
  • The rcu callback free_conf() just calls a kfree(),
    so we use kfree_rcu() instead of the call_rcu(free_conf).

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney
    Acked-by: NeilBrown
    Reviewed-by: Josh Triplett

    Lai Jiangshan
     
  • The __lock_task_sighand() function calls rcu_read_lock() with interrupts
    and preemption enabled, but later calls rcu_read_unlock() with interrupts
    disabled. It is therefore possible that this RCU read-side critical
    section will be preempted and later RCU priority boosted, which means that
    rcu_read_unlock() will call rt_mutex_unlock() in order to deboost itself, but
    with interrupts disabled. This results in lockdep splats, so this commit
    nests the RCU read-side critical section within the interrupt-disabled
    region of code. This prevents the RCU read-side critical section from
    being preempted, and thus prevents the attempt to deboost with interrupts
    disabled.

    It is quite possible that a better long-term fix is to make rt_mutex_unlock()
    disable irqs when acquiring the rt_mutex structure's ->wait_lock.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The rcu_read_unlock_special() function relies on in_irq() to exclude
    scheduler activity from interrupt level. This fails because exit_irq()
    can invoke the scheduler after clearing the preempt_count() bits that
    in_irq() uses to determine that it is at interrupt level. This situation
    can result in failures as follows:

    $task IRQ SoftIRQ

    rcu_read_lock()

    /* do stuff */

    |= UNLOCK_BLOCKED

    rcu_read_unlock()
    --t->rcu_read_lock_nesting

    irq_enter();
    /* do stuff, don't use RCU */
    irq_exit();
    sub_preempt_count(IRQ_EXIT_OFFSET);
    invoke_softirq()

    ttwu();
    spin_lock_irq(&pi->lock)
    rcu_read_lock();
    /* do stuff */
    rcu_read_unlock();
    rcu_read_unlock_special()
    rcu_report_exp_rnp()
    ttwu()
    spin_lock_irq(&pi->lock) /* deadlock */

    rcu_read_unlock_special(t);

    Ed can simply trigger this 'easy' because invoke_softirq() immediately
    does a ttwu() of ksoftirqd/# instead of doing the in-place softirq stuff
    first, but even without that the above happens.

    Cure this by also excluding softirqs from the
    rcu_read_unlock_special() handler and ensuring the force_irqthreads
    ksoftirqd/# wakeup is done from full softirq context.

    [ Alternatively, delaying the ->rcu_read_lock_nesting decrement
    until after the special handling would make the thing more robust
    in the face of interrupts as well. And there is a separate patch
    for that. ]

    Cc: Thomas Gleixner
    Reported-and-tested-by: Ed Tomlinson
    Signed-off-by: Peter Zijlstra
    Signed-off-by: Paul E. McKenney

    Peter Zijlstra
     
  • Ensure scheduler_ipi() calls irq_{enter,exit} when it does some actual
    work. Traditionally we never did any actual work from the resched IPI
    and all magic happened in the return from interrupt path.

    Now that we do do some work, we need to ensure irq_{enter,exit} are
    called so that we don't confuse things.

    This affects things like timekeeping, NO_HZ and RCU, basically
    everything with a hook in irq_enter/exit.

    Explicit examples of things going wrong are:

    sched_clock_cpu() -- has a callback when leaving NO_HZ state to take
    a new reading from GTOD and TSC. Without this
    callback, time is stuck in the past.

    RCU -- needs in_irq() to work in order to avoid some nasty deadlocks

    Signed-off-by: Peter Zijlstra
    Signed-off-by: Paul E. McKenney

    Peter Zijlstra
     
  • The addition of RCU read-side critical sections within runqueue and
    priority-inheritance lock critical sections introduced some deadlock
    cycles, for example, involving interrupts from __rcu_read_unlock()
    where the interrupt handlers call wake_up(). This situation can cause
    the instance of __rcu_read_unlock() invoked from interrupt to do some
    of the processing that would otherwise have been carried out by the
    task-level instance of __rcu_read_unlock(). When the interrupt-level
    instance of __rcu_read_unlock() is called with a scheduler lock held
    from interrupt-entry/exit situations where in_irq() returns false,
    deadlock can result.

    This commit resolves these deadlocks by using negative values of
    the per-task ->rcu_read_lock_nesting counter to indicate that an
    instance of __rcu_read_unlock() is in flight, which in turn prevents
    instances from interrupt handlers from doing any special processing.
    This patch is inspired by Steven Rostedt's earlier patch that similarly
    made __rcu_read_unlock() guard against interrupt-mediated recursion
    (see https://lkml.org/lkml/2011/7/15/326), but this commit refines
    Steven's approach to avoid the need for preemption disabling on the
    __rcu_read_unlock() fastpath and to also avoid the need for manipulating
    a separate per-CPU variable.

    This patch avoids need for preempt_disable() by instead using negative
    values of the per-task ->rcu_read_lock_nesting counter. Note that nested
    rcu_read_lock()/rcu_read_unlock() pairs are still permitted, but they will
    never see ->rcu_read_lock_nesting go to zero, and will therefore never
    invoke rcu_read_unlock_special(), thus preventing them from seeing the
    RCU_READ_UNLOCK_BLOCKED bit should it be set in ->rcu_read_unlock_special.
    This patch also adds a check for ->rcu_read_unlock_special being negative
    in rcu_check_callbacks(), thus preventing the RCU_READ_UNLOCK_NEED_QS
    bit from being set should a scheduling-clock interrupt occur while
    __rcu_read_unlock() is exiting from an outermost RCU read-side critical
    section.

    Of course, __rcu_read_unlock() can be preempted during the time that
    ->rcu_read_lock_nesting is negative. This could result in the setting
    of the RCU_READ_UNLOCK_BLOCKED bit after __rcu_read_unlock() checks it,
    and would also result it this task being queued on the corresponding
    rcu_node structure's blkd_tasks list. Therefore, some later RCU read-side
    critical section would enter rcu_read_unlock_special() to clean up --
    which could result in deadlock if that critical section happened to be in
    the scheduler where the runqueue or priority-inheritance locks were held.

    This situation is dealt with by making rcu_preempt_note_context_switch()
    check for negative ->rcu_read_lock_nesting, thus refraining from
    queuing the task (and from setting RCU_READ_UNLOCK_BLOCKED) if we are
    already exiting from the outermost RCU read-side critical section (in
    other words, we really are no longer actually in that RCU read-side
    critical section). In addition, rcu_preempt_note_context_switch()
    invokes rcu_read_unlock_special() to carry out the cleanup in this case,
    which clears out the ->rcu_read_unlock_special bits and dequeues the task
    (if necessary), in turn avoiding needless delay of the current RCU grace
    period and needless RCU priority boosting.

    It is still illegal to call rcu_read_unlock() while holding a scheduler
    lock if the prior RCU read-side critical section has ever had either
    preemption or irqs enabled. However, the common use case is legal,
    namely where then entire RCU read-side critical section executes with
    irqs disabled, for example, when the scheduler lock is held across the
    entire lifetime of the RCU read-side critical section.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

20 Jul, 2011

3 commits

  • Given some common flag combinations, particularly -Os, gcc will inline
    rcu_read_unlock_special() despite its being in an unlikely() clause.
    Use noinline to prohibit this misoptimization.

    In addition, move the second barrier() in __rcu_read_unlock() so that
    it is not on the common-case code path. This will allow the compiler to
    generate better code for the common-case path through __rcu_read_unlock().

    Suggested-by: Linus Torvalds
    Signed-off-by: Paul E. McKenney
    Acked-by: Mathieu Desnoyers

    Paul E. McKenney
     
  • The RCU_BOOST commits for TREE_PREEMPT_RCU introduced an other-task
    write to a new RCU_READ_UNLOCK_BOOSTED bit in the task_struct structure's
    ->rcu_read_unlock_special field, but, as noted by Steven Rostedt, without
    correctly synchronizing all accesses to ->rcu_read_unlock_special.
    This could result in bits in ->rcu_read_unlock_special being spuriously
    set and cleared due to conflicting accesses, which in turn could result
    in deadlocks between the rcu_node structure's ->lock and the scheduler's
    rq and pi locks. These deadlocks would result from RCU incorrectly
    believing that the just-ended RCU read-side critical section had been
    preempted and/or boosted. If that RCU read-side critical section was
    executed with either rq or pi locks held, RCU's ensuing (incorrect)
    calls to the scheduler would cause the scheduler to attempt to once
    again acquire the rq and pi locks, resulting in deadlock. More complex
    deadlock cycles are also possible, involving multiple rq and pi locks
    as well as locks from multiple rcu_node structures.

    This commit fixes synchronization by creating ->rcu_boosted field in
    task_struct that is accessed and modified only when holding the ->lock
    in the rcu_node structure on which the task is queued (on that rcu_node
    structure's ->blkd_tasks list). This results in tasks accessing only
    their own current->rcu_read_unlock_special fields, making unsynchronized
    access once again legal, and keeping the rcu_read_unlock() fastpath free
    of atomic instructions and memory barriers.

    The reason that the rcu_read_unlock() fastpath does not need to access
    the new current->rcu_boosted field is that this new field cannot
    be non-zero unless the RCU_READ_UNLOCK_BLOCKED bit is set in the
    current->rcu_read_unlock_special field. Therefore, rcu_read_unlock()
    need only test current->rcu_read_unlock_special: if that is zero, then
    current->rcu_boosted must also be zero.

    This bug does not affect TINY_PREEMPT_RCU because this implementation
    of RCU accesses current->rcu_read_unlock_special with irqs disabled,
    thus preventing races on the !SMP systems that TINY_PREEMPT_RCU runs on.

    Maybe-reported-by: Dave Jones
    Maybe-reported-by: Sergey Senozhatsky
    Reported-by: Steven Rostedt
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Steven Rostedt

    Paul E. McKenney
     
  • PREEMPT_RCU read-side critical sections blocking an expedited grace
    period invoke rcu_report_exp_rnp(). When the last such critical section
    has completed, rcu_report_exp_rnp() invokes the scheduler to wake up the
    task that invoked synchronize_rcu_expedited() -- needlessly holding the
    root rcu_node structure's lock while doing so, thus needlessly providing
    a way for RCU and the scheduler to deadlock.

    This commit therefore releases the root rcu_node structure's lock before
    calling wake_up().

    Reported-by: Ed Tomlinson
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

13 Jul, 2011

1 commit

  • Under some rare but real combinations of configuration parameters, RCU
    callbacks are posted during early boot that use kernel facilities that
    are not yet initialized. Therefore, when these callbacks are invoked,
    hard hangs and crashes ensue. This commit therefore prevents RCU
    callbacks from being invoked until after the scheduler is fully up and
    running, as in after multiple tasks have been spawned.

    It might well turn out that a better approach is to identify the specific
    RCU callbacks that are causing this problem, but that discussion will
    wait until such time as someone really needs an RCU callback to be invoked
    (as opposed to merely registered) during early boot.

    Reported-by: julie Sullivan
    Reported-by: RKK
    Signed-off-by: Paul E. McKenney
    Tested-by: Konrad Rzeszutek Wilk
    Tested-by: julie Sullivan
    Tested-by: RKK

    Paul E. McKenney
     

12 Jul, 2011

11 commits


11 Jul, 2011

6 commits

  • [ 191.310008] WARNING: kmemcheck: Caught 32-bit read from freed memory (f0d25f14)
    [ 191.310011] c056d2f088000000105fd2f00000000050415353040000000000000000000000
    [ 191.310020] i i i i f f f f f f f f f f f f f f f f f f f f f f f f f f f f
    [ 191.310027] ^
    [ 191.310029]
    [ 191.310032] Pid: 737, comm: modprobe Not tainted 3.0.0-rc5+ #268 Hewlett-Packard HP Compaq 6005 Pro SFF PC/3047h
    [ 191.310036] EIP: 0060:[] EFLAGS: 00010286 CPU: 0
    [ 191.310039] EIP is at hp_wmi_perform_query+0x104/0x150 [hp_wmi]
    [ 191.310041] EAX: f0d25601 EBX: f0d25f00 ECX: 000121cf EDX: 000121ce
    [ 191.310043] ESI: f0d25f10 EDI: f0f97ea8 EBP: f0f97ec4 ESP: c173f34c
    [ 191.310045] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [ 191.310046] CR0: 8005003b CR2: f540c000 CR3: 30f30000 CR4: 000006d0
    [ 191.310048] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    [ 191.310050] DR6: ffff4ff0 DR7: 00000400
    [ 191.310051] [] hp_wmi_dock_state+0x2b/0x40 [hp_wmi]
    [ 191.310054] [] hp_wmi_init+0x93/0x1a8 [hp_wmi]
    [ 191.310057] [] do_one_initcall+0x30/0x170
    [ 191.310061] [] sys_init_module+0xef/0x1a60
    [ 191.310064] [] sysenter_do_call+0x12/0x28
    [ 191.310067] [] 0xffffffff

    Signed-off-by: Eric Dumazet
    Signed-off-by: Matthew Garrett

    Eric Dumazet
     
  • Using buffer->output[1] without mutex_lock()

    Signed-off-by: Jose Alonso
    Signed-off-by: Matthew Garrett

    Jose Alonso
     
  • This reverts commit a3d77411e8b2ad661958c1fbee65beb476ec6d70,

    as it causes a mess in the wireless rfkill status on some models.
    It is probably a bad idea to toggle the rfkill for all dell models
    without the respect to the claim that it is hardware-controlled.

    Cc: stable@kernel.org
    Signed-off-by: Keng-Yu Lin
    Signed-off-by: Matthew Garrett

    Keng-Yu Lin
     
  • Patch 2e711c04dbbf7a7732a3f7073b1fc285d12b369d
    (PM: Remove sysdev suspend, resume and shutdown operations)
    deleted sysdev_suspend(), which was being relied on to call
    check_wakeup_irqs() in suspend. If check_wakeup_irqs() is not
    called, wake interrupts that are pending when suspend is
    entered may be lost. It also breaks IRQCHIP_MASK_ON_SUSPEND,
    which is handled in check_wakeup_irqs().

    This patch adds a call to check_wakeup_irqs() in syscore_suspend(),
    similar to what was deleted in sysdev_suspend().

    Signed-off-by: Colin Cross
    Signed-off-by: Rafael J. Wysocki

    Colin Cross
     
  • I came across a memory leak during a cyclic cpu-online-offline test.

    Signed-off-by: Yu Luming
    Cc: Len Brown
    Signed-off-by: Andrew Morton
    Signed-off-by: Dave Jones

    Luming Yu
     
  • * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
    hwmon: (pmbus) Improve auto-detection of temperature status register
    hwmon: (lm95241) Fix negative temperature results
    hwmon: (lm95241) Fix chip detection code

    Linus Torvalds
     

10 Jul, 2011

9 commits

  • It is possible that a PMBus device supports the READ_TEMPERATURE2 and/or
    READ_TEMPERATURE3 registers but does not support READ_TEMPERATURE1.
    Improve temperature status register detection to address this condition.

    Reported-by: Jean Delvare
    Signed-off-by: Guenter Roeck
    Acked-by: Jean Delvare
    Cc: stable@kernel.org # 2.6.39+

    Guenter Roeck
     
  • Negative temperatures were returned in degrees C instead of milli-Degrees C.
    Also, negative temperatures were reported for remote temperature sensors even
    if the chip was configured for positive-only results.

    Fix by detecting temperature modes, and by treating negative temperatures
    similar to positive temperatures, with appropriate sign extension.

    Signed-off-by: Guenter Roeck
    Acked-by: Jean Delvare
    Cc: stable@kernel.org # 2.6.30+

    Guenter Roeck
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
    ALSA: hda - Fix a copmile warning
    ASoC: ak4642: fixup snd_soc_update_bits mask for PW_MGMT2
    ALSA: hda - Change all ADCs for dual-adc switching mode for Realtek
    ASoC: Manage WM8731 ACTIVE bit as a supply widget
    ASoC: Don't set invalid name string to snd_card->driver field
    ASoC: Ensure we delay long enough for WM8994 FLL to lock when starting
    ASoC: Tegra: I2S: Ensure clock is enabled when writing regs
    ASoC: Fix Blackfin I2S _pointer() implementation return in bounds values
    ASoC: tlv320aic3x: Do soft reset to codec when going to bias off state
    ASoC: tlv320aic3x: Don't sync first two registers from register cache
    audio: tlv320aic26: fix PLL register configuration

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
    PCI: conditional resource-reallocation through kernel parameter pci=realloc

    Linus Torvalds
     
  • * 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm:
    ARM: 6994/1: smp_twd: Fix typo in 'twd_timer_rate' printing
    ARM: 6987/1: l2x0: fix disabling function to avoid deadlock
    ARM: 6966/1: ep93xx: fix inverted RTS/DTR signals on uart1
    ARM: 6980/1: mmci: use StartBitErr to detect bad connections
    ARM: 6979/1: mach-vt8500: add forgotten irq_data conversion
    ARM: move memory layout sanity checking before meminfo initialization
    ARM: 6990/1: MAINTAINERS: add entry for ARM PMU profiling and debugging
    ARM: 6989/1: perf: do not start the PMU when no events are present
    ARM: dmabounce: fix map_single() error return value

    Linus Torvalds
     
  • * 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
    drm/radeon/kms: clean up multiple crtc handling for evergreen+ (v2)

    Linus Torvalds
     
  • When firewire-ohci is bound to a Pinnacle MovieBoard, eventually a
    "Register access failure" is logged and an interrupt storm or a kernel
    panic happens. https://bugzilla.kernel.org/show_bug.cgi?id=36622

    Until this is sorted out (if that is going to succeed at all), let's
    just prevent firewire-ohci from touching these devices.

    Signed-off-by: Stefan Richter
    Cc:

    Stefan Richter
     
  • Regression introduced in commit 724d9f1cfba.

    Prior to that, expand_dfs_referral would regenerate the mount data string
    and then call cifs_parse_mount_options to re-parse it (klunky, but it
    worked). The above commit moved cifs_parse_mount_options out of cifs_mount,
    so the re-parsing of the new mount options no longer occurred. Fix it by
    making expand_dfs_referral re-parse the mount options.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • This needs to be done regardless of whether that KConfig option is set
    or not.

    Reported-by: Sven-Haegar Koch
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

09 Jul, 2011

3 commits