[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240912163539.GE27648@redhat.com>
Date: Thu, 12 Sep 2024 18:35:39 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCHv3 1/7] uprobe: Add support for session consumer
On 09/09, Jiri Olsa wrote:
>
> handle_uretprobe_chain(struct return_instance *ri, struct pt_regs *regs)
> {
> + struct return_consumer *ric = NULL;
> struct uprobe *uprobe = ri->uprobe;
> struct uprobe_consumer *uc;
> - int srcu_idx;
> + int srcu_idx, iter = 0;
>
> srcu_idx = srcu_read_lock(&uprobes_srcu);
> list_for_each_entry_srcu(uc, &uprobe->consumers, cons_node,
> srcu_read_lock_held(&uprobes_srcu)) {
> + /*
> + * If we don't find return consumer, it means uprobe consumer
> + * was added after we hit uprobe and return consumer did not
> + * get registered in which case we call the ret_handler only
> + * if it's not session consumer.
> + */
> + ric = return_consumer_find(ri, &iter, uc->id);
> + if (!ric && uc->session)
> + continue;
> if (uc->ret_handler)
> - uc->ret_handler(uc, ri->func, regs);
> + uc->ret_handler(uc, ri->func, regs, ric ? &ric->cookie : NULL);
So why do we need the new uc->session member and the uc->session above ?
If return_consumer_find() returns NULL, uc->ret_handler(..., NULL) can handle
this case itself?
Oleg.
Powered by blists - more mailing lists