Skip to contentSkip to conversation

Squash-to "mptcp: pm: init and release mptcp_pm_ops"

PATCH In review Gang Yan 4 participants 4 messages Jul 2 – Jul 6

Subsystems (2)
lore
Share & tools
lore

Gang Yan

author
#0 lore raw

PATCH v3 1/1 Squash-to "mptcp: pm: init and release mptcp_pm_ops"

From: Gang Yan <[email protected]>

This patch removes the need to handle a NULL pm_ops in the fallback path, and moves the rcu_read_lock\unlock into mptcp_pm_ops_init.

Following sashiko's comments, it also moves the pr_debug() before bpf_module_put() in mptcp_pm_ops_release.

---
 net/mptcp/pm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
net/mptcp/pm.c +8 -7
index 9dc7b41fb562..033f783d4990 100644
@@ -1137,12 +1137,13 @@ void mptcp_pm_worker(struct mptcp_sock *msk)
 	spin_unlock_bh(&msk->pm.lock);
 }
 
-static void mptcp_pm_ops_init(struct mptcp_sock *msk,
-			      struct mptcp_pm_ops *pm_ops)
+static void mptcp_pm_ops_init(struct mptcp_sock *msk, const char *pm_name)
 {
+	struct mptcp_pm_ops *pm_ops;
+
+	pm_ops = mptcp_pm_find(pm_name);
 	if (!pm_ops || !bpf_try_module_get(pm_ops, pm_ops->owner)) {
-		pr_warn_once("pm %s fails, fallback to default pm",
-			     pm_ops->name);
+		pr_warn_once("pm %s fails, fallback to default pm", pm_name);
 		pm_ops = &mptcp_pm_kernel;
 	}
 
@@ -1161,9 +1162,9 @@ static void mptcp_pm_ops_release(struct mptcp_sock *msk)
 	if (pm_ops->release)
 		pm_ops->release(msk);
 
-	bpf_module_put(pm_ops, pm_ops->owner);
-
 	pr_debug("pm %s released\n", pm_ops->name);
+
+	bpf_module_put(pm_ops, pm_ops->owner);
 }
 
 void mptcp_pm_destroy(struct mptcp_sock *msk)
@@ -1185,7 +1186,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
 	WRITE_ONCE(pm->pm_type, pm_type);
 
 	rcu_read_lock();
-	mptcp_pm_ops_init(msk, mptcp_pm_find(pm_name));
+	mptcp_pm_ops_init(msk, pm_name);
 	rcu_read_unlock();
 }
 
Signature · 1 line
2.43.0
#1 lore raw

Hi Gang,

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! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): 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/28571232891

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

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)

reviewer
#2 lore raw
In reply to Gang Yan

Hi Gang,

Thanks for this v3.

Quoted 4 lines · Gang Yan

From: Gang Yan <[email protected]>

This patch removes the need to handle a NULL pm_ops in the fallback path, and moves the rcu_read_lock\unlock into mptcp_pm_ops_init.

The commit log doesn't match, but since this is a squash-to patch, it may not be necessary to update the original commit log when merging.

Anyway, this patch LGTM. I've changed its status to "Queued".

-Geliang

Quoted 56 lines

Following sashiko's comments, it also moves the pr_debug() before bpf_module_put() in mptcp_pm_ops_release.

---
 net/mptcp/pm.c | 15 ++++++++-------

 1 file changed, 8 insertions(+), 7 deletions(-)
net/mptcp/pm.c +0 -0
index 9dc7b41fb562..033f783d4990 100644
@@ -1137,12 +1137,13 @@ void mptcp_pm_worker(struct mptcp_sock *msk)
  	spin_unlock_bh(&msk->pm.lock);
  }

net/mptcp/pm.c +1 -2
-static void mptcp_pm_ops_init(struct mptcp_sock *msk,
-			      struct mptcp_pm_ops *pm_ops)
+static void mptcp_pm_ops_init(struct mptcp_sock *msk, const char

*pm_name)
 {

net/mptcp/pm.c +3 -0
+	struct mptcp_pm_ops *pm_ops;
+
+	pm_ops = mptcp_pm_find(pm_name);

  if (!pm_ops || !bpf_try_module_get(pm_ops, pm_ops->owner)) {

net/mptcp/pm.c +1 -2
-		pr_warn_once("pm %s fails, fallback to default pm",
-			     pm_ops->name);
+		pr_warn_once("pm %s fails, fallback to default pm",

pm_name);
  pm_ops = &mptcp_pm_kernel;
  }

net/mptcp/pm.c +0 -0
@@ -1161,9 +1162,9 @@ static void mptcp_pm_ops_release(struct
 mptcp_sock *msk)
  	if (pm_ops->release)
  		pm_ops->release(msk);

net/mptcp/pm.c +0 -2
-	bpf_module_put(pm_ops, pm_ops->owner);
-

  pr_debug("pm %s released\n", pm_ops->name);

net/mptcp/pm.c +2 -0
+
+	bpf_module_put(pm_ops, pm_ops->owner);

 }

 void mptcp_pm_destroy(struct mptcp_sock *msk)

net/mptcp/pm.c +0 -0
@@ -1185,7 +1186,7 @@ void mptcp_pm_data_reset(struct mptcp_sock
 *msk)
  	WRITE_ONCE(pm->pm_type, pm_type);


  rcu_read_lock();

net/mptcp/pm.c +1 -1
-	mptcp_pm_ops_init(msk, mptcp_pm_find(pm_name));
+	mptcp_pm_ops_init(msk, pm_name);

  rcu_read_unlock();
 }

maintainer
#3 lore raw
In reply to Gang Yan

Hi Gang, Geliang,

Quoted 7 lines · Gang Yan

From: Gang Yan <[email protected]>

This patch removes the need to handle a NULL pm_ops in the fallback path, and moves the rcu_read_lock\unlock into mptcp_pm_ops_init.

Following sashiko's comments, it also moves the pr_debug() before bpf_module_put() in mptcp_pm_ops_release.

Thank you for the v3, and the review!

Now in our tree:

New patches for t/upstream:
- 7d1ab340593f: "squashed" in "mptcp: pm: init and release mptcp_pm_ops"
- e7a8a2a1215d: "Signed-off-by" + "Co-developed-by"
- Results: 653c410fe0bb..3c824013edcf (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/00c0b1f484bfd2a20ad6bf70f19a812a38d6922e/checks

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.