Re: [PATCH 5/5] bpf: Allow to resolve bpf trampoline in unwind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-01-07 14:05, Jiri Olsa wrote:
On Mon, Jan 06, 2020 at 03:46:40PM -0800, Alexei Starovoitov wrote:
On Sun, Dec 29, 2019 at 03:37:40PM +0100, Jiri Olsa wrote:
When unwinding the stack we need to identify each
address to successfully continue. Adding latch tree
to keep trampolines for quick lookup during the
unwind.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
...
+bool is_bpf_trampoline(void *addr)
+{
+	return latch_tree_find(addr, &tree, &tree_ops) != NULL;
+}
+
  struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
  {
  	struct bpf_trampoline *tr;
@@ -65,6 +98,7 @@ struct bpf_trampoline *bpf_trampoline_lookup(u64 key)
  	for (i = 0; i < BPF_TRAMP_MAX; i++)
  		INIT_HLIST_HEAD(&tr->progs_hlist[i]);
  	tr->image = image;
+	latch_tree_insert(&tr->tnode, &tree, &tree_ops);

Thanks for the fix. I was thinking to apply it, but then realized that bpf
dispatcher logic has the same issue.
Could you generalize the fix for both?
May be bpf_jit_alloc_exec_page() can do latch_tree_insert() ?
and new version of bpf_jit_free_exec() is needed that will do latch_tree_erase().
Wdyt?

I need to check the dispatcher code, but seems ok.. will check


Thanks Jiri! The trampoline and dispatcher share the image allocation, so putting it there would make sense.

It's annoying that the dispatcher doesn't show up correctly in perf, and it's been on my list to fix that. Hopefully you beat me to it! :-D


Björn



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux