Skip to contentSkip to conversation

mptcp: locking cleanup

PATCH In review Paolo Abeni 4 participants 17 messages Jan 15, 2024 – Feb 8, 2024

Subsystems (2)
lore
Share & tools
lore

Paolo Abeni

author maintainer
#0 lore raw

cover mptcp: locking cleanup

This is a preparatory work for the TCP_NOTSENT_LOWAT support. The latter will need tracking more state under the msk data lock.

Since the locking msk locking schema is already quite complex, do a long awaited clean-up step, moving several confusing lockless initialization under the relevant locks.

Note that patches 2-4 carry fixes tag, and could target the net tree, but AFACIS no real race could really happen even prior to such patches as the MPTCP-level state machine implicitly ensure proper serialization of the write accesses, even lacking explicit lock.

Patch 1 has no fixes, but still is logically tied to the other patches. Possibly we could target net-next for the whole series.

Paolo Abeni (4):
mptcp: drop the push_pending field
mptcp: fix rcv space initialization
mptcp: fix more tx path fields initialization
mptcp: corner case locking for rx path fields initialization

 net/mptcp/fastopen.c |  6 ++--
 net/mptcp/options.c  |  9 +++---
 net/mptcp/protocol.c | 31 ++++++++++---------
 net/mptcp/protocol.h | 13 ++++----
 net/mptcp/subflow.c  | 71 +++++++++++++++++++++++++++-----------------
 5 files changed, 75 insertions(+), 55 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/4 mptcp: drop the push_pending field

Such field is there to avoid acquiring the data lock in a few spots, but if adds complexity to the already non trivial locking schema.

All the relevant call sites (mptcp-level reinjection, set socket optins), are slow-path, drop such field in favor of 'cb_flags', adding the relevant locking.

---
 net/mptcp/protocol.c | 12 ++++++------
 net/mptcp/protocol.h |  1 -
 2 files changed, 6 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +6 -6
index e570c7e2b18c..5129e1235cc5 100644
@@ -1505,8 +1505,11 @@ static void mptcp_update_post_push(struct mptcp_sock *msk,
 
 void mptcp_check_and_set_pending(struct sock *sk)
 {
-	if (mptcp_send_head(sk))
-		mptcp_sk(sk)->push_pending |= BIT(MPTCP_PUSH_PENDING);
+	if (mptcp_send_head(sk)) {
+		mptcp_data_lock(sk);
+		mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING);
+		mptcp_data_unlock(sk);
+	}
 }
 
 static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
@@ -3145,7 +3148,6 @@ static int mptcp_disconnect(struct sock *sk, int flags)
 	mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
 	WRITE_ONCE(msk->flags, 0);
 	msk->cb_flags = 0;
-	msk->push_pending = 0;
 	msk->recovery = false;
 	msk->can_ack = false;
 	msk->fully_established = false;
@@ -3333,8 +3335,7 @@ static void mptcp_release_cb(struct sock *sk)
 	struct mptcp_sock *msk = mptcp_sk(sk);
 
 	for (;;) {
-		unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED) |
-				      msk->push_pending;
+		unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED);
 		struct list_head join_list;
 
 		if (!flags)
@@ -3350,7 +3351,6 @@ static void mptcp_release_cb(struct sock *sk)
 		 *    datapath acquires the msk socket spinlock while helding
 		 *    the subflow socket lock
 		 */
-		msk->push_pending = 0;
 		msk->cb_flags &= ~flags;
 		spin_unlock_bh(&sk->sk_lock.slock);
 
net/mptcp/protocol.h +0 -1
index f7b9c1b995df..ebb32b7563be 100644
@@ -286,7 +286,6 @@ struct mptcp_sock {
 	int		rmem_released;
 	unsigned long	flags;
 	unsigned long	cb_flags;
-	unsigned long	push_pending;
 	bool		recovery;		/* closing subflow write queue reinjected */
 	bool		can_ack;
 	bool		fully_established;
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH mptcp-net 1/4] mptcp: drop the push_pending field

Hi Paolo,

Quoted 6 lines · Paolo Abeni

Such field is there to avoid acquiring the data lock in a few spots, but if adds complexity to the already non trivial locking schema.

All the relevant call sites (mptcp-level reinjection, set socket optins), are slow-path, drop such field in favor of 'cb_flags', adding the relevant locking.

In your cover-letter, you mentioned:

Quoted 1 line

Patch 1 has no fixes, but still is logically tied to the other patches.

