Squash to "Add mptcp_subflow bpf_iter support"
Subsystems (5)
Geliang Tang
reviewercover Squash to "Add mptcp_subflow bpf_iter support"
From: Geliang Tang <[email protected]>
Address Martin's comments in v1.
Geliang Tang (3):
Squash to "bpf: Register mptcp common kfunc set" Squash to "bpf: Add mptcp_subflow bpf_iter"
Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"
net/mptcp/bpf.c | 20 ++++++++++++++----- .../selftests/bpf/progs/mptcp_bpf_iters.c | 7 +++---- 2 files changed, 18 insertions(+), 9 deletions(-)
Signature · 1 line
2.45.2
Geliang Tang
reviewerPATCH 1/3 Squash to "bpf: Register mptcp common kfunc set"
From: Geliang Tang <[email protected]>
Address Martin's comments in v1:
- check IPPROTO_MPTCP in bpf_mptcp_sk.
- add null-checks for the wrappers.
- add more BPF flags for the wrappers.
- register this kfunc set to BPF_PROG_TYPE_CGROUP_SOCKOPT only, not BPF_PROG_TYPE_UNSPEC.
--- net/mptcp/bpf.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/mptcp/bpf.c +13 -4
@@ -218,18 +218,27 @@ __bpf_kfunc_start_defs(); __bpf_kfunc static struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) { +if (!sk || sk->sk_protocol !=IPPROTO_MPTCP ) +return NULL ; +return mptcp_sk (sk); } __bpf_kfunc static struct mptcp_subflow_context *bpf_mptcp_subflow_ctx (const struct sock *sk) { +if (!sk) +return NULL ; +return mptcp_subflow_ctx (sk); } __bpf_kfunc static struct sock *bpf_mptcp_subflow_tcp_sock (const struct mptcp_subflow_context *subflow) { +if (!subflow) +return NULL ; +return mptcp_subflow_tcp_sock (subflow); }
@@ -299,9 +308,9 @@ __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk)__bpf_kfunc_end_defs (); BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids) -BTF_ID_FLAGS(func, bpf_mptcp_sk) -BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx) -BTF_ID_FLAGS(func, bpf_mptcp_subflow_tcp_sock) +BTF_ID_FLAGS(func, bpf_mptcp_sk, KF_TRUSTED_ARGS | KF_RET_NULL) +BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx, KF_RET_NULL) +BTF_ID_FLAGS(func, bpf_mptcp_subflow_tcp_sock, KF_RET_NULL) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_ARGS) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next, KF_ITER_NEXT | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy, KF_ITER_DESTROY)
@@ -335,7 +344,7 @@ static int __init bpf_mptcp_kfunc_init(void)int ret; ret =register_btf_fmodret_id_set (&bpf_mptcp_fmodret_set); - ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_UNSPEC , + ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_CGROUP_SOCKOPT , &bpf_mptcp_common_kfunc_set); ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &bpf_mptcp_sched_kfunc_set);
Signature · 1 line
2.45.2
Geliang Tang
reviewerPATCH 2/3 Squash to "bpf: Add mptcp_subflow bpf_iter"
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Address Martin's comments in v1:
- bpf_iter_mptcp_subflow_new returns -EINVAL when msk socket lock isn't held.
--- net/mptcp/bpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/bpf.c +2 -1
@@ -252,7 +252,8 @@ bpf_iter_mptcp_subflow_new(struct bpf_iter_mptcp_subflow *it,if (!msk)return -EINVAL ; -msk_owned_by_me (msk); +if (!lockdep_sock_is_held ((const struct sock *)msk)) +return -EINVAL ; kit->pos = &msk->conn_list;return 0 ;
Signature · 1 line
2.45.2
kernel test robot
build botRe: [PATCH mptcp-next 2/3] Squash to "bpf: Add mptcp_subflow bpf_iter"
kernel test robot noticed the following build errors:
Hi Geliang,
kernel test robot noticed the following build errors:
[auto build test ERROR on mptcp/export]
[cannot apply to mptcp/export-net linus/master v6.12 next-20241121] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Geliang-Tang/Squash-to-bpf-Register-mptcp-common-kfunc-set/20241121-155947 base: https://github.com/multipath-tcp/mptcp_net-next.git export patch link: https://lore.kernel.org/r/8e8c6d39d8de8ab2bb4cdd8965c1981a3920bc9e.1732172851.git.tanggeliang%40kylinos.cn patch subject: [PATCH mptcp-next 2/3] Squash to "bpf: Add mptcp_subflow bpf_iter" config: m68k-atari_defconfig (https://download.01.org/0day-ci/archive/20241122/[email protected]/config) compiler: m68k-linux-gcc (GCC) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
m68k-linux-ld: net/mptcp/bpf.o: in function `bpf_iter_mptcp_subflow_new':
>> bpf.c:(.text+0x96): undefined reference to `lockdep_is_held'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Geliang Tang
reviewerPATCH 3/3 Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
IPPROTO_MPTCP is checked in bpf_mptcp_sk(), no need to check it in BPF program.
bpf_mptcp_sk() and bpf_mptcp_subflow_ctx() may return NULL, need to check the return values.
--- tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c +3 -4
@@ -21,12 +21,11 @@ int iters_subflow(struct bpf_sockopt *ctx)struct mptcp_sock *msk;int local_ids =0 ; -if (!sk || sk->protocol !=IPPROTO_MPTCP || - ctx->level !=SOL_TCP || ctx->optname !=TCP_IS_MPTCP ) +if (ctx->level !=SOL_TCP || ctx->optname !=TCP_IS_MPTCP )return 1 ; msk =bpf_mptcp_sk ((struct sock *)sk); -if (msk->pm.server_side || !msk->pm.subflows) +if (!msk || msk->pm.server_side || !msk->pm.subflows)return 1 ; msk =bpf_mptcp_sock_acquire (msk);
@@ -53,7 +52,7 @@ int iters_subflow(struct bpf_sockopt *ctx)/* only to check the following kfunc works */ subflow =bpf_mptcp_subflow_ctx (ssk); -if (subflow->token != msk->token) +if (!subflow || subflow->token != msk->token) goto out; ids = local_ids;
Signature · 1 line
2.45.2
Hi Geliang,
Thank you for your modifications, that's great!
But sadly, our CI spotted some issues with it when trying to build it.
You can find more details there:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/11948563035
Status: failure
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b85b1ada972f
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=911431
Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Script error! ❓
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Script error! ❓
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/11948563025
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b85b1ada972f
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=911431
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)