Re: [PATCH v2 0/5] Add kprobe and kretprobe support for LoongArch

From: Huacai Chen
Date: Sun Nov 13 2022 - 23:32:16 EST


Hi, Tiezhu,

Thanks for your patches, however,
1, You should rebase your code, since some functions such as
is_pc_insn is provided in the github's loongarch-next branch;
2, Your code may have some problems about preemption, you can do
something like this commit [1];
3, I don't think Kprobe should be enabled by default, distribution
configs can enable it if needed.

[1] https://github.com/loongson/linux/commit/023d5412ab5c154b87d57d70d465a4243df53717

Huacai

On Wed, Sep 28, 2022 at 8:50 AM Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:
>
> v2:
> -- Split simu_branch() and simu_pc() into a single patch
> -- Call kprobe_page_fault() in do_page_fault()
> -- Add kprobes_trampoline.S for kretprobe
>
> Tiezhu Yang (5):
> LoongArch: Simulate branch and PC instructions
> LoongArch: Add kprobe support
> LoongArch: Add kretprobe support
> samples/kprobes: Add LoongArch support
> LoongArch: Enable KPROBES in default config
>
> arch/loongarch/Kconfig | 2 +
> arch/loongarch/configs/loongson3_defconfig | 1 +
> arch/loongarch/include/asm/inst.h | 31 +++
> arch/loongarch/include/asm/kprobes.h | 44 ++++
> arch/loongarch/include/asm/ptrace.h | 1 +
> arch/loongarch/kernel/Makefile | 2 +
> arch/loongarch/kernel/inst.c | 113 ++++++++++
> arch/loongarch/kernel/kprobes.c | 336 +++++++++++++++++++++++++++++
> arch/loongarch/kernel/kprobes_trampoline.S | 97 +++++++++
> arch/loongarch/mm/fault.c | 3 +
> samples/kprobes/kprobe_example.c | 8 +
> 11 files changed, 638 insertions(+)
> create mode 100644 arch/loongarch/include/asm/kprobes.h
> create mode 100644 arch/loongarch/kernel/kprobes.c
> create mode 100644 arch/loongarch/kernel/kprobes_trampoline.S
>
> --
> 2.1.0
>