I think it makes sense to have this patch in -net, especially because it is logically tied to the others. Would it be OK for you if I add:

Fixes e9d09baca676 ("mptcp: avoid atomic bit manipulation when possible")

Or do you prefer without?

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
author maintainer
#3 lore raw

Re: [PATCH mptcp-net 1/4] mptcp: drop the push_pending field

Quoted 10 lines · Matthieu Baerts

Hi Paolo,

Quoted 6 lines · Paolo Abeni

Such field is there to avoid acquiring the data lock in a few spots, but if adds complexity to the already non trivial locking schema.

All the relevant call sites (mptcp-level reinjection, set socket optins), are slow-path, drop such field in favor of 'cb_flags', adding the relevant locking.

Quoted 8 lines

In your cover-letter, you mentioned:

Quoted 1 line

Patch 1 has no fixes, but still is logically tied to the other patches.

I think it makes sense to have this patch in -net, especially because it is logically tied to the others. Would it be OK for you if I add:

Fixes e9d09baca676 ("mptcp: avoid atomic bit manipulation when possible")

The obove, or add a sentence to the commit message alike:

"""
This will also simplify the next patch
"""

Quoted 5 lines

Or do you prefer without?

Cheers,
Matt

maintainer
#4 lore raw

Re: [PATCH mptcp-net 1/4] mptcp: drop the push_pending field

Hi Paolo,

Quoted 18 lines · Paolo Abeni
Quoted 17 lines · Matthieu Baerts

Hi Paolo,

Quoted 6 lines · Paolo Abeni

Such field is there to avoid acquiring the data lock in a few spots, but if adds complexity to the already non trivial locking schema.

All the relevant call sites (mptcp-level reinjection, set socket optins), are slow-path, drop such field in favor of 'cb_flags', adding the relevant locking.

In your cover-letter, you mentioned:

Quoted 1 line

Patch 1 has no fixes, but still is logically tied to the other patches.

I think it makes sense to have this patch in -net, especially because it is logically tied to the others. Would it be OK for you if I add:

Quoted 7 lines
Quoted 1 line
Fixes e9d09baca676 ("mptcp: avoid atomic bit manipulation when possible")

The obove, or add a sentence to the commit message alike:

"""
This will also simplify the next patch
"""

Good idea! I added both:

Quoted 3 lines

This patch could be seen as an improvement, instead of a fix. But it simplifies the next patch. The 'Fixes' tag has been added to help having this series backported to stable.

I hope that's OK! :)

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
author maintainer
#5 lore raw

Re: [PATCH mptcp-net 1/4] mptcp: drop the push_pending field

Quoted 7 lines · Matthieu Baerts
Quoted 3 lines · Paolo Abeni

This patch could be seen as an improvement, instead of a fix. But it simplifies the next patch. The 'Fixes' tag has been added to help having this series backported to stable.

I hope that's OK! :)

fine by me, thanks!

/P

author maintainer
#6 lore raw

PATCH 2/4 mptcp: fix rcv space initialization

In reply to Paolo Abeni

mptcp_rcv_space_init() is supposed to happen under the msk socket lock, but active msk socket does that without such protection.

Leverage the existing mptcp_propagate_state() helper to that extent. We need to ensure mptcp_rcv_space_init will happen before mptcp_rcv_space_adjust(), and the release_cb does not assure that:
explicitly check for such condition.

While at it, move the wnd_end initialization out of mptcp_rcv_space_init(), it never belonged there.

Note that the race does not produce ill effect in practice, but change allows cleaning-up and defying better the locking model.

Fixes a6b118febbab ("mptcp: add receive buffer auto-tuning")
---
 net/mptcp/protocol.c | 10 ++++++----
 net/mptcp/protocol.h |  3 ++-
 net/mptcp/subflow.c  |  4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +6 -4
index 5129e1235cc5..c41f49532a0a 100644
@@ -1963,6 +1963,9 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 	if (copied <= 0)
 		return;
 
+	if (!msk->rcvspace_init)
+		mptcp_rcv_space_init(msk, msk->first);
+
 	msk->rcvq_space.copied += copied;
 
 	mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC);
@@ -3163,6 +3166,7 @@ static int mptcp_disconnect(struct sock *sk, int flags)
 	msk->bytes_received = 0;
 	msk->bytes_sent = 0;
 	msk->bytes_retrans = 0;
