Re: [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer

Andrii Nakryiko
2024-06-20T21:30:16Z

On Thu, Jun 20, 2024 at 12:40 PM Oleg Nesterov <oleg@redhat.com> wrote:
>
> On 06/20, Andrii Nakryiko wrote:
> >
> > Can we instead ask loongarch folks to rewrite it to be a constant?
> > Having this as a function call is both an inconvenience and potential
> > performance problem (a minor one, but still). I would imagine it's not
> > hard to hard-code an instruction as a constant here.
>
> I was going to ask the same question when I saw the bug report ;)
> The same for other users of larch_insn_gen_break().
>
> 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.

> Oleg.
>