Skip to content

Commit c6fa8e6

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "This addresses a couple of issues found with RT, a broken initrd message in the console log and a simple performance fix for some MMC workloads. Summary: - A couple of locking fixes for RT kernels - Avoid printing bogus initrd warnings when initrd isn't present - Performance fix for random mmap file readahead - Typo fix" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: replace read_lock to rcu lock in call_break_hook arm64: Don't relocate non-existent initrd arm64: convert patch_lock to raw lock arm64: readahead: fault retry breaks mmap file read random detection arm64: debug: Fix typo in debug-monitors.c
2 parents e82fa92 + 62c6c61 commit c6fa8e6

4 files changed

Lines changed: 18 additions & 14 deletions

File tree

‎arch/arm64/kernel/debug-monitors.c‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void unregister_step_hook(struct step_hook *hook)
201201
}
202202

203203
/*
204-
* Call registered single step handers
204+
* Call registered single step handlers
205205
* There is no Syndrome info to check for determining the handler.
206206
* So we call all the registered handlers, until the right handler is
207207
* found which returns zero.
@@ -271,32 +271,33 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
271271
* Use reader/writer locks instead of plain spinlock.
272272
*/
273273
static LIST_HEAD(break_hook);
274-
static DEFINE_RWLOCK(break_hook_lock);
274+
static DEFINE_SPINLOCK(break_hook_lock);
275275

276276
void register_break_hook(struct break_hook *hook)
277277
{
278-
write_lock(&break_hook_lock);
279-
list_add(&hook->node, &break_hook);
280-
write_unlock(&break_hook_lock);
278+
spin_lock(&break_hook_lock);
279+
list_add_rcu(&hook->node, &break_hook);
280+
spin_unlock(&break_hook_lock);
281281
}
282282

283283
void unregister_break_hook(struct break_hook *hook)
284284
{
285-
write_lock(&break_hook_lock);
286-
list_del(&hook->node);
287-
write_unlock(&break_hook_lock);
285+
spin_lock(&break_hook_lock);
286+
list_del_rcu(&hook->node);
287+
spin_unlock(&break_hook_lock);
288+
synchronize_rcu();
288289
}
289290

290291
static int call_break_hook(struct pt_regs *regs, unsigned int esr)
291292
{
292293
struct break_hook *hook;
293294
int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL;
294295

295-
read_lock(&break_hook_lock);
296-
list_for_each_entry(hook, &break_hook, node)
296+
rcu_read_lock();
297+
list_for_each_entry_rcu(hook, &break_hook, node)
297298
if ((esr & hook->esr_mask) == hook->esr_val)
298299
fn = hook->fn;
299-
read_unlock(&break_hook_lock);
300+
rcu_read_unlock();
300301

301302
return fn ? fn(regs, esr) : DBG_HOOK_ERROR;
302303
}

‎arch/arm64/kernel/insn.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool aarch64_insn_is_branch_imm(u32 insn)
8585
aarch64_insn_is_bcond(insn));
8686
}
8787

88-
static DEFINE_SPINLOCK(patch_lock);
88+
static DEFINE_RAW_SPINLOCK(patch_lock);
8989

9090
static void __kprobes *patch_map(void *addr, int fixmap)
9191
{
@@ -131,13 +131,13 @@ static int __kprobes __aarch64_insn_write(void *addr, u32 insn)
131131
unsigned long flags = 0;
132132
int ret;
133133

134-
spin_lock_irqsave(&patch_lock, flags);
134+
raw_spin_lock_irqsave(&patch_lock, flags);
135135
waddr = patch_map(addr, FIX_TEXT_POKE0);
136136

137137
ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE);
138138

139139
patch_unmap(FIX_TEXT_POKE0);
140-
spin_unlock_irqrestore(&patch_lock, flags);
140+
raw_spin_unlock_irqrestore(&patch_lock, flags);
141141

142142
return ret;
143143
}

‎arch/arm64/kernel/setup.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ static void __init relocate_initrd(void)
364364
to_free = ram_end - orig_start;
365365

366366
size = orig_end - orig_start;
367+
if (!size)
368+
return;
367369

368370
/* initrd needs to be relocated completely inside linear mapping */
369371
new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn),

‎arch/arm64/mm/fault.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
287287
* starvation.
288288
*/
289289
mm_flags &= ~FAULT_FLAG_ALLOW_RETRY;
290+
mm_flags |= FAULT_FLAG_TRIED;
290291
goto retry;
291292
}
292293
}

0 commit comments

Comments
 (0)