mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hengqi Chen <chenhengqi@outlook.com>
To: Tiezhu Yang <yangtiezhu@loongson.cn>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 0/4] Add kprobe and kretprobe support for LoongArch
Date: Mon, 12 Dec 2022 16:41:36 +0800	[thread overview]
Message-ID: <SY4P282MB3518614999070D8FD19D14DFC0E29@SY4P282MB3518.AUSP282.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <1670575981-14389-1-git-send-email-yangtiezhu@loongson.cn>

Hi, Tiezhu:

I tested this patchset from BPF side, failed with EINVAL:

    $ cat /sys/kernel/tracing/error_log
    [  262.299093] trace_kprobe: error: Failed to register probe event
      Command: p:kprobes/libbpf_4609_inet_bind_0x0_0 inet_bind+0x0
                                                 ^
--
Hengqi

On 2022/12/9 16:52, Tiezhu Yang wrote:
> v10:
>   -- Remove sign_extend() based on the latest code
>   -- Rename insns_are_not_supported() to insns_not_supported()
>   -- Rename insns_are_not_simulated() to insns_not_simulated()
>   -- Set KPROBE_HIT_SSDONE if cur->post_handler is not NULL
>   -- Enable preemption for KPROBE_REENTER in kprobe_fault_handler()
> 
> v9:
>   -- Rename sign_extended() to sign_extend()
>   -- Modify kprobe_fault_handler() to handle all of kprobe_status
> 
> v8:
>   -- Put "regs->csr_prmd &= ~CSR_PRMD_PIE;" ahead to save one line
>   -- Add code comment of preempt_disable()
>   -- Put kprobe_page_fault() in __do_page_fault()
>   -- Modify the check condition of break insn in kprobe_breakpoint_handler()
> 
> v7:
>   -- Remove stop_machine_cpuslocked() related code
> 
> v6:
>   -- Add a new patch to redefine larch_insn_patch_text() with
>      stop_machine_cpuslocked()
>   -- Modify kprobe_breakpoint_handler() to consider the original
>      insn is break and return the correct value
>   -- Modify do_bp() to refresh bcode when original insn is break
> 
> v5:
>   -- Rebase on the latest code
>   -- Use stop_machine_cpuslocked() to modify insn to avoid CPU race
> 
> v4:
>   -- Remove kprobe_exceptions_notify() in kprobes.c
>   -- Call kprobe_breakpoint_handler() and kprobe_singlestep_handler()
>      in do_bp()
> 
> v3:
>   -- Rebase on the latest code
>   -- Check the alignment of PC in simu_branch() and simu_pc()
>   -- Add ibar in flush_insn_slot()
>   -- Rename kprobe_{pre,post}_handler() to {post_}kprobe_handler
>   -- Add preempt_disable() and preempt_enable_no_resched()
>   -- Remove r0 save/restore and do some minor changes
>      in kprobes_trampoline.S
>   -- Do not enable CONFIG_KPROBES by default
> 
> 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 (4):
>   LoongArch: Simulate branch and PC instructions
>   LoongArch: Add kprobe support
>   LoongArch: Add kretprobe support
>   samples/kprobes: Add LoongArch support
> 
>  arch/loongarch/Kconfig                     |   2 +
>  arch/loongarch/include/asm/inst.h          |  20 ++
>  arch/loongarch/include/asm/kprobes.h       |  59 +++++
>  arch/loongarch/include/asm/ptrace.h        |   1 +
>  arch/loongarch/kernel/Makefile             |   2 +
>  arch/loongarch/kernel/inst.c               | 123 ++++++++++
>  arch/loongarch/kernel/kprobes.c            | 364 +++++++++++++++++++++++++++++
>  arch/loongarch/kernel/kprobes_trampoline.S |  96 ++++++++
>  arch/loongarch/kernel/traps.c              |  13 +-
>  arch/loongarch/mm/fault.c                  |   3 +
>  samples/kprobes/kprobe_example.c           |   8 +
>  11 files changed, 687 insertions(+), 4 deletions(-)
>  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
> 

  parent reply	other threads:[~2022-12-12  8:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09  8:52 Tiezhu Yang
2022-12-09  8:52 ` [PATCH v10 1/4] LoongArch: Simulate branch and PC instructions Tiezhu Yang
2022-12-21  7:42   ` Jinyang He
2022-12-09  8:52 ` [PATCH v10 2/4] LoongArch: Add kprobe support Tiezhu Yang
2022-12-14  7:28   ` Masami Hiramatsu
2022-12-16  9:33     ` Tiezhu Yang
2022-12-17  2:08       ` Huacai Chen
2022-12-09  8:53 ` [PATCH v10 3/4] LoongArch: Add kretprobe support Tiezhu Yang
2022-12-09  8:53 ` [PATCH v10 4/4] samples/kprobes: Add LoongArch support Tiezhu Yang
2022-12-09 10:01 ` [PATCH v10 0/4] Add kprobe and kretprobe support for LoongArch Huacai Chen
2022-12-09 10:34   ` WANG Xuerui
2022-12-10 13:54   ` Jeff Xie
2022-12-13  3:10   ` Masami Hiramatsu
2022-12-17  2:28     ` Huacai Chen
2022-12-12  8:41 ` Hengqi Chen [this message]
2022-12-12  9:35   ` Qing Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SY4P282MB3518614999070D8FD19D14DFC0E29@SY4P282MB3518.AUSP282.PROD.OUTLOOK.COM \
    --to=chenhengqi@outlook.com \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®