mbox series

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

Message ID 20240327160520.791322-1-samuel.holland@sifive.com (mailing list archive)
Headers show
Series riscv: Various text patching improvements | expand

Message

Samuel Holland March 27, 2024, 4:04 p.m. UTC
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@rivosinc.com/

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(-)

Comments

Palmer Dabbelt May 22, 2024, 4:35 p.m. UTC | #1
On Wed, 27 Mar 2024 09:04:39 PDT (-0700), samuel.holland@sifive.com wrote:
> 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@rivosinc.com/
>
> 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(-)

I don't have any issues with this, but given that we've run into some 
possible text patching bug with this ftrace thing I'm just going to hold 
off until 6.11 for these.  Maybe that's a bit too conservative, but with 
the bug only manifesting on HW it might be tough to sort out.
patchwork-bot+linux-riscv@kernel.org June 27, 2024, 5:50 p.m. UTC | #2
Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 27 Mar 2024 09:04:39 -0700 you wrote:
> 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@rivosinc.com/
> 
> [...]

Here is the summary with links:
  - [v2,1/7] riscv: jump_label: Batch icache maintenance
    https://git.kernel.org/riscv/c/652b56b18439
  - [v2,2/7] riscv: jump_label: Simplify assembly syntax
    https://git.kernel.org/riscv/c/2aa30d19cfbb
  - [v2,3/7] riscv: kprobes: Use patch_text_nosync() for insn slots
    https://git.kernel.org/riscv/c/b1756750a397
  - [v2,4/7] riscv: Simplify text patching loops
    https://git.kernel.org/riscv/c/5080ca0fe9b5
  - [v2,5/7] riscv: Pass patch_text() the length in bytes
    https://git.kernel.org/riscv/c/51781ce8f448
  - [v2,6/7] riscv: Use offset_in_page() in text patching functions
    https://git.kernel.org/riscv/c/eaee54875630
  - [v2,7/7] riscv: Remove extra variable in patch_text_nosync()
    https://git.kernel.org/riscv/c/47742484ee16

You are awesome, thank you!