Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm/patch: Fix !MMU compile

Now that patch.o is unconditionally selected for ftrace, it can also
get compiled for !MMU kernels. These (obviously) lack
{set,clear}_fixmap() support.

Also remove the superfluous __acquire/__release nonsense.

Fixes: 42e51f187f86 ("arm/ftrace: Use __patch_text()")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Peter Zijlstra and committed by
Ingo Molnar
7a7a8f54 be993e44

+9 -10
+9 -10
arch/arm/kernel/patch.c
··· 16 16 unsigned int insn; 17 17 }; 18 18 19 + #ifdef CONFIG_MMU 19 20 static DEFINE_RAW_SPINLOCK(patch_lock); 20 21 21 22 static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) 22 - __acquires(&patch_lock) 23 23 { 24 24 unsigned int uintaddr = (uintptr_t) addr; 25 25 bool module = !core_kernel_text(uintaddr); ··· 34 34 35 35 if (flags) 36 36 raw_spin_lock_irqsave(&patch_lock, *flags); 37 - else 38 - __acquire(&patch_lock); 39 37 40 38 set_fixmap(fixmap, page_to_phys(page)); 41 39 ··· 41 43 } 42 44 43 45 static void __kprobes patch_unmap(int fixmap, unsigned long *flags) 44 - __releases(&patch_lock) 45 46 { 46 47 clear_fixmap(fixmap); 47 48 48 49 if (flags) 49 50 raw_spin_unlock_irqrestore(&patch_lock, *flags); 50 - else 51 - __release(&patch_lock); 52 51 } 52 + #else 53 + static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) 54 + { 55 + return addr; 56 + } 57 + static void __kprobes patch_unmap(int fixmap, unsigned long *flags) { } 58 + #endif 53 59 54 60 void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) 55 61 { ··· 66 64 67 65 if (remap) 68 66 waddr = patch_map(addr, FIX_TEXT_POKE0, &flags); 69 - else 70 - __acquire(&patch_lock); 71 67 72 68 if (thumb2 && __opcode_is_thumb16(insn)) { 73 69 *(u16 *)waddr = __opcode_to_mem_thumb16(insn); ··· 102 102 if (waddr != addr) { 103 103 flush_kernel_vmap_range(waddr, twopage ? size / 2 : size); 104 104 patch_unmap(FIX_TEXT_POKE0, &flags); 105 - } else 106 - __release(&patch_lock); 105 + } 107 106 108 107 flush_icache_range((uintptr_t)(addr), 109 108 (uintptr_t)(addr) + size);