On Thu, 27 Jun 2024 19:38:06 +0200
Oleg Nesterov <o...@redhat.com> wrote:

> On 06/27, Andrii Nakryiko wrote:
> >
> > Acked-by: Andrii Nakryiko <and...@kernel.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) <mhira...@kernel.org>

Reply via email to