"add mptcp_subflow bpf_iter v3" fixes
Subsystems (3)
Geliang Tang
reviewercover "add mptcp_subflow bpf_iter v3" fixes
From: Geliang Tang <[email protected]>
It's better to register mptcp_subflow bpf_iter helpers in common_btf_ids in kernel/bpf/helpers.c, not in bpf_mptcp_sched_kfunc_ids in net/mptcp/bpf.c.
Geliang Tang (2):
Squash to "bpf: Add mptcp_subflow bpf_iter" Squash to "bpf: Register mptcp tracing kfunc set"
kernel/bpf/helpers.c | 5 +++++ net/mptcp/bpf.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH 1/2 Squash to "bpf: Add mptcp_subflow bpf_iter"
From: Geliang Tang <[email protected]>
Register mptcp_subflow bpf_iter helpers in common_btf_ids in kernel/bpf/helpers.c, then they can be used on a larger scale, not only in types BPF_PROG_TYPE_TRACING and BPF_PROG_TYPE_STRUCT_OPS.
--- kernel/bpf/helpers.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/helpers.c +5 -0
@@ -3023,6 +3023,11 @@ BTF_ID_FLAGS(func, bpf_preempt_enable) BTF_ID_FLAGS(func, bpf_iter_bits_new, KF_ITER_NEW) BTF_ID_FLAGS(func, bpf_iter_bits_next, KF_ITER_NEXT | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_iter_bits_destroy, KF_ITER_DESTROY) +#ifdef CONFIG_MPTCP +BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new) +BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next) +BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy) +#endif BTF_KFUNCS_END (common_btf_ids) static const struct btf_kfunc_id_set common_kfunc_set = {
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH 2/2 Squash to "bpf: Register mptcp tracing kfunc set"
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
'''
Since the kfuncs mptcp_subflow_active() and mptcp_subflow_set_scheduled() are invoked in the mptcp_subflow bpf_iter test in a ftrace hook for mptcp_sched_get_send(), it's necessary to register them into a BPF_PROG_TYPE_TRACING type kfunc set to allow them to be invoked in the hook.
'''
--- net/mptcp/bpf.c | 3 --- 1 file changed, 3 deletions(-)
net/mptcp/bpf.c +0 -3
@@ -260,9 +260,6 @@ __bpf_kfunc bool bpf_mptcp_subflow_queues_empty(struct sock *sk)__bpf_kfunc_end_defs (); BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids) -BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new) -BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next) -BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy) BTF_ID_FLAGS(func, mptcp_subflow_active) BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled) BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx_by_pos)
Signature · 1 line
2.43.0
Matthieu Baerts
maintainerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
In reply to Geliang TangHi Geliang,
Quoted 5 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale, not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.
Why could they not be used in these types? I find it good to have them defined in net/mptcp, from a maintenance point of view.
Also, the different bpf_iter_xxx helpers defined there look generic. While here, it is specific to MPTCP, I'm not even sure that would be OK to add them there. Is it not OK to define them only in net/mptcp/bpf.c? (or at least for the moment)
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
Hi Matt,
Quoted 14 lines · Matthieu Baerts
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale, not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.Why could they not be used in these types? I find it good to have them
defined in net/mptcp, from a maintenance point of view.
Quoted 5 lines
Also, the different
bpf_iter_xxxhelpers defined there look generic. While here, it is specific to MPTCP, I'm not even sure that would be OK
to add them there. Is it not OK to define them only innet/mptcp/bpf.c?
Yes, a new test for #484 (BPF: setsockopt on an MPTCP socket: check support) will use these helpers in "cgroup/setsockopt", that is the BPF_PROG_TYPE_CGROUP_SOCKOPT type.
register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
&bpf_mptcp_sched_kfunc_set);
will fail, since BPF_PROG_TYPE_CGROUP_SOCKOPT is not allow to register more kfuncs (see bpf_prog_type_to_kfunc_hook() in kernel/bpf/btf.c).
So I have to move them into common_btf_ids in kernel/bpf/helpers.c to allow them can be used in almost every BPF program type.
Thanks,
-Geliang
Quoted 4 lines
(or at least for the moment)
Cheers,
Matt
Matthieu Baerts
maintainerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
Hi Geliang,
Quoted 27 lines · Geliang Tang
Hi Matt,
Quoted 14 lines · Matthieu Baerts
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale, not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.Why could they not be used in these types? I find it good to have them
defined in net/mptcp, from a maintenance point of view.Quoted 5 lines
Also, the different
bpf_iter_xxxhelpers defined there look generic. While here, it is specific to MPTCP, I'm not even sure that would be OK
to add them there. Is it not OK to define them only innet/mptcp/bpf.c?Yes, a new test for #484 (BPF: setsockopt on an MPTCP socket: check support) will use these helpers in "cgroup/setsockopt", that is the
BPF_PROG_TYPE_CGROUP_SOCKOPTtype.
Quoted 8 lines
register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
&bpf_mptcp_sched_kfunc_set);will fail, since
BPF_PROG_TYPE_CGROUP_SOCKOPTis not allow to register more kfuncs (seebpf_prog_type_to_kfunc_hook()inkernel/bpf/btf.c).So I have to move them into
common_btf_idsinkernel/bpf/helpers.cto allow them can be used in almost every BPF program type.
OK, but then I guess these helpers can be upstreamed before the packet schedulers, right?
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
Quoted 40 lines · Matthieu Baerts
Hi Geliang,
Quoted 37 lines · Geliang Tang
Hi Matt,
Quoted 14 lines · Matthieu Baerts
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale, not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.Why could they not be used in these types? I find it good to have them
defined in net/mptcp, from a maintenance point of view.Quoted 7 lines
Also, the different
bpf_iter_xxxhelpers defined there look generic.
While here, it is specific to MPTCP, I'm not even sure that would be
OK
to add them there. Is it not OK to define them only innet/mptcp/bpf.c?Yes, a new test for #484 (BPF: setsockopt on an MPTCP socket: check support) will use these helpers in "cgroup/setsockopt", that is the
BPF_PROG_TYPE_CGROUP_SOCKOPTtype.register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
&bpf_mptcp_sched_kfunc_set);will fail, since
BPF_PROG_TYPE_CGROUP_SOCKOPTis not allow to register
more kfuncs (seebpf_prog_type_to_kfunc_hook()inkernel/bpf/btf.c).
Quoted 7 lines
Quoted 3 lines
So I have to move them into
common_btf_idsinkernel/bpf/helpers.cto
allow them can be used in almost every BPF program type.OK, but then I guess these helpers can be upstreamed before the packet
schedulers, right?
Yes, indeed. I hope them can be upstreamed after the "new MPTCP subflow subtest" set under reviewing on BPF list.
So this set should be applied in this order:
selftests/bpf: Add mptcp subflow example selftests/bpf: Add getsockopt to inspect mptcp subflow selftests/bpf: Add mptcp subflow subtest
bpf: Add mptcp_subflow bpf_iter
bpf: Register mptcp tracing kfunc set selftests/bpf: Add mptcp_subflow bpf_iter test prog selftests/bpf: Add mptcp_subflow bpf_iter subtest selftests/bpf: Add bpf scheduler test selftests/bpf: Add bpf_first scheduler & test
Thanks,
-Geliang
Quoted 3 lines
Cheers,
Matt
Matthieu Baerts
maintainerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
Quoted 45 lines · Geliang Tang
Quoted 44 lines · Matthieu Baerts
Hi Geliang,
Quoted 40 lines · Geliang Tang
Hi Matt,
Quoted 14 lines · Matthieu Baerts
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale, not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.Why could they not be used in these types? I find it good to have them
defined in net/mptcp, from a maintenance point of view.Quoted 7 lines
Also, the different
bpf_iter_xxxhelpers defined there look generic.
While here, it is specific to MPTCP, I'm not even sure that would be
OK
to add them there. Is it not OK to define them only innet/mptcp/bpf.c?Yes, a new test for #484 (BPF: setsockopt on an MPTCP socket: check support) will use these helpers in "cgroup/setsockopt", that is the
BPF_PROG_TYPE_CGROUP_SOCKOPTtype.register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
&bpf_mptcp_sched_kfunc_set);will fail, since
BPF_PROG_TYPE_CGROUP_SOCKOPTis not allow to register
more kfuncs (seebpf_prog_type_to_kfunc_hook()inkernel/bpf/btf.c).So I have to move them into
common_btf_idsinkernel/bpf/helpers.cto
allow them can be used in almost every BPF program type.
Quoted 6 lines
Quoted 3 lines
OK, but then I guess these helpers can be upstreamed before the packet
schedulers, right?Yes, indeed. I hope them can be upstreamed after the "new MPTCP subflow subtest" set under reviewing on BPF list.
OK good!
Quoted 5 lines
So this set should be applied in this order:
selftests/bpf: Add mptcp subflow example selftests/bpf: Add getsockopt to inspect mptcp subflow selftests/bpf: Add mptcp subflow subtest
I will first send these 3, before focusing on the other ones if that's OK.
Quoted 6 lines
bpf: Add
mptcp_subflowbpf_iter
bpf: Register mptcp tracing kfunc set selftests/bpf: Addmptcp_subflowbpf_itertest prog selftests/bpf: Addmptcp_subflowbpf_itersubtest selftests/bpf: Add bpf scheduler test selftests/bpf: Addbpf_firstscheduler & test
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
Quoted 63 lines · Matthieu Baerts
Quoted 52 lines · Geliang Tang
Quoted 51 lines · Matthieu Baerts
Hi Geliang,
Quoted 47 lines · Geliang Tang
Hi Matt,
Quoted 17 lines · Matthieu Baerts
Hi Geliang,
Quoted 8 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale,
not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.Why could they not be used in these types? I find it good to have
them
defined in net/mptcp, from a maintenance point of view.Quoted 8 lines
Also, the different
bpf_iter_xxxhelpers defined there look generic.
While here, it is specific to MPTCP, I'm not even sure that would
be
OK
to add them there. Is it not OK to define them only innet/mptcp/bpf.c?Yes, a new test for #484 (BPF: setsockopt on an MPTCP socket:
check
support) will use these helpers in "cgroup/setsockopt", that is theBPF_PROG_TYPE_CGROUP_SOCKOPTtype.register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
&bpf_mptcp_sched_kfunc_set);will fail, since
BPF_PROG_TYPE_CGROUP_SOCKOPTis not allow to register
more kfuncs (seebpf_prog_type_to_kfunc_hook()inkernel/bpf/btf.c).So I have to move them into
common_btf_idsinkernel/bpf/helpers.c
to
allow them can be used in almost every BPF program type.Quoted 7 lines
Quoted 3 lines
OK, but then I guess these helpers can be upstreamed before the packet
schedulers, right?Yes, indeed. I hope them can be upstreamed after the "new MPTCP subflow
subtest" set under reviewing on BPF list.OK good!
Quoted 8 lines
Quoted 5 lines
So this set should be applied in this order:
selftests/bpf: Add mptcp subflow example selftests/bpf: Add getsockopt to inspect mptcp subflow selftests/bpf: Add mptcp subflow subtest
I will first send these 3, before focusing on the other ones if that's OK.
Thanks.
Quoted 5 lines
Quoted 5 lines
bpf: Add
mptcp_subflowbpf_iter
bpf: Register mptcp tracing kfunc set selftests/bpf: Addmptcp_subflowbpf_itertest prog selftests/bpf: Addmptcp_subflowbpf_itersubtest
The next set is to use this mptcp_subflow bpf_iter to update all the BPF scheduler examples, which is almost ready. I will post them in the next few days.
Regards,
-Geliang
Quoted 4 lines
Quoted 2 lines
selftests/bpf: Add bpf scheduler test
selftests/bpf: Addbpf_firstscheduler & testCheers,
Matt
Geliang Tang
reviewerRe: [PATCH mptcp-next 1/2] Squash to "bpf: Add mptcp_subflow bpf_iter"
In reply to Matthieu BaertsHi Matt,
Quoted 39 lines · Matthieu Baerts
Hi Geliang,
Quoted 36 lines · Geliang Tang
Hi Matt,
Quoted 14 lines · Matthieu Baerts
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Register
mptcp_subflowbpf_iterhelpers incommon_btf_idsinkernel/bpf/helpers.c, then they can be used on a larger scale, not only in typesBPF_PROG_TYPE_TRACINGandBPF_PROG_TYPE_STRUCT_OPS.Why could they not be used in these types? I find it good to have them
defined in net/mptcp, from a maintenance point of view.Quoted 7 lines
Also, the different
bpf_iter_xxxhelpers defined there look generic.
While here, it is specific to MPTCP, I'm not even sure that would be
OK
to add them there. Is it not OK to define them only innet/mptcp/bpf.c?Yes, a new test for #484 (BPF: setsockopt on an MPTCP socket: check support) will use these helpers in "cgroup/setsockopt", that is the
BPF_PROG_TYPE_CGROUP_SOCKOPTtype.register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
&bpf_mptcp_sched_kfunc_set);will fail, since
BPF_PROG_TYPE_CGROUP_SOCKOPTis not allow to register
more kfuncs (seebpf_prog_type_to_kfunc_hook()inkernel/bpf/btf.c).
I rethought it again, we can easily extend bpf_prog_type_to_kfunc_hook:
+++ b/kernel/bpf/btf.c
@@ -8310,6 +8310,7 @@ static int bpf_prog_type_to_kfunc_hook(enum bpf_prog_type prog_type)
return BTF_KFUNC_HOOK_SYSCALL;
case BPF_PROG_TYPE_CGROUP_SKB:
case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
+ case BPF_PROG_TYPE_CGROUP_SOCKOPT:
return BTF_KFUNC_HOOK_CGROUP_SKB;
case BPF_PROG_TYPE_SCHED_ACT:
return BTF_KFUNC_HOOK_SCHED_ACT;So we can still define and register mptcp_subflow bpf_iter helpers only in net/mptcp/bpf.c. v4 is sent, this patch is superseded.
Thanks,
-Geliang
Quoted 11 lines
Quoted 4 lines
So I have to move them into
common_btf_idsinkernel/bpf/helpers.cto
allow them can be used in almost every BPF program type.OK, but then I guess these helpers can be upstreamed before the packet
schedulers, right?Cheers,
Matt