Skip to contentSkip to conversation

BPF packet scheduler updates part 3

PATCH Superseded Geliang Tang 2 participants 9 messages Aug 2, 2023

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover BPF packet scheduler updates part 3

v2:
- use __always_inline instead of inline.

Some cleanups.

Geliang Tang (6):
Squash to "mptcp: add sched_data helpers" Squash to "bpf: Add bpf_mptcp_sched_kfunc_set" Squash to "selftests/bpf: add two mptcp netns helpers" Squash to "bpf: Export more bpf_burst related functions" Squash to "selftests/bpf: Add bpf_rr scheduler" Squash to "selftests/bpf: Add bpf_burst scheduler"

 net/mptcp/bpf.c                                     | 10 ++++++++--
 net/mptcp/protocol.h                                |  6 ------
 net/mptcp/sched.c                                   |  6 ++++++
 tools/testing/selftests/bpf/bpf_tcp_helpers.h       |  2 +-
 tools/testing/selftests/bpf/prog_tests/mptcp.c      |  1 -
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c |  2 +-
 6 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH v2 1/6 Squash to "mptcp: add sched_data helpers"

Add "ignore -Wmissing-prototypes".

---
 net/mptcp/protocol.h | 4 ----
 net/mptcp/sched.c    | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)
net/mptcp/protocol.h +0 -4
index eb0dc1027bab..ba6a63e6d39c 100644
@@ -671,10 +671,6 @@ int mptcp_init_sched(struct mptcp_sock *msk,
 void mptcp_release_sched(struct mptcp_sock *msk);
 void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
 				 bool scheduled);
-void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
-				   struct mptcp_sched_data *data);
-struct mptcp_subflow_context *
-mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos);
 struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk);
 struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk);
 int mptcp_sched_get_send(struct mptcp_sock *msk);
net/mptcp/sched.c +6 -0
index a80cf0481edf..5d78efc9c96c 100644
@@ -127,6 +127,10 @@ void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
 	WRITE_ONCE(subflow->scheduled, scheduled);
 }
 
+__diag_push();
+__diag_ignore_all("-Wmissing-prototypes",
+		  "kfuncs which will be used in BPF programs");
+
 void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
 				   struct mptcp_sched_data *data)
 {
@@ -155,6 +159,8 @@ mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos)
 	return data->contexts[pos];
 }
 
+__diag_pop();
+
 int mptcp_sched_get_send(struct mptcp_sock *msk)
 {
 	struct mptcp_subflow_context *subflow;
Signature · 1 line
2.35.3
#2 lore raw

PATCH v2 2/6 Squash to "bpf: Add bpf_mptcp_sched_kfunc_set"

In reply to Geliang Tang

Rename bpf_mptcp_sched_kfunc_init to bpf_mptcp_kfunc_init. Since some kfuncs related "mptcpify" will init in this function too.

---
 net/mptcp/bpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/bpf.c +2 -2
index 0cb25ae3ee30..c33b5c7b1649 100644
@@ -171,12 +171,12 @@ static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {
 	.set	= &bpf_mptcp_sched_kfunc_ids,
 };
 
-static int __init bpf_mptcp_sched_kfunc_init(void)
+static int __init bpf_mptcp_kfunc_init(void)
 {
 	return register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
 					 &bpf_mptcp_sched_kfunc_set);
 }
-late_initcall(bpf_mptcp_sched_kfunc_init);
+late_initcall(bpf_mptcp_kfunc_init);
 #endif /* CONFIG_BPF_JIT */
 
 struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
Signature · 1 line
2.35.3
#3 lore raw

PATCH v2 3/6 Squash to "selftests/bpf: add two mptcp netns helpers"

In reply to Geliang Tang

Just drop a black line.

---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 1 -
 1 file changed, 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/mptcp.c +0 -1
index ad6b5e889d9d..09770aa31f4a 100644
@@ -198,7 +198,6 @@ static void test_base(void)
 
 fail:
 	cleanup_netns(nstoken);
-
 	close(cgroup_fd);
 }
 
