* [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler"
@ 2025-05-20 8:48 Geliang Tang
2025-05-20 8:48 ` [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Geliang Tang @ 2025-05-20 8:48 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
Two squash-to patches based on Martin's feedback for "bpf: Add
mptcp_subflow bpf_iter support" v3.
Geliang Tang (2):
Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"
Squash to "bpf: Export mptcp packet scheduler helpers"
net/mptcp/bpf.c | 13 +++++++++++++
tools/testing/selftests/bpf/progs/mptcp_bpf.h | 10 ++++++++++
tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c | 2 +-
3 files changed, 24 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"
2025-05-20 8:48 [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" Geliang Tang
@ 2025-05-20 8:48 ` Geliang Tang
2025-05-20 11:23 ` Matthieu Baerts
2025-05-20 8:48 ` [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers" Geliang Tang
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Geliang Tang @ 2025-05-20 8:48 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
Define mptcp_subflow_ctx() using bpf_core_cast as Martin suggested.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/bpf/progs/mptcp_bpf.h | 10 ++++++++++
tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf.h b/tools/testing/selftests/bpf/progs/mptcp_bpf.h
index 4e901941d5dd..815bbf865ee4 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_bpf.h
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf.h
@@ -39,6 +39,16 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
return subflow->tcp_sock;
}
+static __always_inline struct mptcp_subflow_context *
+mptcp_subflow_ctx(const struct sock *sk)
+{
+ const struct inet_connection_sock *
+ icsk = bpf_core_cast(sk, struct inet_connection_sock);
+
+ /* Use RCU on icsk_ulp_data only for sock diag code */
+ return bpf_core_cast(icsk->icsk_ulp_data, struct mptcp_subflow_context);
+}
+
/* ksym */
extern struct mptcp_subflow_context *
bpf_mptcp_subflow_ctx(const struct sock *sk) __ksym;
diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
index a1d8f9b20259..88a3100dfdc2 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
@@ -48,7 +48,7 @@ int iters_subflow(struct bpf_sockopt *ctx)
goto out;
/* only to check the following kfunc works */
- subflow = bpf_mptcp_subflow_ctx(ssk);
+ subflow = mptcp_subflow_ctx(ssk);
if (!subflow || subflow->token != msk->token)
goto out;
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
2025-05-20 8:48 [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" Geliang Tang
2025-05-20 8:48 ` [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
@ 2025-05-20 8:48 ` Geliang Tang
2025-05-20 11:23 ` Matthieu Baerts
2025-05-21 0:20 ` kernel test robot
2025-05-20 10:33 ` [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" MPTCP CI
2025-05-20 11:40 ` MPTCP CI
3 siblings, 2 replies; 8+ messages in thread
From: Geliang Tang @ 2025-05-20 8:48 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
Define .filter as Martin suggested.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/bpf.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 2b0cfb57df8c..4044a8f2c477 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -317,9 +317,22 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)
BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)
BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
+static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
+{
+ if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids, kfunc_id))
+ return 0;
+
+ if (prog->aux->st_ops &&
+ prog->aux->st_ops != &bpf_mptcp_sched_ops)
+ return -EACCES;
+
+ return 0;
+}
+
static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
.owner = THIS_MODULE,
.set = &bpf_mptcp_common_kfunc_ids,
+ .filter = bpf_mptcp_common_kfunc_filter,
};
static int __init bpf_mptcp_kfunc_init(void)
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler"
2025-05-20 8:48 [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" Geliang Tang
2025-05-20 8:48 ` [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
2025-05-20 8:48 ` [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers" Geliang Tang
@ 2025-05-20 10:33 ` MPTCP CI
2025-05-20 11:40 ` MPTCP CI
3 siblings, 0 replies; 8+ messages in thread
From: MPTCP CI @ 2025-05-20 10:33 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Critical: 82 Call Trace(s) - Critical: Global Timeout ❌
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/15133544129
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/26fbacaac134
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=964483
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-normal
For 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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest"
2025-05-20 8:48 ` [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
@ 2025-05-20 11:23 ` Matthieu Baerts
0 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts @ 2025-05-20 11:23 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: Geliang Tang
Hi Geliang,
Thank you for this follow-up!
On 20/05/2025 10:48, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Define mptcp_subflow_ctx() using bpf_core_cast as Martin suggested.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> tools/testing/selftests/bpf/progs/mptcp_bpf.h | 10 ++++++++++
> tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c | 2 +-
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf.h b/tools/testing/selftests/bpf/progs/mptcp_bpf.h
> index 4e901941d5dd..815bbf865ee4 100644
> --- a/tools/testing/selftests/bpf/progs/mptcp_bpf.h
> +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf.h
> @@ -39,6 +39,16 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
> return subflow->tcp_sock;
> }
>
> +static __always_inline struct mptcp_subflow_context *
> +mptcp_subflow_ctx(const struct sock *sk)
> +{
> + const struct inet_connection_sock *
> + icsk = bpf_core_cast(sk, struct inet_connection_sock);
> +
> + /* Use RCU on icsk_ulp_data only for sock diag code */
> + return bpf_core_cast(icsk->icsk_ulp_data, struct mptcp_subflow_context);
> +}
> +
> /* ksym */
> extern struct mptcp_subflow_context *
> bpf_mptcp_subflow_ctx(const struct sock *sk) __ksym;
> diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
> index a1d8f9b20259..88a3100dfdc2 100644
> --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
> +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
> @@ -48,7 +48,7 @@ int iters_subflow(struct bpf_sockopt *ctx)
> goto out;
>
> /* only to check the following kfunc works */
Then we can remove this comment.
> - subflow = bpf_mptcp_subflow_ctx(ssk);
> + subflow = mptcp_subflow_ctx(ssk);
> if (!subflow || subflow->token != msk->token)
> goto out;
>
Note that when reading Martin's review again, it looks like this
selftest is not really useful. Maybe we should drop it? WDYT?
If we do, the "common" kfunc should no longer be registered for
BPF_PROG_TYPE_CGROUP_SOCKOPT, right? I think it makes sense anyway. I
don't think we need that, at least not for the moment. Then, better to
restrict to struct_ops to help with the maintenance ; except if you see
useful use-cases for this CGroup SockOpt program type?
What we did in the selftest could be done without the kfunc, and we
didn't find anything really useful to do with the kfunc, right?
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
2025-05-20 8:48 ` [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers" Geliang Tang
@ 2025-05-20 11:23 ` Matthieu Baerts
2025-05-21 0:20 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: Matthieu Baerts @ 2025-05-20 11:23 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: Geliang Tang
Hi Geliang,
On 20/05/2025 10:48, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Define .filter as Martin suggested.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/bpf.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
> index 2b0cfb57df8c..4044a8f2c477 100644
> --- a/net/mptcp/bpf.c
> +++ b/net/mptcp/bpf.c
> @@ -317,9 +317,22 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)
> BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)
> BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
>
> +static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
> +{
> + if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids, kfunc_id))
> + return 0;
> +
> + if (prog->aux->st_ops &&
See my message on the previous patch: maybe we don't need this condition
then.
> + prog->aux->st_ops != &bpf_mptcp_sched_ops)
> + return -EACCES;
> +
> + return 0;
> +}
> +
> static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
> .owner = THIS_MODULE,
> .set = &bpf_mptcp_common_kfunc_ids,
> + .filter = bpf_mptcp_common_kfunc_filter,
> };
>
> static int __init bpf_mptcp_kfunc_init(void)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler"
2025-05-20 8:48 [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" Geliang Tang
` (2 preceding siblings ...)
2025-05-20 10:33 ` [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" MPTCP CI
@ 2025-05-20 11:40 ` MPTCP CI
3 siblings, 0 replies; 8+ messages in thread
From: MPTCP CI @ 2025-05-20 11:40 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/15133544129
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/26fbacaac134
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=964483
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-normal
For 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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
2025-05-20 8:48 ` [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers" Geliang Tang
2025-05-20 11:23 ` Matthieu Baerts
@ 2025-05-21 0:20 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-05-21 0:20 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: oe-kbuild-all, Geliang Tang
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.15-rc7 next-20250516]
[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-selftests-bpf-Add-mptcp_subflow-bpf_iter-subtest/20250520-165020
base: https://github.com/multipath-tcp/mptcp_net-next.git export
patch link: https://lore.kernel.org/r/9c089a245833c43d55ec240be1b880909af849ce.1747730598.git.tanggeliang%40kylinos.cn
patch subject: [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
config: i386-buildonly-randconfig-005-20250521 (https://download.01.org/0day-ci/archive/20250521/202505210809.DJ1jeY8P-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250521/202505210809.DJ1jeY8P-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505210809.DJ1jeY8P-lkp@intel.com/
All errors (new ones prefixed by >>):
net/mptcp/bpf.c: In function 'bpf_mptcp_common_kfunc_filter':
>> net/mptcp/bpf.c:326:35: error: 'bpf_mptcp_sched_ops' undeclared (first use in this function); did you mean 'mptcp_sched_ops'?
326 | prog->aux->st_ops != &bpf_mptcp_sched_ops)
| ^~~~~~~~~~~~~~~~~~~
| mptcp_sched_ops
net/mptcp/bpf.c:326:35: note: each undeclared identifier is reported only once for each function it appears in
vim +326 net/mptcp/bpf.c
319
320 static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
321 {
322 if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids, kfunc_id))
323 return 0;
324
325 if (prog->aux->st_ops &&
> 326 prog->aux->st_ops != &bpf_mptcp_sched_ops)
327 return -EACCES;
328
329 return 0;
330 }
331
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-05-21 0:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-20 8:48 [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" Geliang Tang
2025-05-20 8:48 ` [PATCH mptcp-next 1/2] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
2025-05-20 11:23 ` Matthieu Baerts
2025-05-20 8:48 ` [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers" Geliang Tang
2025-05-20 11:23 ` Matthieu Baerts
2025-05-21 0:20 ` kernel test robot
2025-05-20 10:33 ` [PATCH mptcp-next 0/2] Squash to "BPF packet scheduler" MPTCP CI
2025-05-20 11:40 ` MPTCP CI
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.