Re: [PATCH v6 06/13] riscv/kprobe: Add code to check if kprobe can be optimized

From: Björn Töpel
Date: Wed Feb 01 2023 - 08:30:50 EST


Chen Guokai <chenguokai17@xxxxxxxxxxxxxxxx> writes:

> From: Liao Chang <liaochang1@xxxxxxxxxx>
>
> For the RVI and RVC hybrid encoding kernel, although AUIPC/JALR just
> occupy 8 bytes space, the patched code is 10 bytes at the worst case
> to ensure no RVI is truncated, so to check if kprobe satisfies the
> requirement of jump optimization, it has to find out an instruction
> window large enough to patch AUIPC/JALR(and padding C.NOP), and ensure
> no instruction nearby jumps into the patching window.
>
> Besides that, this series does not support the simulation of pc-relative
> instruction in optprobe handler yet, so the patching window should not
> includes pc-relative instruction.
>
> Signed-off-by: Liao Chang <liaochang1@xxxxxxxxxx>
> Co-developed-by: Chen Guokai <chenguokai17@xxxxxxxxxxxxxxxx>
> Signed-off-by: Chen Guokai <chenguokai17@xxxxxxxxxxxxxxxx>

Reviewed-by: Björn Töpel <bjorn@xxxxxxxxxx>