From: Matthieu Baerts <matttbe@kernel.org>
To: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
Geliang Tang <tanggeliang@kylinos.cn>,
mptcp@lists.linux.dev, Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH bpf-next v3 2/3] selftests/bpf: Add mptcp pm_nl_ctl link
Date: Sat, 6 Jul 2024 02:25:07 +0200 [thread overview]
Message-ID: <ab8112e6-ea7b-4b36-b395-049214e1608d@kernel.org> (raw)
In-Reply-To: <90e916e8-ec4e-447b-8ee6-eb247f3a72ad@linux.dev>
Hi Martin,
Thank you for your reply!
On 06/07/2024 01:10, Martin KaFai Lau wrote:
> On 7/4/24 3:48 AM, Matthieu Baerts wrote:
>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/
>>> selftests/bpf/Makefile
>>> index e0b3887b3d2d..204269d0b5b8 100644
>>> --- a/tools/testing/selftests/bpf/Makefile
>>> +++ b/tools/testing/selftests/bpf/Makefile
>>> @@ -144,7 +144,7 @@ TEST_GEN_PROGS_EXTENDED = test_skb_cgroup_id_user \
>>> flow_dissector_load test_flow_dissector
>>> test_tcp_check_syncookie_user \
>>> test_lirc_mode2_user xdping test_cpp runqslower bench
>>> bpf_testmod.ko \
>>> xskxceiver xdp_redirect_multi xdp_synproxy veristat
>>> xdp_hw_metadata \
>>> - xdp_features bpf_test_no_cfi.ko
>>> + xdp_features bpf_test_no_cfi.ko mptcp_pm_nl_ctl
>> On the BPF CI, we have such errors:
>>
>> mptcp_pm_nl_ctl.c:20:10: fatal error: 'linux/mptcp.h' file not found
>> 20 | #include "linux/mptcp.h"
>> | ^~~~~~~~~~~~~~~
>>
>> On my side, I don't have any issue, because the compiler uses the
>> mptcp.h file from the system: /usr/include/linux/mptcp.h
>>
>> I suppose that's not OK on the BPF CI, as it looks like it doesn't have
>> this file there, probably because it still uses Ubuntu 20.04 as base,
>> which doesn't include this file in the linux-libc-dev package.
>>
>> When I look at how this 'mptcp_pm_nl_ctl' tool -- and all the other
>> programs from that list -- is compiled (V=1), I see that the following
>> "-I" options are given:
>>
>> -I${PWD}/tools/testing/selftests/bpf
>> -I${BUILD}//tools/include
>> -I${BUILD}/include/generated
>> -I${PWD}/tools/lib
>> -I${PWD}/tools/include
>> -I${PWD}/tools/include/uapi
>> -I${BUILD}/
>>
>> It will then not look at -I${PWD}/usr/include or the directory generated
>> with:
>>
>> make headers_install INSTALL_HDR_PATH=(...)
>
> It sounds like the tools/testing/selftests/net/mptcp/Makefile is looking
> at this include path, so it works?
Yes it does work.
> iiu the bpf/Makefile correctly, it has the bpftool "make" compiled and
> installed at tools/testing/selftests/bpf/tools/sbin/. May be directly
> compile the pm_nl_ctl by "make tools/testing/selftests/net/mptcp/"?
That could be an alternative, I didn't know it would be OK to add such
dependence, good idea.
>> I guess that's why people have duplicated files in 'tools/include/uapi',
>> but I also understood from Jakub that it is not a good idea to continue
>> to do so.
>>
>> What would be the best solution to avoid a copy? A symlink still looks
>> like a workaround.
>>
>> In the other selftests, KHDR_INCLUDES is used to be able to include the
>> path containing the UAPI headers. So if someone built the headers in a
>
> Meaning KHDR_INCLUDES should be used and -I${PWD}/tools/include/uapi can
> be retired?
That's the idea, yes, for "userspace programs". I mean: for BPF programs
requiring vmlinux.h (BPF_CFLAGS), I guess you will still need the bpf.h
file from tools/include/uapi, no?
> I haven't looked into the details. I quickly tried but it
> fails in my environment.
Do you not have issues because some files have something like:
#include <uapi/linux/(...).h>
On my side, I had a working version using this patch:
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 7c5827d20c2e..112f14d40852 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -37,7 +37,7 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic \
> -Wall -Werror -fno-omit-frame-pointer \
> $(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS) \
> -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \
> - -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)
> + -I$(TOOLSINCDIR) $(KHDR_INCLUDES) -I$(OUTPUT)
> LDFLAGS += $(SAN_LDFLAGS)
> LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread
>
But only after having removed these extra 'uapi/':
$ git grep -l '<uapi/' -- tools/testing/selftests/bpf | \
xargs sed -i 's|#include <uapi/|#include <|g'
Is it not OK for you like that?
Note that I built the selftests using KHDR_INCLUDES=-I$INSTALL_HDR_PATH.
>> seperated directory -- INSTALL_HDR_PATH=(...) -- KHDR_INCLUDES can be
>> overridden to look there, instead of ${KERNEL_SRC}/usr/include. Would it
>> be OK to do that? Would it work for the CI without extra changes? Or do
>> you still prefer a copy/symlink to 'tools/include/uapi' instead?
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-07-06 0:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 18:57 [PATCH bpf-next v3 0/3] selftests/bpf: new MPTCP subflow subtest Matthieu Baerts (NGI0)
2024-07-03 18:57 ` [PATCH bpf-next v3 1/3] selftests/bpf: Add mptcp subflow example Matthieu Baerts (NGI0)
2024-07-03 18:57 ` [PATCH bpf-next v3 2/3] selftests/bpf: Add mptcp pm_nl_ctl link Matthieu Baerts (NGI0)
2024-07-04 10:48 ` Matthieu Baerts
2024-07-05 23:10 ` Martin KaFai Lau
2024-07-06 0:25 ` Matthieu Baerts [this message]
2024-07-24 7:42 ` Geliang Tang
2024-07-24 8:24 ` Matthieu Baerts
2024-07-24 19:47 ` Martin KaFai Lau
2024-07-03 18:57 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add mptcp subflow subtest Matthieu Baerts (NGI0)
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=ab8112e6-ea7b-4b36-b395-049214e1608d@kernel.org \
--to=matttbe@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=geliang@kernel.org \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tanggeliang@kylinos.cn \
--cc=yonghong.song@linux.dev \
/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