Skip to content

Commit 656e7c0

Browse files
committed
Merge branches 'doc.2017.08.17a', 'fixes.2017.08.17a', 'hotplug.2017.07.25b', 'misc.2017.08.17a', 'spin_unlock_wait_no.2017.08.17a', 'srcu.2017.07.27c' and 'torture.2017.07.24c' into HEAD
doc.2017.08.17a: Documentation updates. fixes.2017.08.17a: RCU fixes. hotplug.2017.07.25b: CPU-hotplug updates. misc.2017.08.17a: Miscellaneous fixes outside of RCU (give or take conflicts). spin_unlock_wait_no.2017.08.17a: Remove spin_unlock_wait(). srcu.2017.07.27c: SRCU updates. torture.2017.07.24c: Torture-test updates.
7 parents 850bf6d + 16c0b10 + 09efeee + 22e4ebb + 952111d + 35732cf + f34c858 commit 656e7c0

75 files changed

Lines changed: 898 additions & 1214 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎MAINTAINERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8621,7 +8621,7 @@ M: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
86218621
M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
86228622
L: linux-kernel@vger.kernel.org
86238623
S: Supported
8624-
F: kernel/membarrier.c
8624+
F: kernel/sched/membarrier.c
86258625
F: include/uapi/linux/membarrier.h
86268626

86278627
MEMORY MANAGEMENT

‎arch/alpha/include/asm/spinlock.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
1717
#define arch_spin_is_locked(x) ((x)->lock != 0)
1818

19-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
20-
{
21-
smp_cond_load_acquire(&lock->lock, !VAL);
22-
}
23-
2419
static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
2520
{
2621
return lock.lock == 0;

‎arch/arc/include/asm/spinlock.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
#define arch_spin_is_locked(x) ((x)->slock != __ARCH_SPIN_LOCK_UNLOCKED__)
1717
#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
1818

19-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
20-
{
21-
smp_cond_load_acquire(&lock->slock, !VAL);
22-
}
23-
2419
#ifdef CONFIG_ARC_HAS_LLSC
2520

2621
static inline void arch_spin_lock(arch_spinlock_t *lock)

‎arch/arm/include/asm/spinlock.h‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ static inline void dsb_sev(void)
5252
* memory.
5353
*/
5454

55-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
56-
{
57-
u16 owner = READ_ONCE(lock->tickets.owner);
58-
59-
for (;;) {
60-
arch_spinlock_t tmp = READ_ONCE(*lock);
61-
62-
if (tmp.tickets.owner == tmp.tickets.next ||
63-
tmp.tickets.owner != owner)
64-
break;
65-
66-
wfe();
67-
}
68-
smp_acquire__after_ctrl_dep();
69-
}
70-
7155
#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
7256

7357
static inline void arch_spin_lock(arch_spinlock_t *lock)

‎arch/arm64/include/asm/spinlock.h‎

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,58 +26,6 @@
2626
* The memory barriers are implicit with the load-acquire and store-release
2727
* instructions.
2828
*/
29-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
30-
{
31-
unsigned int tmp;
32-
arch_spinlock_t lockval;
33-
u32 owner;
34-
35-
/*
36-
* Ensure prior spin_lock operations to other locks have completed
37-
* on this CPU before we test whether "lock" is locked.
38-
*/
39-
smp_mb();
40-
owner = READ_ONCE(lock->owner) << 16;
41-
42-
asm volatile(
43-
" sevl\n"
44-
"1: wfe\n"
45-
"2: ldaxr %w0, %2\n"
46-
/* Is the lock free? */
47-
" eor %w1, %w0, %w0, ror #16\n"
48-
" cbz %w1, 3f\n"
49-
/* Lock taken -- has there been a subsequent unlock->lock transition? */
50-
" eor %w1, %w3, %w0, lsl #16\n"
51-
" cbz %w1, 1b\n"
52-
/*
53-
* The owner has been updated, so there was an unlock->lock
54-
* transition that we missed. That means we can rely on the
55-
* store-release of the unlock operation paired with the
56-
* load-acquire of the lock operation to publish any of our
57-
* previous stores to the new lock owner and therefore don't
58-
* need to bother with the writeback below.
59-
*/
60-
" b 4f\n"
61-
"3:\n"
62-
/*
63-
* Serialise against any concurrent lockers by writing back the
64-
* unlocked lock value
65-
*/
66-
ARM64_LSE_ATOMIC_INSN(
67-
/* LL/SC */
68-
" stxr %w1, %w0, %2\n"
69-
__nops(2),
70-
/* LSE atomics */
71-
" mov %w1, %w0\n"
72-
" cas %w0, %w0, %2\n"
73-
" eor %w1, %w1, %w0\n")
74-
/* Somebody else wrote to the lock, GOTO 10 and reload the value */
75-
" cbnz %w1, 2b\n"
76-
"4:"
77-
: "=&r" (lockval), "=&r" (tmp), "+Q" (*lock)
78-
: "r" (owner)
79-
: "memory");
80-
}
8129

8230
#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
8331

@@ -176,7 +124,11 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
176124

177125
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
178126
{
179-
smp_mb(); /* See arch_spin_unlock_wait */
127+
/*
128+
* Ensure prior spin_lock operations to other locks have completed
129+
* on this CPU before we test whether "lock" is locked.
130+
*/
131+
smp_mb(); /* ^^^ */
180132
return !arch_spin_value_unlocked(READ_ONCE(*lock));
181133
}
182134

‎arch/arm64/kernel/process.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
360360
/*
361361
* Complete any pending TLB or cache maintenance on this CPU in case
362362
* the thread migrates to a different CPU.
363+
* This full barrier is also required by the membarrier system
364+
* call.
363365
*/
364366
dsb(ish);
365367

‎arch/blackfin/include/asm/spinlock.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
4848
__raw_spin_unlock_asm(&lock->lock);
4949
}
5050