Signature · 1 line
2.35.3
#4 lore raw

PATCH v2 4/6 Squash to "bpf: Export more bpf_burst related functions"

In reply to Geliang Tang

Add "ignore -Wmissing-prototypes".

---
 net/mptcp/bpf.c      | 6 ++++++
 net/mptcp/protocol.h | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)
net/mptcp/bpf.c +6 -0
index c33b5c7b1649..51634efe4741 100644
@@ -144,6 +144,10 @@ struct bpf_struct_ops bpf_mptcp_sched_ops = {
 	.name		= "mptcp_sched_ops",
 };
 
+__diag_push();
+__diag_ignore_all("-Wmissing-prototypes",
+		  "kfuncs which will be used in BPF programs");
+
 bool bpf_mptcp_subflow_memory_free(const struct sock *sk)
 {
 	return sk_stream_memory_free(sk);
@@ -154,6 +158,8 @@ bool bpf_mptcp_subflow_queues_empty(const struct sock *sk)
 	return tcp_rtx_and_write_queues_empty(sk);
 }
 
+__diag_pop();
+
 BTF_SET8_START(bpf_mptcp_sched_kfunc_ids)
 BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
 BTF_ID_FLAGS(func, mptcp_sched_data_set_contexts)
net/mptcp/protocol.h +0 -2
index ba6a63e6d39c..4572f01b978d 100644
@@ -642,8 +642,6 @@ void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk);
 void mptcp_sock_graft(struct sock *sk, struct socket *parent);
 u64 mptcp_wnd_end(const struct mptcp_sock *msk);
 void mptcp_set_timeout(struct sock *sk);
-bool bpf_mptcp_subflow_memory_free(const struct sock *sk);
-bool bpf_mptcp_subflow_queues_empty(const struct sock *sk);
 struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk);
 bool __mptcp_close(struct sock *sk, long timeout);
 void mptcp_cancel_work(struct sock *sk);
Signature · 1 line
2.35.3
#5 lore raw

PATCH v2 5/6 Squash to "selftests/bpf: Add bpf_rr scheduler"

In reply to Geliang Tang

Use __always_inline instead of inline.

---
 tools/testing/selftests/bpf/bpf_tcp_helpers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_tcp_helpers.h +1 -1
index 5763bd27f56d..ff4dd13fd8c6 100644
@@ -274,7 +274,7 @@ extern void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
 					  struct mptcp_sched_data *data) __ksym;
 extern struct mptcp_subflow_context *
 mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) __ksym;
-static inline struct sock *
+static __always_inline struct sock *
 mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
 {
 	return subflow->tcp_sock;
Signature · 1 line
2.35.3
#6 lore raw

PATCH v2 6/6 Squash to "selftests/bpf: Add bpf_burst scheduler"

In reply to Geliang Tang

Use __always_inline instead of inline.

---
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +1 -1
index 7af21d03277d..6703c7e6810a 100644
@@ -25,7 +25,7 @@ struct subflow_send_info {
 	__u64 linger_time;
 };
 
-static inline __u64 div_u64(__u64 dividend, __u32 divisor)
+static __always_inline __u64 div_u64(__u64 dividend, __u32 divisor)
 {
 	return dividend / divisor;
 }
Signature · 1 line
2.35.3
#7 lore raw

Re: Squash to "selftests/bpf: Add bpf_burst scheduler": Build Failure

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://patchwork.kernel.org/project/mptcp/patch/7cc369ef8c192ca7ef18b8d31a4673ea1b13261c.1690976940.git.geliang.tang@suse.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5738644783

Status: failure
Initiator: MPTCPimporter
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/19006ba8d449

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 (Tessares)

#8 lore raw

Re: Squash to "selftests/bpf: Add bpf_burst scheduler": Tests Results

In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4780248831623168
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4780248831623168/summary/summary.txt

- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5343198785044480
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5343198785044480/summary/summary.txt

- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5906148738465792
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5906148738465792/summary/summary.txt

- KVM Validation: debug (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6469098691887104
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6469098691887104/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/19006ba8d449

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-debug

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 (Tessares)