+	msk->rcvspace_init = 0;
 
 	WRITE_ONCE(sk->sk_shutdown, 0);
 	sk_error_report(sk);
@@ -3250,6 +3254,7 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
 {
 	const struct tcp_sock *tp = tcp_sk(ssk);
 
+	msk->rcvspace_init = 1;
 	msk->rcvq_space.copied = 0;
 	msk->rcvq_space.rtt_us = 0;
 
@@ -3260,8 +3265,6 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
 				      TCP_INIT_CWND * tp->advmss);
 	if (msk->rcvq_space.space == 0)
 		msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
-
-	WRITE_ONCE(msk->wnd_end, msk->snd_nxt + tcp_sk(ssk)->snd_wnd);
 }
 
 void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags)
@@ -3481,10 +3484,9 @@ void mptcp_finish_connect(struct sock *ssk)
 	WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
 	WRITE_ONCE(msk->snd_nxt, msk->write_seq);
 	WRITE_ONCE(msk->snd_una, msk->write_seq);
+	WRITE_ONCE(msk->wnd_end, msk->snd_nxt + tcp_sk(ssk)->snd_wnd);
 
 	mptcp_pm_new_connection(msk, ssk, 0);
-
-	mptcp_rcv_space_init(msk, ssk);
 }
 
 void mptcp_sock_graft(struct sock *sk, struct socket *parent)
net/mptcp/protocol.h +2 -1
index ebb32b7563be..385aa92926d7 100644
@@ -304,7 +304,8 @@ struct mptcp_sock {
 			nodelay:1,
 			fastopening:1,
 			in_accept_queue:1,
-			free_first:1;
+			free_first:1,
+			rcvspace_init:1;
 	struct work_struct work;
 	struct sk_buff  *ooo_last_skb;
 	struct rb_root  out_of_order_queue;
net/mptcp/subflow.c +2 -2
index 90984b053adc..23f639e0d8c3 100644
@@ -424,6 +424,8 @@ void __mptcp_sync_state(struct sock *sk, int state)
 	struct mptcp_sock *msk = mptcp_sk(sk);
 
 	__mptcp_propagate_sndbuf(sk, msk->first);
+	if (!msk->rcvspace_init)
+		mptcp_rcv_space_init(msk, msk->first);
 	if (sk->sk_state == TCP_SYN_SENT) {
 		mptcp_set_state(sk, state);
 		sk->sk_state_change(sk);
@@ -545,7 +547,6 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 		}
 	} else if (mptcp_check_fallback(sk)) {
 fallback:
-		mptcp_rcv_space_init(msk, sk);
 		mptcp_propagate_state(parent, sk);
 	}
 	return;
@@ -1744,7 +1745,6 @@ static void subflow_state_change(struct sock *sk)
 	msk = mptcp_sk(parent);
 	if (subflow_simultaneous_connect(sk)) {
 		mptcp_do_fallback(sk);
-		mptcp_rcv_space_init(msk, sk);
 		pr_fallback(msk);
 		subflow->conn_finished = 1;
 		mptcp_propagate_state(parent, sk);
Signature · 1 line
2.43.0
author maintainer
#7 lore raw

PATCH 3/4 mptcp: fix more tx path fields initialization

In reply to Paolo Abeni

The 'msk->write_seq' and 'msk->snd_nxt' are always updated under the msk socket lock, except at MPC handshake completiont time.

Builds-up on the previous commit to move such init under the relevant lock.

There are no known problems caused by the potential race, the primary goal is consistency.

Fixes 6d0060f600ad ("mptcp: Write MPTCP DSS headers to outgoing data packets")
---
 net/mptcp/protocol.c |  6 ++----
 net/mptcp/subflow.c  | 13 +++++++++++--
 2 files changed, 13 insertions(+), 6 deletions(-)
net/mptcp/protocol.c +2 -4
index c41f49532a0a..b7d1da7bcb50 100644
@@ -3481,10 +3481,8 @@ void mptcp_finish_connect(struct sock *ssk)
 	 * accessing the field below
 	 */
 	WRITE_ONCE(msk->local_key, subflow->local_key);
-	WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
-	WRITE_ONCE(msk->snd_nxt, msk->write_seq);
-	WRITE_ONCE(msk->snd_una, msk->write_seq);
-	WRITE_ONCE(msk->wnd_end, msk->snd_nxt + tcp_sk(ssk)->snd_wnd);
+	WRITE_ONCE(msk->snd_una, subflow->idsn + 1);
+	WRITE_ONCE(msk->wnd_end, subflow->idsn + 1 + tcp_sk(ssk)->snd_wnd);
 
 	mptcp_pm_new_connection(msk, ssk, 0);
 }
