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

Björn Töpel bjorn at kernel.org
Wed Feb 1 05:30:01 PST 2023


Chen Guokai <chenguokai17 at mails.ucas.ac.cn> writes:

> From: Liao Chang <liaochang1 at huawei.com>
>
> 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 at huawei.com>
> Co-developed-by: Chen Guokai <chenguokai17 at mails.ucas.ac.cn>
> Signed-off-by: Chen Guokai <chenguokai17 at mails.ucas.ac.cn>

Reviewed-by: Björn Töpel <bjorn at kernel.org>



More information about the linux-riscv mailing list