51-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
52-
{
53-
smp_cond_load_acquire(&lock->lock, !VAL);
54-
}
55-
5651
static inline int arch_read_can_lock(arch_rwlock_t *rw)
5752
{
5853
return __raw_uncached_fetch_asm(&rw->lock) > 0;

‎arch/blackfin/kernel/module.c‎

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* Licensed under the GPL-2 or later
55
*/
66

7-
#define pr_fmt(fmt) "module %s: " fmt, mod->name
8-
97
#include <linux/moduleloader.h>
108
#include <linux/elf.h>
119
#include <linux/vmalloc.h>
@@ -16,6 +14,11 @@
1614
#include <asm/cacheflush.h>
1715
#include <linux/uaccess.h>
1816

17+
#define mod_err(mod, fmt, ...) \
18+
pr_err("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
19+
#define mod_debug(mod, fmt, ...) \
20+
pr_debug("module %s: " fmt, (mod)->name, ##__VA_ARGS__)
21+
1922
/* Transfer the section to the L1 memory */
2023
int
2124
module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
@@ -44,7 +47,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
4447
dest = l1_inst_sram_alloc(s->sh_size);
4548
mod->arch.text_l1 = dest;
4649
if (dest == NULL) {
47-
pr_err("L1 inst memory allocation failed\n");
50+
mod_err(mod, "L1 inst memory allocation failed\n");
4851
return -1;
4952
}
5053
dma_memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -56,7 +59,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
5659
dest = l1_data_sram_alloc(s->sh_size);
5760
mod->arch.data_a_l1 = dest;
5861
if (dest == NULL) {
59-
pr_err("L1 data memory allocation failed\n");
62+
mod_err(mod, "L1 data memory allocation failed\n");
6063
return -1;
6164
}
6265
memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -68,7 +71,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
6871
dest = l1_data_sram_zalloc(s->sh_size);
6972
mod->arch.bss_a_l1 = dest;
7073
if (dest == NULL) {
71-
pr_err("L1 data memory allocation failed\n");
74+
mod_err(mod, "L1 data memory allocation failed\n");
7275
return -1;
7376
}
7477

@@ -77,7 +80,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
7780
dest = l1_data_B_sram_alloc(s->sh_size);
7881
mod->arch.data_b_l1 = dest;
7982
if (dest == NULL) {
80-
pr_err("L1 data memory allocation failed\n");
83+
mod_err(mod, "L1 data memory allocation failed\n");
8184
return -1;
8285
}
8386
memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -87,7 +90,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
8790
dest = l1_data_B_sram_alloc(s->sh_size);
8891
mod->arch.bss_b_l1 = dest;
8992
if (dest == NULL) {
90-
pr_err("L1 data memory allocation failed\n");
93+
mod_err(mod, "L1 data memory allocation failed\n");
9194
return -1;
9295
}
9396
memset(dest, 0, s->sh_size);
@@ -99,7 +102,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
99102
dest = l2_sram_alloc(s->sh_size);
100103
mod->arch.text_l2 = dest;
101104
if (dest == NULL) {
102-
pr_err("L2 SRAM allocation failed\n");
105+
mod_err(mod, "L2 SRAM allocation failed\n");
103106
return -1;
104107
}
105108
memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -111,7 +114,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
111114
dest = l2_sram_alloc(s->sh_size);
112115
mod->arch.data_l2 = dest;
113116
if (dest == NULL) {
114-
pr_err("L2 SRAM allocation failed\n");
117+
mod_err(mod, "L2 SRAM allocation failed\n");
115118
return -1;
116119
}
117120
memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -123,7 +126,7 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
123126
dest = l2_sram_zalloc(s->sh_size);
124127
mod->arch.bss_l2 = dest;
125128
if (dest == NULL) {
126-
pr_err("L2 SRAM allocation failed\n");
129+
mod_err(mod, "L2 SRAM allocation failed\n");
127130
return -1;
128131
}
129132

@@ -157,8 +160,8 @@ apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
157160
Elf32_Sym *sym;
158161
unsigned long location, value, size;
159162

160-
pr_debug("applying relocate section %u to %u\n",
161-
relsec, sechdrs[relsec].sh_info);
163+
mod_debug(mod, "applying relocate section %u to %u\n",
164+
relsec, sechdrs[relsec].sh_info);
162165

163166
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
164167
/* This is where to make the change */
@@ -174,14 +177,14 @@ apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
174177

175178
#ifdef CONFIG_SMP
176179
if (location >= COREB_L1_DATA_A_START) {
177-
pr_err("cannot relocate in L1: %u (SMP kernel)\n",
180+
mod_err(mod, "cannot relocate in L1: %u (SMP kernel)\n",
178181
ELF32_R_TYPE(rel[i].r_info));
179182
return -ENOEXEC;
180183
}
181184
#endif
182185

183-
pr_debug("location is %lx, value is %lx type is %d\n",
184-
location, value, ELF32_R_TYPE(rel[i].r_info));
186+
mod_debug(mod, "location is %lx, value is %lx type is %d\n",
187+
location, value, ELF32_R_TYPE(rel[i].r_info));
185188

186189
switch (ELF32_R_TYPE(rel[i].r_info)) {
187190

@@ -200,12 +203,12 @@ apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
200203
case R_BFIN_PCREL12_JUMP:
201204
case R_BFIN_PCREL12_JUMP_S:
202205
case R_BFIN_PCREL10:
203-
pr_err("unsupported relocation: %u (no -mlong-calls?)\n",
206+
mod_err(mod, "unsupported relocation: %u (no -mlong-calls?)\n",
204207
ELF32_R_TYPE(rel[i].r_info));
205208
return -ENOEXEC;
206209

207210
default:
208-
pr_err("unknown relocation: %u\n",
211+
mod_err(mod, "unknown relocation: %u\n",
209212
ELF32_R_TYPE(rel[i].r_info));
210213
return -ENOEXEC;
211214
}
@@ -222,7 +225,7 @@ apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
222225
isram_memcpy((void *)location, &value, size);
223226
break;
224227
default:
225-
pr_err("invalid relocation for %#lx\n", location);
228+
mod_err(mod, "invalid relocation for %#lx\n", location);
226229
return -ENOEXEC;
227230
}
228231
}

‎arch/hexagon/include/asm/spinlock.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)
179179
*/
180180
#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
181181

182-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
183-
{
184-
smp_cond_load_acquire(&lock->lock, !VAL);
185-
}
186-
187182
#define arch_spin_is_locked(x) ((x)->lock != 0)
188183

189184
#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)

‎arch/ia64/include/asm/spinlock.h‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,6 @@ static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
7676
ACCESS_ONCE(*p) = (tmp + 2) & ~1;
7777
}
7878

79-
static __always_inline void __ticket_spin_unlock_wait(arch_spinlock_t *lock)
80-
{
81-
int *p = (int *)&lock->lock, ticket;
82-
83-
ia64_invala();
84-
85-
for (;;) {
86-
asm volatile ("ld4.c.nc %0=[%1]" : "=r"(ticket) : "r"(p) : "memory");
87-
if (!(((ticket >> TICKET_SHIFT) ^ ticket) & TICKET_MASK))
88-
return;
89-
cpu_relax();
90-
}
91-
92-
smp_acquire__after_ctrl_dep();
93-
}
94-
9579
static inline int __ticket_spin_is_locked(arch_spinlock_t *lock)
9680
{
9781
long tmp = ACCESS_ONCE(lock->lock);
@@ -143,11 +127,6 @@ static __always_inline void arch_spin_lock_flags(arch_spinlock_t *lock,
143127
arch_spin_lock(lock);
144128
}
145129

146-
static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
147-
{
148-
__ticket_spin_unlock_wait(lock);
149-
}
150-
151130
#define arch_read_can_lock(rw) (*(volatile int *)(rw) >= 0)
152131
#define arch_write_can_lock(rw) (*(volatile int *)(rw) == 0)
153132

0 commit comments

Comments
 (0)