net/mptcp/subflow.c +11 -2
index 23f639e0d8c3..fe5334cee477 100644
@@ -421,12 +421,21 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc
 
 void __mptcp_sync_state(struct sock *sk, int state)
 {
+	struct mptcp_subflow_context *subflow;
 	struct mptcp_sock *msk = mptcp_sk(sk);
+	struct sock *ssk = msk->first;
 
-	__mptcp_propagate_sndbuf(sk, msk->first);
+	subflow = mptcp_subflow_ctx(ssk);
+	__mptcp_propagate_sndbuf(sk, ssk);
 	if (!msk->rcvspace_init)
-		mptcp_rcv_space_init(msk, msk->first);
+		mptcp_rcv_space_init(msk, ssk);
+
 	if (sk->sk_state == TCP_SYN_SENT) {
+		/* subflow->idsn is always available is TCP_SYN_SENT state,
+		 * even for the FASTOPEN scenarios
+		 */
+		WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
+		WRITE_ONCE(msk->snd_nxt, msk->write_seq);
 		mptcp_set_state(sk, state);
 		sk->sk_state_change(sk);
 	}
Signature · 1 line
2.43.0
author maintainer
#8 lore raw

PATCH 4/4 mptcp: corner case locking for rx path fields initialization

In reply to Paolo Abeni

Most MPTCP-level related fields are under the mptcp data lock protection, but are written one-off without such lock at MPC complete time, both for the client and the server

Leverage the mptcp_propagate_state() infrastructure to move such initialization under the proper lock client-wise.

The server side critical init steps are done by mptcp_subflow_fully_established(): ensure the caller properly held the relevant lock, and avoid acquiring the same lock in the nested scopes.

There are no real potential races, as write access to such fields is implicitly serialized by the MPTCP state machine; the primary goal is consistency.

Fixes d22f4988ffec ("mptcp: process MP_CAPABLE data option")
---
 net/mptcp/fastopen.c |  6 ++---
 net/mptcp/options.c  |  9 +++----
 net/mptcp/protocol.c |  9 ++++---
 net/mptcp/protocol.h |  9 +++----
 net/mptcp/subflow.c  | 56 +++++++++++++++++++++++++-------------------
 5 files changed, 50 insertions(+), 39 deletions(-)
net/mptcp/fastopen.c +2 -4
index 74698582a285..ad28da655f8b 100644
@@ -59,13 +59,12 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subf
 	mptcp_data_unlock(sk);
 }
 
-void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
-				   const struct mptcp_options_received *mp_opt)
+void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
+				     const struct mptcp_options_received *mp_opt)
 {
 	struct sock *sk = (struct sock *)msk;
 	struct sk_buff *skb;
 
-	mptcp_data_lock(sk);
 	skb = skb_peek_tail(&sk->sk_receive_queue);
 	if (skb) {
 		WARN_ON_ONCE(MPTCP_SKB_CB(skb)->end_seq);
@@ -77,5 +76,4 @@ void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_
 	}
 
 	pr_debug("msk=%p ack_seq=%llx", msk, msk->ack_seq);
-	mptcp_data_unlock(sk);
 }
net/mptcp/options.c +5 -4
index d2527d189a79..e3e96a49f922 100644
@@ -962,9 +962,7 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
 		/* subflows are fully established as soon as we get any
 		 * additional ack, including ADD_ADDR.
 		 */
-		subflow->fully_established = 1;
-		WRITE_ONCE(msk->fully_established, true);
-		goto check_notify;
+		goto set_fully_established;
 	}
 
 	/* If the first established packet does not contain MP_CAPABLE + data
@@ -986,7 +984,10 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
 set_fully_established:
 	if (unlikely(!READ_ONCE(msk->pm.server_side)))
 		pr_warn_once("bogus mpc option on established client sk");
-	mptcp_subflow_fully_established(subflow, mp_opt);
+
+	mptcp_data_lock((struct sock *)msk);
+	__mptcp_subflow_fully_established(msk, subflow, mp_opt);
+	mptcp_data_unlock((struct sock *)msk);
 
 check_notify:
 	/* if the subflow is not already linked into the conn_list, we can't
net/mptcp/protocol.c +6 -3
index b7d1da7bcb50..70108854ec9b 100644
@@ -3189,6 +3189,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 {
 	struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
 	struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC);
+	struct mptcp_subflow_context *subflow;
 	struct mptcp_sock *msk;
 
 	if (!nsk)
@@ -3229,7 +3230,8 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 
 	/* The msk maintain a ref to each subflow in the connections list */
 	WRITE_ONCE(msk->first, ssk);
