BPF List
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Jiri Olsa <olsajiri@gmail.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Yonghong Song <yonghong.song@linux.dev>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Chuyi Zhou <zhouchuyi@bytedance.com>, Tejun Heo <tj@kernel.org>,
	bpf <bpf@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	MPTCP Upstream <mptcp@lists.linux.dev>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH bpf-next] bpf: fix compilation error without CGROUPS
Date: Wed, 1 Nov 2023 09:25:34 +0100	[thread overview]
Message-ID: <9aad3bb9-daca-405a-93c3-dccea3c0a07a@kernel.org> (raw)
In-Reply-To: <ZUH9cveAsjcUgz9e@krava>

Hi Jirka, Alexei,

On 01/11/2023 08:25, Jiri Olsa wrote:
> On Tue, Oct 31, 2023 at 08:54:56PM -0700, Alexei Starovoitov wrote:
>> On Tue, Oct 31, 2023 at 10:05 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>>>
>>> On Tue, Oct 31, 2023 at 04:49:34PM +0100, Matthieu Baerts wrote:
>>>> Our MPTCP CI complained [1] -- and KBuild too -- that it was no longer
>>>> possible to build the kernel without CONFIG_CGROUPS:
>>>>
>>>>   kernel/bpf/task_iter.c: In function 'bpf_iter_css_task_new':
>>>>   kernel/bpf/task_iter.c:919:14: error: 'CSS_TASK_ITER_PROCS' undeclared (first use in this function)
>>>>     919 |         case CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED:
>>>>         |              ^~~~~~~~~~~~~~~~~~~
>>>>   kernel/bpf/task_iter.c:919:14: note: each undeclared identifier is reported only once for each function it appears in
>>>>   kernel/bpf/task_iter.c:919:36: error: 'CSS_TASK_ITER_THREADED' undeclared (first use in this function)
>>>>     919 |         case CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED:
>>>>         |                                    ^~~~~~~~~~~~~~~~~~~~~~
>>>>   kernel/bpf/task_iter.c:927:60: error: invalid application of 'sizeof' to incomplete type 'struct css_task_iter'
>>>>     927 |         kit->css_it = bpf_mem_alloc(&bpf_global_ma, sizeof(struct css_task_iter));
>>>>         |                                                            ^~~~~~
>>>>   kernel/bpf/task_iter.c:930:9: error: implicit declaration of function 'css_task_iter_start'; did you mean 'task_seq_start'? [-Werror=implicit-function-declaration]
>>>>     930 |         css_task_iter_start(css, flags, kit->css_it);
>>>>         |         ^~~~~~~~~~~~~~~~~~~
>>>>         |         task_seq_start
>>>>   kernel/bpf/task_iter.c: In function 'bpf_iter_css_task_next':
>>>>   kernel/bpf/task_iter.c:940:16: error: implicit declaration of function 'css_task_iter_next'; did you mean 'class_dev_iter_next'? [-Werror=implicit-function-declaration]
>>>>     940 |         return css_task_iter_next(kit->css_it);
>>>>         |                ^~~~~~~~~~~~~~~~~~
>>>>         |                class_dev_iter_next
>>>>   kernel/bpf/task_iter.c:940:16: error: returning 'int' from a function with return type 'struct task_struct *' makes pointer from integer without a cast [-Werror=int-conversion]
>>>>     940 |         return css_task_iter_next(kit->css_it);
>>>>         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>   kernel/bpf/task_iter.c: In function 'bpf_iter_css_task_destroy':
>>>>   kernel/bpf/task_iter.c:949:9: error: implicit declaration of function 'css_task_iter_end' [-Werror=implicit-function-declaration]
>>>>     949 |         css_task_iter_end(kit->css_it);
>>>>         |         ^~~~~~~~~~~~~~~~~
>>>>
>>>> This patch simply surrounds with a #ifdef the new code requiring CGroups
>>>> support. It seems enough for the compiler and this is similar to
>>>> bpf_iter_css_{new,next,destroy}() functions where no other #ifdef have
>>>> been added in kernel/bpf/helpers.c and in the selftests.
>>>>
>>>> Fixes: 9c66dc94b62a ("bpf: Introduce css_task open-coded iterator kfuncs")
>>>> Link: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/6665206927
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>> Closes: https://lore.kernel.org/oe-kbuild-all/202310260528.aHWgVFqq-lkp@intel.com/
>>>> Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
>>>
>>> Acked/Tested-by: Jiri Olsa <jolsa@kernel.org>
>>
>> I believe this patch has the same issue as Arnd's patch:
>> https://lore.kernel.org/all/CAADnVQL-zoFPPOVu3nM981gKxRu7Q3G3LTRsKstJEeahpoR1RQ@mail.gmail.com/

@Alexei: Arf, sorry, I didn't find this patch when searching for
"9c66dc94b62a" on lore. I don't know why I didn't search for the commit
title as usual...

>> I'd like to merge the fix asap. Please make it a complete fix.
> 
> ugh, it won't fail the build, it just warns.. I think we should
> fail the build in that case, I'll check

@Jirka: Thank you for checking that! Please tell me if you want me to
send a v2 or if you prefer to do that. I don't mind if you prefer to
send your own patches, as long as there is a fix for that at the end :)

Note that if a warning is emitted for these new bpf_iter_css_task_*()
functions, I guess you will have the same issue with bpf_iter_css_*()
and probably others as mentioned in my commit message.

Cheers,
Matt

  reply	other threads:[~2023-11-01  8:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 15:49 [PATCH bpf-next] bpf: fix compilation error without CGROUPS Matthieu Baerts
2023-10-31 17:05 ` Jiri Olsa
2023-11-01  3:54   ` Alexei Starovoitov
2023-11-01  7:25     ` Jiri Olsa
2023-11-01  8:25       ` Matthieu Baerts [this message]
2023-11-01 12:53         ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9aad3bb9-daca-405a-93c3-dccea3c0a07a@kernel.org \
    --to=matttbe@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=mptcp@lists.linux.dev \
    --cc=olsajiri@gmail.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=zhouchuyi@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox