[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240605152457.GD25006@redhat.com>
Date: Wed, 5 Jun 2024 17:24:57 +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: [RFC bpf-next 01/10] uprobe: Add session callbacks to
uprobe_consumer
I'll try to read this code tomorrow, right now I don't really understand
what does it do and why.
However,
On 06/04, Jiri Olsa wrote:
>
> struct uprobe_consumer {
> + /*
> + * The handler callback return value controls removal of the uprobe.
> + * 0 on success, uprobe stays
> + * 1 on failure, remove the uprobe
> + * console warning for anything else
> + */
> int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
This is misleading. It is not about success/failure, it is about filtering.
consumer->handler() returns UPROBE_HANDLER_REMOVE if this consumer is not
interested in this task, so this uprobe can be removed (unless another
consumer returns 0).
> +/*
> + * Make sure all the uprobe consumers have only one type of entry
> + * callback registered (either handler or handler_session) due to
> + * different return value actions.
> + */
> +static int consumer_check(struct uprobe_consumer *curr, struct uprobe_consumer *uc)
> +{
> + if (!curr)
> + return 0;
> + if (curr->handler_session || uc->handler_session)
> + return -EBUSY;
> + return 0;
> +}
Hmm, I don't understand this code, it doesn't match the comment...
The comment says "all the uprobe consumers have only one type" but
consumer_check() will always fail if the the 1st or 2nd consumer has
->handler_session != NULL ?
Perhaps you meant
if (!!curr->handler != !!uc->handler)
return -EBUSY;
?
Oleg.
Powered by blists - more mailing lists