[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240605163624.GG25006@redhat.com>
Date: Wed, 5 Jun 2024 18:36:25 +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
On 06/05, Oleg Nesterov wrote:
>
> On 06/05, Oleg Nesterov wrote:
> >
> > > +/*
> > > + * 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;
> >
> > ?
>
> OK, the changelog says
>
> Which means that there can be only single user of a uprobe (inode +
> offset) when session consumer is registered to it.
>
> so the code is correct. But I still think the comment is misleading.
Cough... perhaps it is correct but I am still confused even we forget about
the comment ;)
OK, uprobe can have a single consumer with ->handler_session != NULL. I guess
this is because return_instance->data is "global".
So uprobe can have multiple handler_session == NULL consumers before
handler_session != NULL, but not after ?
Oleg.
Powered by blists - more mailing lists