[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240627232032.a202e546f59a0290c615510f@kernel.org>
Date: Thu, 27 Jun 2024 23:20:32 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Jiri Olsa <olsajiri@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>, Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>, Andrii Nakryiko
<andrii.nakryiko@...il.com>, Steven Rostedt <rostedt@...dmis.org>, Masami
Hiramatsu <mhiramat@...nel.org>, Andrii Nakryiko <andrii@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org,
loongarch@...ts.linux.dev
Subject: Re: [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static
initializer
On Thu, 27 Jun 2024 15:44:16 +0200
Jiri Olsa <olsajiri@...il.com> wrote:
> On Fri, Jun 21, 2024 at 03:17:58PM +0200, Jiri Olsa wrote:
> > 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@...hat.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
>
> ping
>
> Oleg, do you want to send formal patch?
>
> thanks,
> jirka
Yes, can you send v2 patch?
Thank you,
>
> >
> > 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)
> > > {
> > >
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists