[PATCH 00/11] riscv: kprobes: Clean up instruction simulation

Nam Cao posted 11 patches 7 months, 1 week ago
There is a newer version of this series
arch/riscv/include/asm/insn.h            |  9 +++
arch/riscv/kernel/probes/simulate-insn.c | 94 +++++-------------------
2 files changed, 28 insertions(+), 75 deletions(-)
[PATCH 00/11] riscv: kprobes: Clean up instruction simulation
Posted by Nam Cao 7 months, 1 week ago
Hi,

There is some instruction-processing code in kprobes simulate code. These
code should be insn.h. In fact, most of them is duplicating insn.h.

This series remove the duplicated bits and make use of macros already
defined in insn.h. The non-duplicated bits are moved into insn.h.

Nam Cao (11):
  riscv: kprobes: Move branch_rs2_idx to insn.h
  riscv: kprobes: Move branch_funct3 to insn.h
  riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM
  riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG
  riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM
  riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM
  riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG
  riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM
  riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG
  riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM
  riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM

 arch/riscv/include/asm/insn.h            |  9 +++
 arch/riscv/kernel/probes/simulate-insn.c | 94 +++++-------------------
 2 files changed, 28 insertions(+), 75 deletions(-)

-- 
2.39.5
Re: [PATCH 00/11] riscv: kprobes: Clean up instruction simulation
Posted by Alexandre Ghiti 7 months ago
On 11/05/2025 23:17, Nam Cao wrote:
> Hi,
>
> There is some instruction-processing code in kprobes simulate code. These
> code should be insn.h. In fact, most of them is duplicating insn.h.
>
> This series remove the duplicated bits and make use of macros already
> defined in insn.h. The non-duplicated bits are moved into insn.h.
>
> Nam Cao (11):
>    riscv: kprobes: Move branch_rs2_idx to insn.h
>    riscv: kprobes: Move branch_funct3 to insn.h
>    riscv: kprobes: Remove duplication of RV_EXTRACT_JTYPE_IMM
>    riscv: kprobes: Remove duplication of RV_EXTRACT_RS1_REG
>    riscv: kprobes: Remove duplication of RV_EXTRACT_BTYPE_IMM
>    riscv: kproves: Remove duplication of RVC_EXTRACT_JTYPE_IMM
>    riscv: kprobes: Remove duplication of RVC_EXTRACT_C2_RS1_REG
>    riscv: kprobes: Remove duplication of RVC_EXTRACT_BTYPE_IMM
>    riscv: kprobes: Remove duplication of RV_EXTRACT_RD_REG
>    riscv: kprobes: Remove duplication of RV_EXTRACT_UTYPE_IMM
>    riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM
>
>   arch/riscv/include/asm/insn.h            |  9 +++
>   arch/riscv/kernel/probes/simulate-insn.c | 94 +++++-------------------
>   2 files changed, 28 insertions(+), 75 deletions(-)


So for the whole series, you can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks, that's a nice cleanup!

Alex


>