All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	bpf@vger.kernel.org, loongarch@lists.linux.dev
Subject: Re: [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer
Date: Fri, 21 Jun 2024 15:17:58 +0200	[thread overview]
Message-ID: <ZnV9hvOP5388YJtw@krava> (raw)
In-Reply-To: <20240621120149.GB12521@redhat.com>

On Fri, Jun 21, 2024 at 02:01:50PM +0200, Oleg Nesterov wrote:
> On 06/20, Andrii Nakryiko wrote:
> >
> > On Thu, Jun 20, 2024 at 12:40 PM Oleg Nesterov <oleg@redhat.com> wrote:
> > >
> > > But I can't understand what does it do, it calls emit_break() and
> > > git grep -w emit_break finds nothing.
> > >
> >
> > It's DEF_EMIT_REG0I15_FORMAT(break, break_op) in
> > arch/loongarch/include/asm/inst.h
> >
> > A bunch of macro magic, but in the end it produces some constant
> > value, of course.
> 
> I see, thanks!
> 
> Then perhaps something like below?

lgtm, added loong arch list/folks

for context:
  https://lore.kernel.org/bpf/20240614174822.GA1185149@thelio-3990X/

thanks,
jirka

> 
> Oleg.
> 
> 
> --- x/arch/loongarch/include/asm/uprobes.h
> +++ x/arch/loongarch/include/asm/uprobes.h
> @@ -9,7 +9,7 @@ typedef u32 uprobe_opcode_t;
>  #define MAX_UINSN_BYTES		8
>  #define UPROBE_XOL_SLOT_BYTES	MAX_UINSN_BYTES
>  
> -#define UPROBE_SWBP_INSN	larch_insn_gen_break(BRK_UPROBE_BP)
> +#define UPROBE_SWBP_INSN	(uprobe_opcode_t)(BRK_UPROBE_BP | (break_op << 15))
>  #define UPROBE_SWBP_INSN_SIZE	LOONGARCH_INSN_SIZE
>  
>  #define UPROBE_XOLBP_INSN	larch_insn_gen_break(BRK_UPROBE_XOLBP)
> --- x/arch/loongarch/kernel/uprobes.c
> +++ x/arch/loongarch/kernel/uprobes.c
> @@ -7,6 +7,13 @@
>  
>  #define UPROBE_TRAP_NR	UINT_MAX
>  
> +static __init int __ck_insn(void)
> +{
> +	BUG_ON(UPROBE_SWBP_INSN != larch_insn_gen_break(BRK_UPROBE_BP));
> +	return 0;
> +}
> +late_initcall(__ck_insn);
> +
>  int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
>  			     struct mm_struct *mm, unsigned long addr)
>  {
> 

  reply	other threads:[~2024-06-21 13:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 19:43 [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer Jiri Olsa
2024-06-20 19:00 ` Andrii Nakryiko
2024-06-20 19:38   ` Oleg Nesterov
2024-06-20 21:30     ` Andrii Nakryiko
2024-06-21 12:01       ` Oleg Nesterov
2024-06-21 13:17         ` Jiri Olsa [this message]
2024-06-27 13:44           ` Jiri Olsa
2024-06-27 14:20             ` Masami Hiramatsu
2024-06-27 15:29               ` Oleg Nesterov
2024-06-27 16:02 ` [PATCH] LoongArch: uprobes: make UPROBE_SWBP_INSN/UPROBE_XOLBP_INSN constant Oleg Nesterov
2024-06-27 16:51   ` Andrii Nakryiko
2024-06-27 17:38     ` Oleg Nesterov
2024-06-28  4:30       ` Masami Hiramatsu
2024-06-29 12:48       ` Tiezhu Yang
2024-06-29 13:38         ` Oleg Nesterov
2024-06-29 13:48           ` Huacai Chen
2024-06-29 15:03             ` [PATCH] LoongArch: make the users of larch_insn_gen_break() constant Oleg Nesterov
2024-06-30  1:43               ` Huacai Chen
2024-06-30  6:29                 ` Oleg Nesterov
2024-07-01  6:22               ` Tiezhu Yang
2024-07-01 15:01                 ` Huacai Chen

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=ZnV9hvOP5388YJtw@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=nathan@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.