Skip to contentSkip to conversation

cleanups for bpf schedulers

PATCH Superseded Geliang Tang 2 participants 4 messages Sep 5, 2024

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover cleanups for bpf schedulers

From: Geliang Tang <[email protected]>

Two cleanups for bpf schedulers.

Geliang Tang (2):
Squash to "bpf: Add bpf_mptcp_sched_ops"
Squash to "selftests/bpf: Add bpf_burst scheduler & test"

 net/mptcp/bpf.c                                     | 3 ---
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 5 +++--
 2 files changed, 3 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH 1/2 Squash to "bpf: Add bpf_mptcp_sched_ops"

From: Geliang Tang <[email protected]>

The helper mptcp_subflow_set_scheduled() is used to update the scheduled flags of a subflow. BPF schedulers are not allowed to directly modify this flags. So the write access permission for this flag shouldn't be allow.

---
 net/mptcp/bpf.c | 3 ---
 1 file changed, 3 deletions(-)
net/mptcp/bpf.c +0 -3
index 9672a70c24b0..6414824402e6 100644
@@ -60,9 +60,6 @@ static int bpf_mptcp_sched_btf_struct_access(struct bpf_verifier_log *log,
 		}
 	} else if (t == mptcp_subflow_type) {
 		switch (off) {
-		case offsetof(struct mptcp_subflow_context, scheduled):
-			end = offsetofend(struct mptcp_subflow_context, scheduled);
-			break;
 		case offsetof(struct mptcp_subflow_context, avg_pacing_rate):
 			end = offsetofend(struct mptcp_subflow_context, avg_pacing_rate);
 			break;
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH 2/2 Squash to "selftests/bpf: Add bpf_burst scheduler & test"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Use nr_active variable just like in mptcp_subflow_get_send().

---
 tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +3 -2
index 3a673291b4dd..eb21119aa8f7 100644
@@ -74,9 +74,9 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
 	struct mptcp_subflow_context *subflow;
 	struct sock *sk = (struct sock *)msk;
 	__u32 pace, burst, wmem;
+	int i, nr_active = 0;
 	__u64 linger_time;
 	struct sock *ssk;
-	int i;
 
 	/* pick the subflow with the lower wmem/wspace ratio */
 	for (i = 0; i < SSK_MODE_MAX; ++i) {
@@ -97,6 +97,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
 		if (!mptcp_subflow_active(subflow))
 			continue;
 
+		nr_active += !backup;
 		pace = subflow->avg_pacing_rate;
 		if (!pace) {
 			/* init pacing rate from socket */
@@ -115,7 +116,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
 	mptcp_set_timeout(sk);
 
 	/* pick the best backup if no other subflow is active */
-	if (send_info[SSK_MODE_ACTIVE].subflow_id == MPTCP_SUBFLOWS_MAX)
+	if (!nr_active)
 		send_info[SSK_MODE_ACTIVE].subflow_id = send_info[SSK_MODE_BACKUP].subflow_id;
 
 	subflow = bpf_mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE].subflow_id);
Signature · 1 line
2.43.0
#3 lore raw
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: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/10722750441

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/bd5b4bab43f5
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=887280

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)