-	list_add(&mptcp_subflow_ctx(ssk)->node, &msk->conn_list);
+	subflow = mptcp_subflow_ctx(ssk);
+	list_add(&subflow->node, &msk->conn_list);
 	sock_hold(ssk);
 
 	/* new mpc subflow takes ownership of the newly
@@ -3244,6 +3246,9 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 	__mptcp_propagate_sndbuf(nsk, ssk);
 
 	mptcp_rcv_space_init(msk, ssk);
+
+	if (mp_opt->suboptions & OPTION_MPTCP_MPC_ACK)
+		__mptcp_subflow_fully_established(msk, subflow, mp_opt);
 	bh_unlock_sock(nsk);
 
 	/* note: the newly allocated socket refcount is 2 now */
@@ -3481,8 +3486,6 @@ void mptcp_finish_connect(struct sock *ssk)
 	 * accessing the field below
 	 */
 	WRITE_ONCE(msk->local_key, subflow->local_key);
-	WRITE_ONCE(msk->snd_una, subflow->idsn + 1);
-	WRITE_ONCE(msk->wnd_end, subflow->idsn + 1 + tcp_sk(ssk)->snd_wnd);
 
 	mptcp_pm_new_connection(msk, ssk, 0);
 }
net/mptcp/protocol.h +5 -4
index 385aa92926d7..d442d876f465 100644
@@ -622,8 +622,9 @@ unsigned int mptcp_stale_loss_cnt(const struct net *net);
 unsigned int mptcp_close_timeout(const struct sock *sk);
 int mptcp_get_pm_type(const struct net *net);
 const char *mptcp_get_scheduler(const struct net *net);
-void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow,
-				     const struct mptcp_options_received *mp_opt);
+void __mptcp_subflow_fully_established(struct mptcp_sock *msk,
+				       struct mptcp_subflow_context *subflow,
+				       const struct mptcp_options_received *mp_opt);
 bool __mptcp_retransmit_pending_data(struct sock *sk);
 void mptcp_check_and_set_pending(struct sock *sk);
 void __mptcp_push_pending(struct sock *sk, unsigned int flags);
@@ -957,8 +958,8 @@ void mptcp_event_pm_listener(const struct sock *ssk,
 			     enum mptcp_event_type event);
 bool mptcp_userspace_pm_active(const struct mptcp_sock *msk);
 
-void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
-				   const struct mptcp_options_received *mp_opt);
+void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
+				     const struct mptcp_options_received *mp_opt);
 void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow,
 					      struct request_sock *req);
 
net/mptcp/subflow.c +32 -24

106 lines not on this page · raw message

Signature · 1 line
2.43.0
#9 lore raw

Re: mptcp: corner case locking for rx path fields initialization: Tests Results

Hi Paolo,

Thank you for your modifications, that's great!

Our CI (GitHub Action) did some validations and here is its report:

- KVM Validation: normal:
- Unstable: 2 failed test(s): packetdrill_fastopen selftest_mptcp_join 🔴:
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/7530894597

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

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)

#10 lore raw

Re: mptcp: corner case locking for rx path fields initialization: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI (Cirrus) did some validations with a debug kernel and here is its report:

- KVM Validation: debug (except selftest_mptcp_join):
- Unstable: 1 failed test(s): packetdrill_fastopen 🔴:
- Task: https://cirrus-ci.com/task/5162165229846528
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5162165229846528/summary/summary.txt

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

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

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 (NGI0 Core)

#11 lore raw

Re: mptcp: corner case locking for rx path fields initialization: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI (GitHub Action) did some validations and here is its report:

- KVM Validation: normal:
- Critical: 1 Call Trace(s) - Critical: Unexpected stop of the VM ❌:
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/7550415246

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

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)

#12 lore raw

Re: mptcp: corner case locking for rx path fields initialization: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI (Cirrus) did some validations with a debug kernel and here is its report:

