Thread (25 messages) 25 messages, 9 authors, 2024-08-17

Re: [PATCHv8 bpf-next 3/9] uprobe: Add uretprobe syscall to speed up return probe

From: Jiri Olsa <hidden>
Date: 2024-06-14 19:27:05
Also in: bpf, linux-man, linux-trace-kernel, lkml, loongarch
Subsystem: performance events subsystem, the rest, uprobes · Maintainers: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds, Masami Hiramatsu, Oleg Nesterov

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:
quoted
Adding uretprobe syscall instead of trap to speed up return probe.
...
quoted
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

thanks,
jirka


---
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;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help