]> git.baikalelectronics.ru Git - kernel.git/commit
RISC-V: Don't check text_mutex during stop_machine
authorConor Dooley <conor.dooley@microchip.com>
Fri, 3 Mar 2023 14:37:55 +0000 (14:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:29 +0000 (08:50 +0100)
commit6ae61f9668e8281b456d71a0301784a3290b9808
tree31c856b9dc94c65915734b6650a0507045fc9dd1
parent1cad10c8d5d2db82e8d496fc3ce1f8349b2bab34
RISC-V: Don't check text_mutex during stop_machine

[ Upstream commit 647cfc7fcd42bcb3cd9337e74bd5a54d9d43ba12 ]

We're currently using stop_machine() to update ftrace & kprobes, which
means that the thread that takes text_mutex during may not be the same
as the thread that eventually patches the code.  This isn't actually a
race because the lock is still held (preventing any other concurrent
accesses) and there is only one thread running during stop_machine(),
but it does trigger a lockdep failure.

This patch just elides the lockdep check during stop_machine.

Fixes: e8503ca4e943 ("riscv/ftrace: Add dynamic function tracer support")
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Reported-by: Changbin Du <changbin.du@gmail.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230303143754.4005217-1-conor.dooley@microchip.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/include/asm/ftrace.h
arch/riscv/include/asm/patch.h
arch/riscv/kernel/ftrace.c
arch/riscv/kernel/patch.c