linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-api@vger.kernel.org, linux-man@vger.kernel.org,
	x86@kernel.org, bpf@vger.kernel.org,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	Ingo Molnar <mingo@redhat.com>, Andy Lutomirski <luto@kernel.org>,
	"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	Deepak Gupta <debug@rivosinc.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	loongarch@lists.linux.dev
Subject: Re: [PATCHv8 bpf-next 3/9] uprobe: Add uretprobe syscall to speed up return probe
Date: Fri, 14 Jun 2024 13:07:29 -0700	[thread overview]
Message-ID: <20240614200729.GA1585004@thelio-3990X> (raw)
In-Reply-To: <ZmyZgzqsowkGyqmH@krava>

On Fri, Jun 14, 2024 at 09:26:59PM +0200, Jiri Olsa wrote:
> On Fri, Jun 14, 2024 at 10:48:22AM -0700, Nathan Chancellor wrote:
> > Hi Jiri,
> > 
> > On Tue, Jun 11, 2024 at 01:21:52PM +0200, Jiri Olsa wrote:
> > > Adding uretprobe syscall instead of trap to speed up return probe.
> > ...
> > > diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> > > index 2c83ba776fc7..2816e65729ac 100644
> > > --- a/kernel/events/uprobes.c
> > > +++ b/kernel/events/uprobes.c
> > > @@ -1474,11 +1474,20 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area)
> > >  	return ret;
> > >  }
> > >  
> > > +void * __weak arch_uprobe_trampoline(unsigned long *psize)
> > > +{
> > > +	static uprobe_opcode_t insn = UPROBE_SWBP_INSN;
> > 
> > This change as commit ff474a78cef5 ("uprobe: Add uretprobe syscall to
> > speed up return probe") in -next causes the following build error for
> > ARCH=loongarch allmodconfig:
> > 
> >   In file included from include/linux/uprobes.h:49,
> >                    from include/linux/mm_types.h:16,
> >                    from include/linux/mmzone.h:22,
> >                    from include/linux/gfp.h:7,
> >                    from include/linux/xarray.h:16,
> >                    from include/linux/list_lru.h:14,
> >                    from include/linux/fs.h:13,
> >                    from include/linux/highmem.h:5,
> >                    from kernel/events/uprobes.c:13:
> >   kernel/events/uprobes.c: In function 'arch_uprobe_trampoline':
> >   arch/loongarch/include/asm/uprobes.h:12:33: error: initializer element is not constant
> >      12 | #define UPROBE_SWBP_INSN        larch_insn_gen_break(BRK_UPROBE_BP)
> >         |                                 ^~~~~~~~~~~~~~~~~~~~
> >   kernel/events/uprobes.c:1479:39: note: in expansion of macro 'UPROBE_SWBP_INSN'
> >    1479 |         static uprobe_opcode_t insn = UPROBE_SWBP_INSN;
> 
> reproduced, could you please try the change below

Yeah, that fixes the issue for me.

Tested-by: Nathan Chancellor <nathan@kernel.org> # build

> ---
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 2816e65729ac..6986bd993702 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1476,8 +1476,9 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area)
>  
>  void * __weak arch_uprobe_trampoline(unsigned long *psize)
>  {
> -	static uprobe_opcode_t insn = UPROBE_SWBP_INSN;
> +	static uprobe_opcode_t insn;
>  
> +	insn = insn ?: UPROBE_SWBP_INSN;
>  	*psize = UPROBE_SWBP_INSN_SIZE;
>  	return &insn;
>  }

  reply	other threads:[~2024-06-14 20:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 11:21 [PATCHv8 bpf-next 0/9] uprobe: uretprobe speed up Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 1/9] x86/shstk: Make return uprobe work with shadow stack Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 2/9] uprobe: Wire up uretprobe system call Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 3/9] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
2024-06-14 17:48   ` Nathan Chancellor
2024-06-14 19:26     ` Jiri Olsa
2024-06-14 20:07       ` Nathan Chancellor [this message]
2024-06-20 18:19   ` Guenter Roeck
2024-06-20 18:52     ` Oleg Nesterov
2024-06-11 11:21 ` [PATCHv8 bpf-next 4/9] selftests/x86: Add return uprobe shadow stack test Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 5/9] selftests/bpf: Add uretprobe syscall test for regs integrity Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 6/9] selftests/bpf: Add uretprobe syscall test for regs changes Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 7/9] selftests/bpf: Add uretprobe syscall call from user space test Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 bpf-next 8/9] selftests/bpf: Add uretprobe shadow stack test Jiri Olsa
2024-06-11 11:21 ` [PATCHv8 9/9] man2: Add uretprobe syscall page Jiri Olsa
2024-06-11 14:30   ` Masami Hiramatsu
2024-06-11 14:49     ` Alejandro Colomar
2024-08-07 20:27       ` Steven Rostedt
2024-08-16 11:42         ` Alejandro Colomar
2024-08-16 17:03           ` Jiri Olsa
2024-08-16 18:55             ` Alejandro Colomar
2024-08-16 21:56               ` Alejandro Colomar
2024-08-17  8:58                 ` Jiri Olsa
2024-06-11 14:52 ` [PATCHv8 bpf-next 0/9] uprobe: uretprobe speed up Masami Hiramatsu
2024-06-12  7:02   ` Andrii Nakryiko

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=20240614200729.GA1585004@thelio-3990X \
    --to=nathan@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=debug@rivosinc.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=luto@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=olsajiri@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yhs@fb.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).