Skip to content

Commit 00bcf5c

Browse files
committed
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: "The main changes in this cycle were: - rwsem micro-optimizations (Davidlohr Bueso) - Improve the implementation and optimize the performance of percpu-rwsems. (Peter Zijlstra.) - Convert all lglock users to better facilities such as percpu-rwsems or percpu-spinlocks and remove lglocks. (Peter Zijlstra) - Remove the ticket (spin)lock implementation. (Peter Zijlstra) - Korean translation of memory-barriers.txt and related fixes to the English document. (SeongJae Park) - misc fixes and cleanups" * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits) x86/cmpxchg, locking/atomics: Remove superfluous definitions x86, locking/spinlocks: Remove ticket (spin)lock implementation locking/lglock: Remove lglock implementation stop_machine: Remove stop_cpus_lock and lg_double_lock/unlock() fs/locks: Use percpu_down_read_preempt_disable() locking/percpu-rwsem: Add down_read_preempt_disable() fs/locks: Replace lg_local with a per-cpu spinlock fs/locks: Replace lg_global with a percpu-rwsem locking/percpu-rwsem: Add DEFINE_STATIC_PERCPU_RWSEMand percpu_rwsem_assert_held() locking/pv-qspinlock: Use cmpxchg_release() in __pv_queued_spin_unlock() locking/rwsem, x86: Drop a bogus cc clobber futex: Add some more function commentry locking/hung_task: Show all locks locking/rwsem: Scan the wait_list for readers only once locking/rwsem: Remove a few useless comments locking/rwsem: Return void in __rwsem_mark_wake() locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write() locking/Documentation: Add Korean translation locking/Documentation: Fix a typo of example result locking/Documentation: Fix wrong section reference ...
2 parents de956b8 + 0864507 commit 00bcf5c

31 files changed

Lines changed: 3540 additions & 1337 deletions

‎Documentation/ko_KR/memory-barriers.txt‎

Lines changed: 3135 additions & 0 deletions
Large diffs are not rendered by default.

‎Documentation/locking/lglock.txt‎

Lines changed: 0 additions & 166 deletions
This file was deleted.

‎Documentation/memory-barriers.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ A data-dependency barrier must also order against dependent writes:
609609
The data-dependency barrier must order the read into Q with the store
610610
into *Q. This prohibits this outcome:
611611

612-
(Q == B) && (B == 4)
612+
(Q == &B) && (B == 4)
613613

614614
Please note that this pattern should be rare. After all, the whole point
615615
of dependency ordering is to -prevent- writes to the data structure, along
@@ -1928,6 +1928,7 @@ There are some more advanced barrier functions:
19281928

19291929
See Documentation/DMA-API.txt for more information on consistent memory.
19301930

1931+
19311932
MMIO WRITE BARRIER
19321933
------------------
19331934

@@ -2075,7 +2076,7 @@ systems, and so cannot be counted on in such a situation to actually achieve
20752076
anything at all - especially with respect to I/O accesses - unless combined
20762077
with interrupt disabling operations.
20772078

2078-
See also the section on "Inter-CPU locking barrier effects".
2079+
See also the section on "Inter-CPU acquiring barrier effects".
20792080

20802081

20812082
As an example, consider the following:

‎arch/x86/Kconfig‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,6 @@ config PARAVIRT_DEBUG
705705
config PARAVIRT_SPINLOCKS
706706
bool "Paravirtualization layer for spinlocks"
707707
depends on PARAVIRT && SMP
708-
select UNINLINE_SPIN_UNLOCK if !QUEUED_SPINLOCKS
709708
---help---
710709
Paravirtualized spinlocks allow a pvops backend to replace the
711710
spinlock implementation with something virtualization-friendly
@@ -718,7 +717,7 @@ config PARAVIRT_SPINLOCKS
718717

719718
config QUEUED_LOCK_STAT
720719
bool "Paravirt queued spinlock statistics"
721-
depends on PARAVIRT_SPINLOCKS && DEBUG_FS && QUEUED_SPINLOCKS
720+
depends on PARAVIRT_SPINLOCKS && DEBUG_FS
722721
---help---
723722
Enable the collection of statistical data on the slowpath
724723
behavior of paravirtualized queued spinlocks and report

