Re: [RESEND PATCH bpf-next v6 2/8] bpf: Introduce css_task open-coded iterator kfuncs

From: Chuyi Zhou
Date: Sun Oct 29 2023 - 22:34:47 EST


Hello,

在 2023/10/30 01:09, Guenter Roeck 写道:
On Wed, Oct 18, 2023 at 02:17:40PM +0800, Chuyi Zhou wrote:
This patch adds kfuncs bpf_iter_css_task_{new,next,destroy} which allow
creation and manipulation of struct bpf_iter_css_task in open-coded
iterator style. These kfuncs actually wrapps css_task_iter_{start,next,
end}. BPF programs can use these kfuncs through bpf_for_each macro for
iteration of all tasks under a css.

css_task_iter_*() would try to get the global spin-lock *css_set_lock*, so
the bpf side has to be careful in where it allows to use this iter.
Currently we only allow it in bpf_lsm and bpf iter-s.

Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
Acked-by: Tejun Heo <tj@xxxxxxxxxx>

With this patch in linux-next:

Building m68k:defconfig ... failed
--------------
Error log:
kernel/bpf/task_iter.c: In function 'bpf_iter_css_task_new':
kernel/bpf/task_iter.c:917:14: error: 'CSS_TASK_ITER_PROCS' undeclared (first use in this function)
917 | case CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED:
| ^~~~~~~~~~~~~~~~~~~
kernel/bpf/task_iter.c:917:14: note: each undeclared identifier is reported only once for each function it appears in
kernel/bpf/task_iter.c:917:36: error: 'CSS_TASK_ITER_THREADED' undeclared (first use in this function)
917 | case CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED:

My apologies for the noise if this has already been reported and/or fixed.

Guenter

Here is the previous discussion link:
https://lore.kernel.org/lkml/20231020132749.1398012-1-arnd@xxxxxxxxxx/

We can talk this issue on that maillist.

thanks.