aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-09-03ipc/msg.c: Fix lost wakeup in msgsnd().Manfred Spraul1-7/+5
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: Vineet Gupta <Vineet.Gupta1@synopsys.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: stable@vger.kernel.org # for 3.11 Signed-off-by: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-03Merge tag 'regulator-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulatorLinus Torvalds72-1116/+3840
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 ...
2013-09-03Merge tag 'spi-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spiLinus Torvalds59-1347/+3721
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 ...
2013-09-03Merge tag 'regmap-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmapLinus Torvalds7-134/+201
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
2013-09-03Merge branch 'lockref' (locked reference counts)Linus Torvalds9-97/+237
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
2013-09-02Linux 3.11Linus Torvalds1-1/+1
2013-09-02lockref: implement lockless reference count updates using cmpxchg()Linus Torvalds5-3/+84
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: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-02lockref: uninline lockref helper functionsLinus Torvalds3-62/+74
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: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-02vfs: reimplement d_rcu_to_refcount() using lockref_get_or_lock()Linus Torvalds3-49/+65
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: Waiman Long <waiman.long@hp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-02vfs: use lockref_get_not_zero() for optimistic lockless dget_parent()Waiman Long1-0/+15
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: Waiman Long <Waiman.Long@hp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-02lockref: add 'lockref_get_or_lock() helperLinus Torvalds1-0/+16
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: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-02Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds2-4/+4
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
2013-09-02Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-2/+2
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
2013-09-02Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dmaLinus Torvalds1-1/+1
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
2013-09-01Merge remote-tracking branch 'regulator/topic/tps65912' into regulator-nextMark Brown1-20/+19
2013-09-01Merge remote-tracking branch 'regulator/topic/ti-abb' into regulator-nextMark Brown1-10/+0
2013-09-01Merge remote-tracking branch 'regulator/topic/sec' into regulator-nextMark Brown2-45/+211
2013-09-01Merge remote-tracking branch 'regulator/topic/ramp' into regulator-nextMark Brown4-6/+16
2013-09-01Merge remote-tracking branch 'regulator/topic/pfuze100' into regulator-nextMark Brown5-0/+613
2013-09-01Merge remote-tracking branch 'regulator/topic/palmas' into regulator-nextMark Brown3-12/+31
2013-09-01Merge remote-tracking branch 'regulator/topic/optional' into regulator-nextMark Brown8-7/+121
2013-09-01Merge remote-tracking branch 'regulator/topic/max8660' into regulator-nextMark Brown40-53/+188
2013-09-01Merge remote-tracking branch 'regulator/topic/lp8755' into regulator-nextMark Brown1-0/+1
2013-09-01Merge remote-tracking branch 'regulator/topic/lp872x' into regulator-nextMark Brown1-4/+5
2013-09-01Merge remote-tracking branch 'regulator/topic/linear-range' into regulator-nextMark Brown2-164/+37
2013-09-01Merge remote-tracking branch 'regulator/topic/kconfig' into regulator-nextMark Brown1-6/+6
2013-09-01Merge remote-tracking branch 'regulator/topic/helpers' into regulator-nextMark Brown4-463/+458
2013-09-01Merge remote-tracking branch 'regulator/topic/fan53555' into regulator-nextMark Brown1-0/+1
2013-09-01Merge remote-tracking branch 'regulator/topic/da9063' into regulator-nextMark Brown5-0/+1440
2013-09-01Merge remote-tracking branch 'regulator/topic/core' into regulator-nextMark Brown2-20/+31
2013-09-01Merge remote-tracking branch 'regulator/topic/as3711' into regulator-nextMark Brown1-132/+31
2013-09-01Merge remote-tracking branch 'regulator/topic/88pm800' into regulator-nextMark Brown9-275/+732
2013-09-01Merge remote-tracking branch 'spi/topic/txx9' into spi-nextMark Brown1-1/+1
2013-09-01Merge remote-tracking branch 'spi/topic/topcliff' into spi-nextMark Brown1-0/+2
2013-09-01Merge remote-tracking branch 'spi/topic/tle62x0' into spi-nextMark Brown0-0/+0
2013-09-01Merge remote-tracking branch 'spi/topic/tel62x0' into spi-nextMark Brown1-2/+1
2013-09-01Merge remote-tracking branch 'spi/topic/tegra' into spi-nextMark Brown1-7/+1
2013-09-01Merge remote-tracking branch 'spi/topic/sirf' into spi-nextMark Brown2-47/+182
2013-09-01Merge remote-tracking branch 'spi/topic/sh-msiof' into spi-nextMark Brown1-18/+0
2013-09-01Merge remote-tracking branch 'spi/topic/sh-hspi' into spi-nextMark Brown1-2/+0
2013-09-01Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-nextMark Brown1-69/+43
2013-09-01Merge remote-tracking branch 'spi/topic/rspi' into spi-nextMark Brown1-1/+1
2013-09-01Merge remote-tracking branch 'spi/topic/quad' into spi-nextMark Brown2-40/+47
2013-09-01Merge remote-tracking branch 'spi/topic/qspi' into spi-nextMark Brown16-136/+757
2013-09-01Merge remote-tracking branch 'spi/topic/pxa' into spi-nextMark Brown1-1/+8
2013-09-01Merge remote-tracking branch 'spi/topic/pl022' into spi-nextMark Brown1-2/+2
2013-09-01Merge remote-tracking branch 'spi/topic/pdata' into spi-nextMark Brown30-160/+125
2013-09-01Merge remote-tracking branch 'spi/topic/orion' into spi-nextMark Brown1-17/+5
2013-09-01Merge remote-tracking branch 'spi/topic/omap-100k' into spi-nextMark Brown1-198/+78
2013-09-01Merge remote-tracking branch 'spi/topic/octeon' into spi-nextMark Brown1-44/+5