[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89fbc745-c290-c82c-a837-8998cf2988e7@fb.com>
Date: Mon, 26 Mar 2018 09:25:07 -0700
From: Alexei Starovoitov <ast@...com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
CC: rostedt <rostedt@...dmis.org>,
"David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
netdev <netdev@...r.kernel.org>,
kernel-team <kernel-team@...com>,
linux-api <linux-api@...r.kernel.org>,
"Frank Ch. Eigler" <fche@...hat.com>
Subject: Re: [PATCH v5 bpf-next 06/10] tracepoint: compute num_args at build
time
On 3/26/18 9:17 AM, Mathieu Desnoyers wrote:
>>
>> re: 'added complexity'...
>> - for (iter = begin; iter < end; iter++)
>> - fct(*iter, priv);
>> + return NULL;
>> + for (iter = begin; iter < end; iter++) {
>> + ret = fct(*iter, priv);
>> + if (ret)
>> + return ret;
>> + }
>> + return NULL;
>>
>> where do you see 'added complexity' ?
>> Isn't the above diff self-explanatory that for_each_tracepoint_range()
>> can be used not only to iterate over all tracepoints
>> (just do 'return NULL') from callback _and_ to find one particular
>> tracepoint as patch 7 does ?
>
> I am not arguing about your proposed implementation. I am arguing about
> the lack of justification behind this change. Why is this change needed ?
> What is it allowing you to do that cannot be done using the private data
> pointer ?
commit log of patch 6 states:
"for_each_tracepoint_range() api has no users inside the kernel.
Make it more useful with ability to stop for_each() loop depending
via callback return value.
In such form it's used in subsequent patch."
and in patch 7:
+static void *__find_tp(struct tracepoint *tp, void *priv)
+{
+ char *name = priv;
+
+ if (!strcmp(tp->name, name))
+ return tp;
+ return NULL;
+}
...
+ struct tracepoint *tp;
...
+ tp = for_each_kernel_tracepoint(__find_tp, tp_name);
+ if (!tp)
+ return -ENOENT;
still not obvious?
Powered by blists - more mailing lists