‎arch/x86/include/asm/cmpxchg.h‎

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -158,53 +158,9 @@ extern void __add_wrong_size(void)
158158
* value of "*ptr".
159159
*
160160
* xadd() is locked when multiple CPUs are online
161-
* xadd_sync() is always locked
162-
* xadd_local() is never locked
163161
*/
164162
#define __xadd(ptr, inc, lock) __xchg_op((ptr), (inc), xadd, lock)
165163
#define xadd(ptr, inc) __xadd((ptr), (inc), LOCK_PREFIX)
166-
#define xadd_sync(ptr, inc) __xadd((ptr), (inc), "lock; ")
167-
#define xadd_local(ptr, inc) __xadd((ptr), (inc), "")
168-
169-
#define __add(ptr, inc, lock) \
170-
({ \
171-
__typeof__ (*(ptr)) __ret = (inc); \
172-
switch (sizeof(*(ptr))) { \
173-
case __X86_CASE_B: \
174-
asm volatile (lock "addb %b1, %0\n" \
175-
: "+m" (*(ptr)) : "qi" (inc) \
176-
: "memory", "cc"); \
177-
break; \
178-
case __X86_CASE_W: \
179-
asm volatile (lock "addw %w1, %0\n" \
180-
: "+m" (*(ptr)) : "ri" (inc) \
181-
: "memory", "cc"); \
182-
break; \
183-
case __X86_CASE_L: \
184-
asm volatile (lock "addl %1, %0\n" \
185-
: "+m" (*(ptr)) : "ri" (inc) \
186-
: "memory", "cc"); \
187-
break; \
188-
case __X86_CASE_Q: \
189-
asm volatile (lock "addq %1, %0\n" \
190-
: "+m" (*(ptr)) : "ri" (inc) \
191-
: "memory", "cc"); \
192-
break; \
193-
default: \
194-
__add_wrong_size(); \
195-
} \
196-
__ret; \
197-
})
198-
199-
/*
200-
* add_*() adds "inc" to "*ptr"
201-
*
202-
* __add() takes a lock prefix
203-
* add_smp() is locked when multiple CPUs are online
204-
* add_sync() is always locked
205-
*/
206-
#define add_smp(ptr, inc) __add((ptr), (inc), LOCK_PREFIX)
207-
#define add_sync(ptr, inc) __add((ptr), (inc), "lock; ")
208164

209165
#define __cmpxchg_double(pfx, p1, p2, o1, o2, n1, n2) \
210166
({ \

‎arch/x86/include/asm/paravirt.h‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,6 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
661661

662662
#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
663663

664-
#ifdef CONFIG_QUEUED_SPINLOCKS
665-
666664
static __always_inline void pv_queued_spin_lock_slowpath(struct qspinlock *lock,
667665
u32 val)
668666
{
@@ -684,22 +682,6 @@ static __always_inline void pv_kick(int cpu)
684682
PVOP_VCALL1(pv_lock_ops.kick, cpu);
685683
}
686684

687-
#else /* !CONFIG_QUEUED_SPINLOCKS */
688-
689-
static __always_inline void __ticket_lock_spinning(struct arch_spinlock *lock,
690-
__ticket_t ticket)
691-
{
692-
PVOP_VCALLEE2(pv_lock_ops.lock_spinning, lock, ticket);
693-
}
694-
695-
static __always_inline void __ticket_unlock_kick(struct arch_spinlock *lock,
696-
__ticket_t ticket)
697-
{
698-
PVOP_VCALL2(pv_lock_ops.unlock_kick, lock, ticket);
699-
}
700-
701-
#endif /* CONFIG_QUEUED_SPINLOCKS */
702-
703685
#endif /* SMP && PARAVIRT_SPINLOCKS */
704686

705687
#ifdef CONFIG_X86_32

‎arch/x86/include/asm/paravirt_types.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,23 +301,16 @@ struct pv_mmu_ops {
301301
struct arch_spinlock;
302302
#ifdef CONFIG_SMP
303303
#include <asm/spinlock_types.h>
304-
#else
305-
typedef u16 __ticket_t;
306304
#endif
307305

308306
struct qspinlock;
309307

310308
struct pv_lock_ops {
311-
#ifdef CONFIG_QUEUED_SPINLOCKS
312309
void (*queued_spin_lock_slowpath)(struct qspinlock *lock, u32 val);
313310
struct paravirt_callee_save queued_spin_unlock;
314311

315312
void (*wait)(u8 *ptr, u8 val);
316313
void (*kick)(int cpu);
317-
#else /* !CONFIG_QUEUED_SPINLOCKS */
318-
struct paravirt_callee_save lock_spinning;
319-
void (*unlock_kick)(struct arch_spinlock *lock, __ticket_t ticket);
320-
#endif /* !CONFIG_QUEUED_SPINLOCKS */
321314
};
322315

323316
/* This contains all the paravirt structures: we get a convenient

‎arch/x86/include/asm/rwsem.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static inline bool __down_write_trylock(struct rw_semaphore *sem)
154154
: "+m" (sem->count), "=&a" (tmp0), "=&r" (tmp1),
155155
CC_OUT(e) (result)
156156
: "er" (RWSEM_ACTIVE_WRITE_BIAS)
157-
: "memory", "cc");
157+
: "memory");
158158
return result;
159159
}
160160

0 commit comments

Comments
 (0)