1. 03 Sep, 2013 6 commits
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging · 7e752241
      Linus Torvalds authored
      Pull hwmon updates from Guenter Roeck:
       - new driver for HTU21D (humidity sensor)
       - add support for Fam16h (Kabini) to k10temp
       - add support for NCT6102D/6106D and NCT6791D to nct6775 driver
       - add support for ADS1115 to ads1015 driver
       - add support for hibernate to w83627ehf and nct6775 drivers
       - some minor cleanups
      
      * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (htu21) Add Measurement Specialties HTU21D support
        hwmon: Change my email address.
        hwmon: (k10temp) Add support for Fam16h (Kabini)
        hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
        hwmon: (ads1015) Add support for ADS1115
        hwmon: (w83627ehf) Add support for hibernate
        hwmon: (nct6775) Add support for hibernate
        hwmon: use dev_get_platdata()
        hwmon: (nct6775) Fix size of data->temp array
        hwmon: (nct6775) Avoid using device platform data outside probe function
        hwmon: (nct6775) Add support for NCT6791D
        hwmon: (nct6775) Add support for beep attributes
        hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106
        hwmon: (nct6775) Add support for NCT6102D/6106D
        hwmon: (nct6775) Support two SuperIO chips in the same system
        hwmon: (nct6775) Allocate attributes dynamically from templates
        hwmon: (coretemp) Atom CPUs don't support TjMax; no warning needed
      7e752241
    • Manfred Spraul's avatar
      ipc/msg.c: Fix lost wakeup in msgsnd(). · bebcb928
      Manfred Spraul authored
      The check if the queue is full and adding current to the wait queue of
      pending msgsnd() operations (ss_add()) must be atomic.
      
      Otherwise:
       - the thread that performs msgsnd() finds a full queue and decides to
         sleep.
       - the thread that performs msgrcv() first reads all messages from the
         queue and then sleeps, because the queue is empty.
       - the msgrcv() calls do not perform any wakeups, because the msgsnd()
         task has not yet called ss_add().
       - then the msgsnd()-thread first calls ss_add() and then sleeps.
      
      Net result: msgsnd() and msgrcv() both sleep forever.
      
      Observed with msgctl08 from ltp with a preemptible kernel.
      
      Fix: Call ipc_lock_object() before performing the check.
      
      The patch also moves security_msg_queue_msgsnd() under ipc_lock_object:
       - msgctl(IPC_SET) explicitely mentions that it tries to expunge any
         pending operations that are not allowed anymore with the new
         permissions.  If security_msg_queue_msgsnd() is called without locks,
         then there might be races.
       - it makes the patch much simpler.
      Reported-and-tested-by: default avatarVineet Gupta <Vineet.Gupta1@synopsys.com>
      Acked-by: default avatarRik van Riel <riel@redhat.com>
      Cc: stable@vger.kernel.org  # for 3.11
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bebcb928
    • Linus Torvalds's avatar
      Merge tag 'regulator-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · ec1882a9
      Linus Torvalds authored
      Pull regulator updates from Mark Brown:
       "Not much exciting going on with the regulator API this time around,
        lots of driver fixes and enhancements - the main thing is the addition
        of a new API to help make the stubbing code do the right thing for
        missing regulator mappings.
      
        Highlights:
      
         - A new regulator_get_optional() API call for regulators that can be
           absent in normal operation.  This currently does nothing but will
           be used to improve the stubbing code for unspecified regulators,
           helping avoid some of the issues we've seen with adding new
           regulator support.
         - Helpers for devices with multiple linear ranges of voltages in the
           same regulator.
         - Moved the helpers into a separate file since core.c is getting
           rather large.
         - New drivers for Dialog DA9210 and DA9063, Freescale pfuze100 and
           Marvell 88pm800"
      
      * tag 'regulator-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (70 commits)
        regulator: da9063: Statize da9063_ldo_lim_event
        regulator: lp872x: Make REGULATOR_LP872X depend on I2C rather than I2C=y
        regulator: tps65217: Convert to use linear ranges
        regulator: da9063: Use IS_ERR to check return value of regulator_register()
        regulator: da9063: Optimize da9063_set_current_limit implementation
        regulator: build: Allow most regulators to be built as modules
        regulator: Add devm_regulator_get_exclusive()
        regulator: da9063: Add Dialog DA9063 voltage regulators support.
        regulator: ti-abb: simplify platform_get_resource_byname/devm_ioremap_resource
        hwmon: (sht15) Use devm_regulator_get_optional()
        regulator: core: Use bool for exclusivitity flag
        regulator: 88pm800: forever loop in pm800_regulator_probe()
        cpufreq: cpufreq-cpu0: Use devm_regulator_get_optional()
        regulator: da9210: Remove redundant MODULE_ALIAS
        regulator: 88pm800: Fix checking whether num_regulator is valid
        regulator: s2mps11: Fix setting ramp_delay
        regulator: s2mps11: Fix wrong arguments for regmap_update_bits() call
        regulator: palmas: Update the DT binding doc for smps10 out1 and out2
        regulator: palmas: model SMPS10 as two regulators
        regulator: core: Move list_voltage_{linear,linear_range,table} to helpers.c
        ...
      ec1882a9
    • Linus Torvalds's avatar
      Merge tag 'spi-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 5d3fed70
      Linus Torvalds authored
      Pull spi updates from Mark Brown:
       "Business as usual for SPI - some new drivers, lots of fixes and
        updates to existing drivers plus some new framework features.  Notable
        changes are:
      
         - Support for dual and quad data lines, commonly used by flash chips
           to improve performance, from Wang Yuhang.
         - Factored out a common pattern for runtime PM implementation into
           the core saving a bunch of code.
         - A particularly nice set of updates to the ep93xx driver from
           H Hartley Sweeten, modernising it and reducing the code size a lot.
         - New drivers for Blackfin v3, EFM32, Freescale DSPI and TI QSPI"
      
      * tag 'spi-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (133 commits)
        spi/qspi: fix missing unlock on error in ti_qspi_start_transfer_one()
        spi: quad: fix the name of DT property
        spi: core: Fix spi_register_master error handling
        spi: efm32: Fix build error
        spi: altera: Use DIV_ROUND_UP to calculate hw->bytes_per_word
        spi: rspi: Add spi_master_get() call to prevent use after free
        spi: quad: Make DT properties optional
        spi: quad: Fix missing return
        spi: Use dev_get_drvdata at appropriate places
        spi: use dev_get_platdata()
        spi: nuc900: Fix mode_bits setting
        spi: simplify devm_request_mem_region/devm_ioremap
        spi: altera: Simplify altera_spi_txrx implementation for noirq case
        spi: spi-rspi: fix inconsistent spin_lock_irqsave
        spi/qspi: Add compatible string for am4372.
        spi/qspi: Fix device table entry
        spi/sirf: fix the misunderstanding about len of spi_transfer
        spi/qspi: Add dual/quad spi read support
        spi: sirf: fix error return code in spi_sirfsoc_probe()
        spi: bcm2835: Add spi_master_get() call to prevent use after free
        ...
      5d3fed70
    • Linus Torvalds's avatar
      Merge tag 'regmap-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap · 8243b7f5
      Linus Torvalds authored
      Pull regmap updates from Mark Brown:
       "A quiet release for regmap, some cleanups, fixes and:
      
         - Improved node coalescing for rbtree, reducing memory usage and
           improving performance during syncs.
         - Support for registering multiple register patches.
         - A quirk for handling interrupts that need to be clear when masked
           in regmap-irq"
      
      * tag 'regmap-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
        regmap: rbtree: Make cache_present bitmap per node
        regmap: rbtree: Reduce number of nodes, take 2
        regmap: rbtree: Simplify adjacent node look-up
        regmap: debugfs: Fix continued read from registers file
        regcache-rbtree: Fix reg_stride != 1
        regmap: Allow multiple patches to be registered
        regmap: regcache: allow read-only regs to be cached
        regmap: fix regcache_reg_present() for empty cache
        regmap: core: allow a virtual range to cover its own data window
        regmap: irq: document mask/wake_invert flags
        regmap: irq: make flags bool and put them in a bitfield
        regmap: irq: Allow to acknowledge masked interrupts during initialization
        regmap: Provide __acquires/__releases annotations
      8243b7f5
    • Linus Torvalds's avatar
      Merge branch 'lockref' (locked reference counts) · fc6d0b03
      Linus Torvalds authored
      Merge lockref infrastructure code by me and Waiman Long.
      
      I already merged some of the preparatory patches that didn't actually do
      any semantic changes earlier, but this merges the actual _reason_ for
      those preparatory patches.
      
      The "lockref" structure is a combination "spinlock and reference count"
      that allows optimized reference count accesses.  In particular, it
      guarantees that the reference count will be updated AS IF the spinlock
      was held, but using atomic accesses that cover both the reference count
      and the spinlock words, we can often do the update without actually
      having to take the lock.
      
      This allows us to avoid the nastiest cases of spinlock contention on
      large machines under heavy pathname lookup loads.  When updating the
      dentry reference counts on a large system, we'll still end up with the
      cache line bouncing around, but that's much less noticeable than
      actually having to spin waiting for the lock.
      
      * lockref:
        lockref: implement lockless reference count updates using cmpxchg()
        lockref: uninline lockref helper functions
        vfs: reimplement d_rcu_to_refcount() using lockref_get_or_lock()
        vfs: use lockref_get_not_zero() for optimistic lockless dget_parent()
        lockref: add 'lockref_get_or_lock() helper
      fc6d0b03
  2. 02 Sep, 2013 9 commits
    • Linus Torvalds's avatar
      Linux 3.11 · 6e466452
      Linus Torvalds authored
      6e466452
    • Linus Torvalds's avatar
      lockref: implement lockless reference count updates using cmpxchg() · bc08b449
      Linus Torvalds authored
      Instead of taking the spinlock, the lockless versions atomically check
      that the lock is not taken, and do the reference count update using a
      cmpxchg() loop.  This is semantically identical to doing the reference
      count update protected by the lock, but avoids the "wait for lock"
      contention that you get when accesses to the reference count are
      contended.
      
      Note that a "lockref" is absolutely _not_ equivalent to an atomic_t.
      Even when the lockref reference counts are updated atomically with
      cmpxchg, the fact that they also verify the state of the spinlock means
      that the lockless updates can never happen while somebody else holds the
      spinlock.
      
      So while "lockref_put_or_lock()" looks a lot like just another name for
      "atomic_dec_and_lock()", and both optimize to lockless updates, they are
      fundamentally different: the decrement done by atomic_dec_and_lock() is
      truly independent of any lock (as long as it doesn't decrement to zero),
      so a locked region can still see the count change.
      
      The lockref structure, in contrast, really is a *locked* reference
      count.  If you hold the spinlock, the reference count will be stable and
      you can modify the reference count without using atomics, because even
      the lockless updates will see and respect the state of the lock.
      
      In order to enable the cmpxchg lockless code, the architecture needs to
      do three things:
      
       (1) Make sure that the "arch_spinlock_t" and an "unsigned int" can fit
           in an aligned u64, and have a "cmpxchg()" implementation that works
           on such a u64 data type.
      
       (2) define a helper function to test for a spinlock being unlocked
           ("arch_spin_value_unlocked()")
      
       (3) select the "ARCH_USE_CMPXCHG_LOCKREF" config variable in its
           Kconfig file.
      
      This enables it for x86-64 (but not 32-bit, we'd need to make sure
      cmpxchg() turns into the proper cmpxchg8b in order to enable it for
      32-bit mode).
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bc08b449
    • Linus Torvalds's avatar
      lockref: uninline lockref helper functions · 2f4f12e5
      Linus Torvalds authored
      They aren't very good to inline, since they already call external
      functions (the spinlock code), and we're going to create rather more
      complicated versions of them that can do the reference count updates
      locklessly.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2f4f12e5
    • Linus Torvalds's avatar
      vfs: reimplement d_rcu_to_refcount() using lockref_get_or_lock() · 15570086
      Linus Torvalds authored
      This moves __d_rcu_to_refcount() from <linux/dcache.h> into fs/namei.c
      and re-implements it using the lockref infrastructure instead.  It also
      adds a lot of comments about what is actually going on, because turning
      a dentry that was looked up using RCU into a long-lived reference
      counted entry is one of the more subtle parts of the rcu walk.
      
      We also used to be _particularly_ subtle in unlazy_walk() where we
      re-validate both the dentry and its parent using the same sequence
      count.  We used to do it by nesting the locks and then verifying the
      sequence count just once.
      
      That was silly, because nested locking is expensive, but the sequence
      count check is not.  So this just re-validates the dentry and the parent
      separately, avoiding the nested locking, and making the lockref lookup
      possible.
      Acked-by: default avatarWaiman Long <waiman.long@hp.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      15570086
    • Waiman Long's avatar
      vfs: use lockref_get_not_zero() for optimistic lockless dget_parent() · df3d0bbc
      Waiman Long authored
      A valid parent pointer is always going to have a non-zero reference
      count, but if we look up the parent optimistically without locking, we
      have to protect against the (very unlikely) race against renaming
      changing the parent from under us.
      
      We do that by using lockref_get_not_zero(), and then re-checking the
      parent pointer after getting a valid reference.
      
      [ This is a re-implementation of a chunk from the original patch by
        Waiman Long: "dcache: Enable lockless update of dentry's refcount".
        I've completely rewritten the patch-series and split it up, but I'm
        attributing this part to Waiman as it's close enough to his earlier
        patch  - Linus ]
      Signed-off-by: default avatarWaiman Long <Waiman.Long@hp.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      df3d0bbc
    • Linus Torvalds's avatar
      lockref: add 'lockref_get_or_lock() helper · b3abd802
      Linus Torvalds authored
      This behaves like "lockref_get_not_zero()", but instead of doing nothing
      if the count was zero, it returns with the lock held.
      
      This allows callers to revalidate the lockref-protected data structure
      if required even if the count was zero to begin with, and possibly
      increment the count if it passes muster.
      
      In particular, the dentry code wants this when it wants to turn an
      RCU-protected dentry into a stable refcounted one: if the dentry count
      it zero, but the sequence number still validates the dentry, we can take
      a reference to it.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b3abd802
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 248d296d
      Linus Torvalds authored
      Pull SCSI fix from James Bottomley:
       "This is a bug fix for the pm80xx driver.  It turns out that when the
        new hardware support was added in 3.10 the IO command size was kept at
        the old hard coded value.  This means that the driver attaches to some
        new cards and then simply hangs the system"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        [SCSI] pm80xx: fix Adaptec 71605H hang
      248d296d
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e09a1fa9
      Linus Torvalds authored
      Pull x86 boot fix from Peter Anvin:
       "A single very small boot fix for very large memory systems (> 0.5T)"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Fix boot crash with DEBUG_PAGE_ALLOC=y and more than 512G RAM
      e09a1fa9
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma · ac0bc789
      Linus Torvalds authored
      Pull slave-dma fix from Vinod Koul:
       "A fix for resolving TI_EDMA driver's build error in allmodconfig to
        have filter function built in""
      
      * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma:
        dma/Kconfig: TI_EDMA needs to be boolean
      ac0bc789
  3. 01 Sep, 2013 25 commits