[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240628133033.c9f1856455058f9bb97db6a7@kernel.org>
Date: Fri, 28 Jun 2024 13:30:33 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>, Tiezhu Yang
<yangtiezhu@...ngson.cn>, Jiri Olsa <jolsa@...nel.org>, 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, Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui
<kernel@...0n.name>, loongarch@...ts.linux.dev
Subject: Re: [PATCH] LoongArch: uprobes: make
UPROBE_SWBP_INSN/UPROBE_XOLBP_INSN constant
On Thu, 27 Jun 2024 19:38:06 +0200
Oleg Nesterov <oleg@...hat.com> wrote:
> On 06/27, Andrii Nakryiko wrote:
> >
> > Acked-by: Andrii Nakryiko <andrii@...nel.org>
>
> Thanks!
>
> > > --- a/arch/loongarch/kernel/uprobes.c
> > > +++ b/arch/loongarch/kernel/uprobes.c
> > > @@ -7,6 +7,14 @@
> > >
> > > #define UPROBE_TRAP_NR UINT_MAX
> > >
> > > +static __init int check_emit_break(void)
> > > +{
> > > + BUG_ON(UPROBE_SWBP_INSN != larch_insn_gen_break(BRK_UPROBE_BP));
> > > + BUG_ON(UPROBE_XOLBP_INSN != larch_insn_gen_break(BRK_UPROBE_XOLBP));
> > > + return 0;
> > > +}
> > > +arch_initcall(check_emit_break);
> > > +
> >
> > I wouldn't even bother with this, but whatever.
>
> Agreed, this looks a bit ugly. I did this only because I can not test
> this (hopefully trivial) patch and the maintainers didn't reply.
>
> If LoongArch boots at least once with this change, this run-time check
> can be removed.
>
> And just in case... I didn't dare to make a more "generic" change, but
> perhaps KPROBE_BP_INSN and KPROBE_SSTEPBP_INSN should be redefined the
> same way for micro-optimization. In this case __emit_break() should be
> probably moved into arch/loongarch/include/asm/inst.h.
That idea sounds good to me too. If it is good to loongarch maintainers,
(e.g. breakpoint instruction is stable), it is better to define in
asm/insn.h.
Thank you,
>
> Oleg.
>
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists