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
Unified · Split
| @@ -201,7 +201,7 @@ void unregister_step_hook(struct step_hook *hook) · 200 unmodified lines | ||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /* |
| 204 | − * Call registered single step handers | |
| 204 | + * Call registered single step handlers | |
| 205 | 205 | * There is no Syndrome info to check for determining the handler. |
| 206 | 206 | * So we call all the registered handlers, until the right handler is |
| 207 | 207 | * found which returns zero. |
| @@ -271,20 +271,21 @@ static int single_step_handler(unsigned long addr, unsigned int esr, · 63 unmodified lines | ||
| 271 | 271 | * Use reader/writer locks instead of plain spinlock. |
| 272 | 272 | */ |
| 273 | 273 | static LIST_HEAD(break_hook); |
| 274 | −static DEFINE_RWLOCK(break_hook_lock); | |
| 274 | +static DEFINE_SPINLOCK(break_hook_lock); | |
| 275 | 275 | |
| 276 | 276 | void register_break_hook(struct break_hook *hook) |
| 277 | 277 | { |
| 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); | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | void unregister_break_hook(struct break_hook *hook) |
| 284 | 284 | { |
| 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(); | |
| 288 | 289 | } |
| 289 | 290 | |
| 290 | 291 | static int call_break_hook(struct pt_regs *regs, unsigned int esr) |
| @@ -292,11 +293,11 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr) · 1 unmodified line | ||
| 292 | 293 | struct break_hook *hook; |
| 293 | 294 | int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL; |
| 294 | 295 | |
| 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) | |
| 297 | 298 | if ((esr & hook->esr_mask) == hook->esr_val) |
| 298 | 299 | fn = hook->fn; |
| 299 | − read_unlock(&break_hook_lock); | |
| 300 | + rcu_read_unlock(); | |
| 300 | 301 | |
| 301 | 302 | return fn ? fn(regs, esr) : DBG_HOOK_ERROR; |
| 302 | 303 | } |
| @@ -85,7 +85,7 @@ bool aarch64_insn_is_branch_imm(u32 insn) · 84 unmodified lines | ||
| 85 | 85 | aarch64_insn_is_bcond(insn)); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | −static DEFINE_SPINLOCK(patch_lock); | |
| 88 | +static DEFINE_RAW_SPINLOCK(patch_lock); | |
| 89 | 89 | |
| 90 | 90 | static void __kprobes *patch_map(void *addr, int fixmap) |
| 91 | 91 | { |
| @@ -131,13 +131,13 @@ static int __kprobes __aarch64_insn_write(void *addr, u32 insn) · 39 unmodified lines | ||
| 131 | 131 | unsigned long flags = 0; |
| 132 | 132 | int ret; |
| 133 | 133 | |
| 134 | − spin_lock_irqsave(&patch_lock, flags); | |
| 134 | + raw_spin_lock_irqsave(&patch_lock, flags); | |
| 135 | 135 | waddr = patch_map(addr, FIX_TEXT_POKE0); |
| 136 | 136 | |
| 137 | 137 | ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE); |
| 138 | 138 | |
| 139 | 139 | patch_unmap(FIX_TEXT_POKE0); |
| 140 | − spin_unlock_irqrestore(&patch_lock, flags); | |
| 140 | + raw_spin_unlock_irqrestore(&patch_lock, flags); | |
| 141 | 141 | |
| 142 | 142 | return ret; |
| 143 | 143 | } |
| @@ -364,6 +364,8 @@ static void __init relocate_initrd(void) · 363 unmodified lines | ||
| 364 | 364 | to_free = ram_end - orig_start; |
| 365 | 365 | |
| 366 | 366 | size = orig_end - orig_start; |
| 367 | + if (!size) | |
| 368 | + return; | |
| 367 | 369 | |
| 368 | 370 | /* initrd needs to be relocated completely inside linear mapping */ |
| 369 | 371 | new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn), |
| @@ -287,6 +287,7 @@ retry: · 286 unmodified lines | ||
| 287 | 287 | * starvation. |
| 288 | 288 | */ |
| 289 | 289 | mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; |
| 290 | + mm_flags |= FAULT_FLAG_TRIED; | |
| 290 | 291 | goto retry; |
| 291 | 292 | } |
| 292 | 293 | } |