- KVM Validation: debug (except selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_diag 🔴:
- Task: https://cirrus-ci.com/task/4675429135548416
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4675429135548416/summary/summary.txt

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

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

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 (NGI0 Core)

#13 lore raw

Re: mptcp: corner case locking for rx path fields initialization: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI (GitHub Action) did some validations and here is its report:

- KVM Validation: normal:
- Unstable: 2 failed test(s): packetdrill_regressions selftest_mptcp_join 🔴:
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/7550415246

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

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)

maintainer Reviewed-by on the v1 series
#14 lore raw
In reply to Paolo Abeni
Quoted 12 lines · Paolo Abeni

This is a preparatory work for the TCP_NOTSENT_LOWAT support. The latter will need tracking more state under the msk data lock.

Since the locking msk locking schema is already quite complex, do a long awaited clean-up step, moving several confusing lockless initialization under the relevant locks.

Note that patches 2-4 carry fixes tag, and could target the net tree, but AFACIS no real race could really happen even prior to such patches as the MPTCP-level state machine implicitly ensure proper serialization of the write accesses, even lacking explicit lock.

Quoted 9 lines

Patch 1 has no fixes, but still is logically tied to the other patches. Possibly we could target net-next for the whole series.

Paolo Abeni (4):
mptcp: drop the push_pending field
mptcp: fix rcv space initialization
mptcp: fix more tx path fields initialization
mptcp: corner case locking for rx path fields initialization

Hi Paolo -

The series LGTM, assuming the CI failure is the issue fixed by "mptcp: relax check on MPC passive fallback":

Quoted 12 lines
net/mptcp/fastopen.c |  6 ++--
net/mptcp/options.c  |  9 +++---
net/mptcp/protocol.c | 31 ++++++++++---------
net/mptcp/protocol.h | 13 ++++----
net/mptcp/subflow.c  | 71 +++++++++++++++++++++++++++-----------------
5 files changed, 75 insertions(+), 55 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#15 lore raw
Quoted 24 lines · Mat Martineau
Quoted 12 lines · Paolo Abeni

This is a preparatory work for the TCP_NOTSENT_LOWAT support. The latter will need tracking more state under the msk data lock.

Since the locking msk locking schema is already quite complex, do a long awaited clean-up step, moving several confusing lockless initialization under the relevant locks.

Note that patches 2-4 carry fixes tag, and could target the net tree, but AFACIS no real race could really happen even prior to such patches as the MPTCP-level state machine implicitly ensure proper serialization of the write accesses, even lacking explicit lock.

Quoted 9 lines

Patch 1 has no fixes, but still is logically tied to the other patches. Possibly we could target net-next for the whole series.

Paolo Abeni (4):
mptcp: drop the push_pending field
mptcp: fix rcv space initialization
mptcp: fix more tx path fields initialization
mptcp: corner case locking for rx path fields initialization

Quoted 4 lines

Hi Paolo -

The series LGTM, assuming the CI failure is the issue fixed by "mptcp:
relax check on MPC passive fallback":

AFAIK, they are: I tested locally this series on top of the fixes, without any problem.

Quoted 1 line

Thanks!

Paolo

maintainer
#16 lore raw
In reply to Paolo Abeni

Hi Paolo, Mat,

Quoted 7 lines · Paolo Abeni

This is a preparatory work for the TCP_NOTSENT_LOWAT support. The latter will need tracking more state under the msk data lock.

Since the locking msk locking schema is already quite complex, do a long awaited clean-up step, moving several confusing lockless initialization under the relevant locks.

Quoted 7 lines

Note that patches 2-4 carry fixes tag, and could target the net tree, but AFACIS no real race could really happen even prior to such patches as the MPTCP-level state machine implicitly ensure proper serialization of the write accesses, even lacking explicit lock.

Patch 1 has no fixes, but still is logically tied to the other patches. Possibly we could target net-next for the whole series.

Thank you for the patches and the review!

Now in our tree (fixes for -net), without a typo spotted by "checkpatch.pl --codespell" (and Vim's "set spell spelllang=en_gb")

New patches for t/upstream-net and t/upstream:
- c6d26639b0a9: mptcp: drop the push_pending field
- 2541670ad929: mptcp: fix rcv space initialization
- a6f5bfc5abf7: mptcp: fix more tx path fields initialization
- 7e6e9b2c5e9d: mptcp: corner case locking for rx path fields initialization
- Results: dd080a859960..50a3b99c60bd (export-net)
- Results: 2d5218531f82..387cadd951df (export)

Tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export-net/20240117T115551
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20240117T115551

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.