[PATCH v2 0/7] riscv: Various text patching improvements

From: Samuel Holland
Date: Wed Mar 27 2024 - 12:45:18 EST


Here are a few changes to minimize calls to stop_machine() and
flush_icache_*() in the various text patching functions, as well as
to simplify the code.

This series is based on "[PATCH v3 0/2] riscv: fix patching with IPI"[1].

[1]: https://lore.kernel.org/linux-riscv/20240229121056.203419-1-alexghiti@xxxxxxxxxxxx/

Changes in v2:
- Remove unnecessary line wrapping
- Further simplify patch_insn_set()/patch_insn_write() loop conditions
- Use min() instead of min_t() since both sides are unsigned long

Samuel Holland (7):
riscv: jump_label: Batch icache maintenance
riscv: jump_label: Simplify assembly syntax
riscv: kprobes: Use patch_text_nosync() for insn slots
riscv: Simplify text patching loops
riscv: Pass patch_text() the length in bytes
riscv: Use offset_in_page() in text patching functions
riscv: Remove extra variable in patch_text_nosync()

arch/riscv/include/asm/jump_label.h | 4 +-
arch/riscv/include/asm/patch.h | 2 +-
arch/riscv/kernel/jump_label.c | 16 +++++--
arch/riscv/kernel/patch.c | 69 ++++++++++++++---------------
arch/riscv/kernel/probes/kprobes.c | 19 ++++----
arch/riscv/net/bpf_jit_comp64.c | 7 +--
6 files changed, 63 insertions(+), 54 deletions(-)

--
2.43.1