Skip to contentSkip to conversation

send ack for rm_addr and cleanups

PATCH In review Geliang Tang 3 participants 10 messages Mar 16, 2021 – Mar 18, 2021

Subsystems (2)
lore
Share & tools
lore

Geliang Tang

author
#0 lore raw

v2 cover send ack for rm_addr and cleanups

v2:
- add patch 1 and patch 3.
- update the debug output in patch 2.
- tag: export/20210315T064655.

Note:
- Please insert this patchset between the commit "mptcp: move to next
addr when subflow creation fail" and the commit "selftests: mptcp: signal addresses testcases" when merging it.

Geliang Tang (3):
mptcp: drop useless addr_signal clear
mptcp: send ack for rm_addr
mptcp: rename mptcp_pm_nl_add_addr_send_ack

 net/mptcp/pm.c         |  1 +
 net/mptcp/pm_netlink.c | 24 ++++++++----------------
 net/mptcp/protocol.h   |  1 +
 3 files changed, 10 insertions(+), 16 deletions(-)
Signature · 1 line
2.30.2
author
#1 lore raw

PATCH v2 1/3 mptcp: drop useless addr_signal clear

msk->pm.addr_signal is cleared in mptcp_pm_add_addr_signal, no need to clear it in mptcp_pm_nl_add_addr_send_ack again. Drop it.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm_netlink.c | 8 --------
 1 file changed, 8 deletions(-)
net/mptcp/pm_netlink.c +0 -8
index f9606934104d..cd99f6b9df93 100644
@@ -538,7 +538,6 @@ static void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
 	subflow = list_first_entry_or_null(&msk->conn_list, typeof(*subflow), node);
 	if (subflow) {
 		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
-		u8 add_addr;
 
 		spin_unlock_bh(&msk->pm.lock);
 		pr_debug("send ack for add_addr%s%s",
@@ -549,13 +548,6 @@ static void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
 		tcp_send_ack(ssk);
 		release_sock(ssk);
 		spin_lock_bh(&msk->pm.lock);
-
-		add_addr = READ_ONCE(msk->pm.addr_signal);
-		if (mptcp_pm_should_add_signal_ipv6(msk))
-			add_addr &= ~BIT(MPTCP_ADD_ADDR_IPV6);
-		if (mptcp_pm_should_add_signal_port(msk))
-			add_addr &= ~BIT(MPTCP_ADD_ADDR_PORT);
-		WRITE_ONCE(msk->pm.addr_signal, add_addr);
 	}
 }
 
Signature · 1 line
2.30.2
author
#2 lore raw

PATCH v2 2/3 mptcp: send ack for rm_addr

This patch changes the sending ACK conditions for the ADD_ADDR, send an ACK packet for RM_ADDR too.

In mptcp_pm_remove_addr, invoke mptcp_pm_nl_add_addr_send_ack to send the ACK packet.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm.c         |  1 +
 net/mptcp/pm_netlink.c | 10 +++++-----
 net/mptcp/protocol.h   |  1 +
 3 files changed, 7 insertions(+), 5 deletions(-)
net/mptcp/pm.c +1 -0
index 966942d1013f..efa7deb96139 100644
@@ -53,6 +53,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_
 	msk->pm.rm_list_tx = *rm_list;
 	rm_addr |= BIT(MPTCP_RM_ADDR_SIGNAL);
 	WRITE_ONCE(msk->pm.addr_signal, rm_addr);
+	mptcp_pm_nl_add_addr_send_ack(msk);
 	return 0;
 }
 
net/mptcp/pm_netlink.c +5 -5
index cd99f6b9df93..eab8014179d1 100644
@@ -56,8 +56,6 @@ struct pm_nl_pernet {
 #define MPTCP_PM_ADDR_MAX	8
 #define ADD_ADDR_RETRANS_MAX	3
 
-static void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk);
-
 static bool addresses_equal(const struct mptcp_addr_info *a,
 			    struct mptcp_addr_info *b, bool use_port)
 {
@@ -524,14 +522,15 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 	mptcp_pm_nl_add_addr_send_ack(msk);
 }
 
-static void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
+void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
 {
 	struct mptcp_subflow_context *subflow;
 
 	msk_owned_by_me(msk);
 	lockdep_assert_held(&msk->pm.lock);
 
-	if (!mptcp_pm_should_add_signal(msk))
+	if (!mptcp_pm_should_add_signal(msk) &&
+	    !mptcp_pm_should_rm_signal(msk))
 		return;
 
 	__mptcp_flush_join_list(msk);
@@ -540,7 +539,8 @@ static void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
 		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
 
 		spin_unlock_bh(&msk->pm.lock);
-		pr_debug("send ack for add_addr%s%s",
+		pr_debug("send ack for %s%s%s",
+			 mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr",
 			 mptcp_pm_should_add_signal_ipv6(msk) ? " [ipv6]" : "",
 			 mptcp_pm_should_add_signal_port(msk) ? " [port]" : "");
 
net/mptcp/protocol.h +1 -0
index a0e301ae56b0..34fddb1fcd1e 100644
@@ -667,6 +667,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
 			      struct mptcp_addr_info *addr);
 void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
+void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
 			       const struct mptcp_rm_list *rm_list);
 void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
Signature · 1 line
2.30.2
author
#3 lore raw

PATCH v2 3/3 mptcp: rename mptcp_pm_nl_add_addr_send_ack

Since mptcp_pm_nl_add_addr_send_ack is now used for both ADD_ADDR and RM_ADDR cases, rename it to mptcp_pm_nl_addr_send_ack.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm.c         | 2 +-
 net/mptcp/pm_netlink.c | 8 ++++----
 net/mptcp/protocol.h   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
net/mptcp/pm.c +1 -1
index efa7deb96139..9d00fa6d22e9 100644
@@ -53,7 +53,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_
 	msk->pm.rm_list_tx = *rm_list;
 	rm_addr |= BIT(MPTCP_RM_ADDR_SIGNAL);
 	WRITE_ONCE(msk->pm.addr_signal, rm_addr);
-	mptcp_pm_nl_add_addr_send_ack(msk);
+	mptcp_pm_nl_addr_send_ack(msk);
 	return 0;
 }
 
net/mptcp/pm_netlink.c +4 -4
index eab8014179d1..a62f887c5198 100644
@@ -437,7 +437,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 			if (mptcp_pm_alloc_anno_list(msk, local)) {
 				msk->pm.add_addr_signaled++;
 				mptcp_pm_announce_addr(msk, &local->addr, false);
-				mptcp_pm_nl_add_addr_send_ack(msk);
+				mptcp_pm_nl_addr_send_ack(msk);
 			}
 		} else {
 			/* pick failed, avoid fourther attempts later */
@@ -519,10 +519,10 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 
 add_addr_echo:
 	mptcp_pm_announce_addr(msk, &msk->pm.remote, true);
-	mptcp_pm_nl_add_addr_send_ack(msk);
+	mptcp_pm_nl_addr_send_ack(msk);
 }
 
-void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
+void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk)
 {
 	struct mptcp_subflow_context *subflow;
 
@@ -663,7 +663,7 @@ void mptcp_pm_nl_work(struct mptcp_sock *msk)
 	}
 	if (pm->status & BIT(MPTCP_PM_ADD_ADDR_SEND_ACK)) {
 		pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_SEND_ACK);
-		mptcp_pm_nl_add_addr_send_ack(msk);
+		mptcp_pm_nl_addr_send_ack(msk);
 	}
 	if (pm->status & BIT(MPTCP_PM_RM_ADDR_RECEIVED)) {
 		pm->status &= ~BIT(MPTCP_PM_RM_ADDR_RECEIVED);
net/mptcp/protocol.h +1 -1
index 34fddb1fcd1e..e53a9568d587 100644
@@ -667,7 +667,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
 			      struct mptcp_addr_info *addr);
 void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
-void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk);
+void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
 			       const struct mptcp_rm_list *rm_list);
 void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
Signature · 1 line
2.30.2
#4 lore raw

[MPTCP] Re: [MPTCP][PATCH v2 mptcp-next 2/3] mptcp: send ack for rm_addr

In reply to Geliang Tang
Quoted 6 lines · Geliang Tang

This patch changes the sending ACK conditions for the ADD_ADDR, send an ACK packet for RM_ADDR too.

In mptcp_pm_remove_addr, invoke mptcp_pm_nl_add_addr_send_ack to send the ACK packet.

Quoted 7 lines
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>

---

net/mptcp/pm.c         |  1 +
net/mptcp/pm_netlink.c | 10 +++++-----
net/mptcp/protocol.h   |  1 +
3 files changed, 7 insertions(+), 5 deletions(-)

Thanks for the v2 update!

The code looked ok on visual inspection, but I ran in to problems with mptcp_join.sh tests (looks like the "remove id 0 address" test that triggers it):

[  286.809888] =====================================
[  286.810818] WARNING: bad unlock balance detected!
[  286.811921] 5.12.0-rc2+ #5 Tainted: G        W
[  286.813119] -------------------------------------
[  286.814218] pm_nl_ctl/3445 is trying to release lock (&msk->pm.lock) 
at:
[  286.815822] [<ffffffffa5ede78b>] mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.816979] but there are no more locks to release!
[  286.817795]
[  286.817795] other info that might help us debug this:
[  286.818874] 3 locks held by pm_nl_ctl/3445:
[  286.819598]  #0: ffffffffa7514770 (cb_lock){++++}-{3:3}, at: 
genl_rcv+0x10/0x30
[  286.820982]  #1: ffffffffa7514828 (genl_mutex){+.+.}-{3:3}, at: 
genl_rcv_msg+0x1f5/0x2c0
[  286.822520]  #2: ffff888104840120 (sk_lock-AF_INET){+.+.}-{0:0}, at: 
mptcp_nl_remove_id_zero_address+0x10f/0x280
[  286.824648]
[  286.824648] stack backtrace:
[  286.825355] CPU: 1 PID: 3445 Comm: pm_nl_ctl Tainted: G        W 
5.12.0-rc2+ #5
[  286.826666] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
1.14.0-1.fc33 04/01/2014
[  286.828234] Call Trace:
[  286.828688]  dump_stack+0x93/0xc2
[  286.829296]  lock_release.cold+0x10/0x4e
[  286.830000]  ? mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.830833]  ? lock_downgrade+0x390/0x390
[  286.831553]  ? __mptcp_flush_join_list+0x20/0x180
[  286.832480]  _raw_spin_unlock_bh+0x12/0x30
[  286.833409]  mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.834453]  mptcp_pm_remove_addr+0x7a/0xb0
[  286.835203]  mptcp_nl_remove_id_zero_address+0x11f/0x280
[  286.836204]  ? lookup_subflow_by_saddr+0x1a0/0x1a0
[  286.837116]  ? mptcp_nl_fill_addr+0x320/0x320
[  286.837848]  ? lock_release+0x1d0/0x400
[  286.838565]  ? lock_release+0x1d0/0x400
[  286.839302]  mptcp_nl_cmd_del_addr+0x497/0x5e0
[  286.840130]  ? mptcp_pm_remove_anno_addr.isra.0+0x180/0x180
[  286.841165]  ? nla_get_range_signed+0x1c0/0x1c0
[  286.842053]  ? lock_is_held_type+0x98/0x110
[  286.842820]  ? __nla_parse+0x22/0x30
[  286.843503]  ? genl_family_rcv_msg_attrs_parse.constprop.0+0xd1/0x130
[  286.844739]  genl_family_rcv_msg_doit+0x17a/0x200
[  286.845641]  ? genl_family_rcv_msg_attrs_parse.constprop.0+0x130/0x130
[  286.847167]  ? security_capable+0x48/0x60
[  286.848086]  genl_rcv_msg+0x18d/0x2c0
[  286.848873]  ? genl_get_cmd+0x1b0/0x1b0
[  286.849780]  ? genl_rcv+0x10/0x30
[  286.850730]  ? mptcp_pm_remove_anno_addr.isra.0+0x180/0x180
[  286.852074]  ? netlink_deliver_tap+0xa6/0x570
[  286.852801]  netlink_rcv_skb+0xc4/0x1f0
[  286.853434]  ? find_held_lock+0x85/0xa0
[  286.854074]  ? genl_get_cmd+0x1b0/0x1b0
[  286.854713]  ? netlink_ack+0x4f0/0x4f0
[  286.855336]  genl_rcv+0x1f/0x30
[  286.855863]  netlink_unicast+0x2d3/0x410
[  286.856516]  ? netlink_attachskb+0x400/0x400
[  286.857219]  ? _copy_from_iter_full+0xd8/0x360
[  286.857986]  netlink_sendmsg+0x394/0x670
[  286.858644]  ? netlink_unicast+0x410/0x410
[  286.859343]  ? netlink_unicast+0x410/0x410
[  286.860256]  sock_sendmsg+0x91/0xa0
[  286.861032]  __sys_sendto+0x16e/0x210
[  286.861881]  ? __ia32_sys_getpeername+0x40/0x40
[  286.862902]  ? handle_mm_fault+0x103/0x270
[  286.863807]  ? do_user_addr_fault+0x3f0/0x950
[  286.864781]  ? trace_page_fault_kernel+0x110/0x110
[  286.865862]  ? mark_held_locks+0x24/0x90
[  286.866777]  __x64_sys_sendto+0x6f/0x80
[  286.867621]  do_syscall_64+0x33/0x40
[  286.868504]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  286.869788] RIP: 0033:0x7f1279a1014a
[  286.870857] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 
1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 
<48> 3d 00 f0 ff ff 77 76 c3 0f 1f 44 00 00 55 48 83 ec 30 44 89 4c
[  286.875110] RSP: 002b:00007ffe1a791af8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[  286.876758] RAX: ffffffffffffffda RBX: 00007ffe1a791b40 RCX: 00007f1279a1014a
[  286.878317] RDX: 0000000000000030 RSI: 00007ffe1a791b40 RDI: 0000000000000003
[  286.879885] RBP: 0000000000000030 R08: 00007ffe1a791b04 R09: 000000000000000c
[  286.881537] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[  286.883189] R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000000

--
Mat Martineau
Intel

author
#5 lore raw

[MPTCP] Re: [MPTCP][PATCH v2 mptcp-next 2/3] mptcp: send ack for rm_addr

Hi Mat,

Quoted 17 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年3月17日周三 上午8:31写道:
Quoted 6 lines · Geliang Tang

This patch changes the sending ACK conditions for the ADD_ADDR, send an ACK packet for RM_ADDR too.

In mptcp_pm_remove_addr, invoke mptcp_pm_nl_add_addr_send_ack to send the ACK packet.

Quoted 7 lines
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>

---

net/mptcp/pm.c         |  1 +
net/mptcp/pm_netlink.c | 10 +++++-----
net/mptcp/protocol.h   |  1 +
3 files changed, 7 insertions(+), 5 deletions(-)
Quoted 5 lines

Thanks for the v2 update!

The code looked ok on visual inspection, but I ran in to problems with mptcp_join.sh tests (looks like the "remove id 0 address" test that triggers it):

Did you apply the patch (Squash to "mptcp: remove id 0 address") before applying this patch set? We need to apply the squash-to patch first.

I didn't get this "bad unlock balance" warning on my test, could you please share your kconfig file to me?

Thanks.

-Geliang

Quoted 88 lines
[  286.809888] =====================================
[  286.810818] WARNING: bad unlock balance detected!
[  286.811921] 5.12.0-rc2+ #5 Tainted: G        W
[  286.813119] -------------------------------------
[  286.814218] pm_nl_ctl/3445 is trying to release lock (&msk->pm.lock)
at:
[  286.815822] [<ffffffffa5ede78b>] mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.816979] but there are no more locks to release!
[  286.817795]
[  286.817795] other info that might help us debug this:
[  286.818874] 3 locks held by pm_nl_ctl/3445:
[  286.819598]  #0: ffffffffa7514770 (cb_lock){++++}-{3:3}, at:
genl_rcv+0x10/0x30
[  286.820982]  #1: ffffffffa7514828 (genl_mutex){+.+.}-{3:3}, at:
genl_rcv_msg+0x1f5/0x2c0
[  286.822520]  #2: ffff888104840120 (sk_lock-AF_INET){+.+.}-{0:0}, at:
mptcp_nl_remove_id_zero_address+0x10f/0x280
[  286.824648]
[  286.824648] stack backtrace:
[  286.825355] CPU: 1 PID: 3445 Comm: pm_nl_ctl Tainted: G        W
5.12.0-rc2+ #5
[  286.826666] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.14.0-1.fc33 04/01/2014
[  286.828234] Call Trace:
[  286.828688]  dump_stack+0x93/0xc2
[  286.829296]  lock_release.cold+0x10/0x4e
[  286.830000]  ? mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.830833]  ? lock_downgrade+0x390/0x390
[  286.831553]  ? __mptcp_flush_join_list+0x20/0x180
[  286.832480]  _raw_spin_unlock_bh+0x12/0x30
[  286.833409]  mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.834453]  mptcp_pm_remove_addr+0x7a/0xb0
[  286.835203]  mptcp_nl_remove_id_zero_address+0x11f/0x280
[  286.836204]  ? lookup_subflow_by_saddr+0x1a0/0x1a0
[  286.837116]  ? mptcp_nl_fill_addr+0x320/0x320
[  286.837848]  ? lock_release+0x1d0/0x400
[  286.838565]  ? lock_release+0x1d0/0x400
[  286.839302]  mptcp_nl_cmd_del_addr+0x497/0x5e0
[  286.840130]  ? mptcp_pm_remove_anno_addr.isra.0+0x180/0x180
[  286.841165]  ? nla_get_range_signed+0x1c0/0x1c0
[  286.842053]  ? lock_is_held_type+0x98/0x110
[  286.842820]  ? __nla_parse+0x22/0x30
[  286.843503]  ? genl_family_rcv_msg_attrs_parse.constprop.0+0xd1/0x130
[  286.844739]  genl_family_rcv_msg_doit+0x17a/0x200
[  286.845641]  ? genl_family_rcv_msg_attrs_parse.constprop.0+0x130/0x130
[  286.847167]  ? security_capable+0x48/0x60
[  286.848086]  genl_rcv_msg+0x18d/0x2c0
[  286.848873]  ? genl_get_cmd+0x1b0/0x1b0
[  286.849780]  ? genl_rcv+0x10/0x30
[  286.850730]  ? mptcp_pm_remove_anno_addr.isra.0+0x180/0x180
[  286.852074]  ? netlink_deliver_tap+0xa6/0x570
[  286.852801]  netlink_rcv_skb+0xc4/0x1f0
[  286.853434]  ? find_held_lock+0x85/0xa0
[  286.854074]  ? genl_get_cmd+0x1b0/0x1b0
[  286.854713]  ? netlink_ack+0x4f0/0x4f0
[  286.855336]  genl_rcv+0x1f/0x30
[  286.855863]  netlink_unicast+0x2d3/0x410
[  286.856516]  ? netlink_attachskb+0x400/0x400
[  286.857219]  ? _copy_from_iter_full+0xd8/0x360
[  286.857986]  netlink_sendmsg+0x394/0x670
[  286.858644]  ? netlink_unicast+0x410/0x410
[  286.859343]  ? netlink_unicast+0x410/0x410
[  286.860256]  sock_sendmsg+0x91/0xa0
[  286.861032]  __sys_sendto+0x16e/0x210
[  286.861881]  ? __ia32_sys_getpeername+0x40/0x40
[  286.862902]  ? handle_mm_fault+0x103/0x270
[  286.863807]  ? do_user_addr_fault+0x3f0/0x950
[  286.864781]  ? trace_page_fault_kernel+0x110/0x110
[  286.865862]  ? mark_held_locks+0x24/0x90
[  286.866777]  __x64_sys_sendto+0x6f/0x80
[  286.867621]  do_syscall_64+0x33/0x40
[  286.868504]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  286.869788] RIP: 0033:0x7f1279a1014a
[  286.870857] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f
1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 76 c3 0f 1f 44 00 00 55 48 83 ec 30 44 89 4c
[  286.875110] RSP: 002b:00007ffe1a791af8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[  286.876758] RAX: ffffffffffffffda RBX: 00007ffe1a791b40 RCX: 00007f1279a1014a
[  286.878317] RDX: 0000000000000030 RSI: 00007ffe1a791b40 RDI: 0000000000000003
[  286.879885] RBP: 0000000000000030 R08: 00007ffe1a791b04 R09: 000000000000000c
[  286.881537] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[  286.883189] R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000000

--
Mat Martineau
Intel

#6 lore raw

[MPTCP] Re: [MPTCP][PATCH v2 mptcp-next 2/3] mptcp: send ack for rm_addr

Quoted 26 lines · Geliang Tang

Hi Mat,

Quoted 17 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年3月17日周三 上午8:31写道:
Quoted 6 lines · Geliang Tang

This patch changes the sending ACK conditions for the ADD_ADDR, send an ACK packet for RM_ADDR too.

In mptcp_pm_remove_addr, invoke mptcp_pm_nl_add_addr_send_ack to send the ACK packet.

Quoted 7 lines
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>

---

net/mptcp/pm.c         |  1 +
net/mptcp/pm_netlink.c | 10 +++++-----
net/mptcp/protocol.h   |  1 +
3 files changed, 7 insertions(+), 5 deletions(-)
Quoted 5 lines

Thanks for the v2 update!

The code looked ok on visual inspection, but I ran in to problems with mptcp_join.sh tests (looks like the "remove id 0 address" test that triggers it):

Quoted 6 lines

Did you apply the patch (Squash to "mptcp: remove id 0 address") before applying this patch set? We need to apply the squash-to patch first.

I didn't get this "bad unlock balance" warning on my test, could you please share your kconfig file to me?

You're right, I was testing the patch sets in separate branches. I rebased on the current export branch with the locking fix squashed and I'm not seeing the crash.

Mat

Quoted 85 lines
Quoted 85 lines
[  286.809888] =====================================
[  286.810818] WARNING: bad unlock balance detected!
[  286.811921] 5.12.0-rc2+ #5 Tainted: G        W
[  286.813119] -------------------------------------
[  286.814218] pm_nl_ctl/3445 is trying to release lock (&msk->pm.lock)
at:
[  286.815822] [<ffffffffa5ede78b>] mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.816979] but there are no more locks to release!
[  286.817795]
[  286.817795] other info that might help us debug this:
[  286.818874] 3 locks held by pm_nl_ctl/3445:
[  286.819598]  #0: ffffffffa7514770 (cb_lock){++++}-{3:3}, at:
genl_rcv+0x10/0x30
[  286.820982]  #1: ffffffffa7514828 (genl_mutex){+.+.}-{3:3}, at:
genl_rcv_msg+0x1f5/0x2c0
[  286.822520]  #2: ffff888104840120 (sk_lock-AF_INET){+.+.}-{0:0}, at:
mptcp_nl_remove_id_zero_address+0x10f/0x280
[  286.824648]
[  286.824648] stack backtrace:
[  286.825355] CPU: 1 PID: 3445 Comm: pm_nl_ctl Tainted: G        W
5.12.0-rc2+ #5
[  286.826666] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.14.0-1.fc33 04/01/2014
[  286.828234] Call Trace:
[  286.828688]  dump_stack+0x93/0xc2
[  286.829296]  lock_release.cold+0x10/0x4e
[  286.830000]  ? mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.830833]  ? lock_downgrade+0x390/0x390
[  286.831553]  ? __mptcp_flush_join_list+0x20/0x180
[  286.832480]  _raw_spin_unlock_bh+0x12/0x30
[  286.833409]  mptcp_pm_nl_addr_send_ack+0xab/0x1a0
[  286.834453]  mptcp_pm_remove_addr+0x7a/0xb0
[  286.835203]  mptcp_nl_remove_id_zero_address+0x11f/0x280
[  286.836204]  ? lookup_subflow_by_saddr+0x1a0/0x1a0
[  286.837116]  ? mptcp_nl_fill_addr+0x320/0x320
[  286.837848]  ? lock_release+0x1d0/0x400
[  286.838565]  ? lock_release+0x1d0/0x400
[  286.839302]  mptcp_nl_cmd_del_addr+0x497/0x5e0
[  286.840130]  ? mptcp_pm_remove_anno_addr.isra.0+0x180/0x180
[  286.841165]  ? nla_get_range_signed+0x1c0/0x1c0
[  286.842053]  ? lock_is_held_type+0x98/0x110
[  286.842820]  ? __nla_parse+0x22/0x30
[  286.843503]  ? genl_family_rcv_msg_attrs_parse.constprop.0+0xd1/0x130
[  286.844739]  genl_family_rcv_msg_doit+0x17a/0x200
[  286.845641]  ? genl_family_rcv_msg_attrs_parse.constprop.0+0x130/0x130
[  286.847167]  ? security_capable+0x48/0x60
[  286.848086]  genl_rcv_msg+0x18d/0x2c0
[  286.848873]  ? genl_get_cmd+0x1b0/0x1b0
[  286.849780]  ? genl_rcv+0x10/0x30
[  286.850730]  ? mptcp_pm_remove_anno_addr.isra.0+0x180/0x180
[  286.852074]  ? netlink_deliver_tap+0xa6/0x570
[  286.852801]  netlink_rcv_skb+0xc4/0x1f0
[  286.853434]  ? find_held_lock+0x85/0xa0
[  286.854074]  ? genl_get_cmd+0x1b0/0x1b0
[  286.854713]  ? netlink_ack+0x4f0/0x4f0
[  286.855336]  genl_rcv+0x1f/0x30
[  286.855863]  netlink_unicast+0x2d3/0x410
[  286.856516]  ? netlink_attachskb+0x400/0x400
[  286.857219]  ? _copy_from_iter_full+0xd8/0x360
[  286.857986]  netlink_sendmsg+0x394/0x670
[  286.858644]  ? netlink_unicast+0x410/0x410
[  286.859343]  ? netlink_unicast+0x410/0x410
[  286.860256]  sock_sendmsg+0x91/0xa0
[  286.861032]  __sys_sendto+0x16e/0x210
[  286.861881]  ? __ia32_sys_getpeername+0x40/0x40
[  286.862902]  ? handle_mm_fault+0x103/0x270
[  286.863807]  ? do_user_addr_fault+0x3f0/0x950
[  286.864781]  ? trace_page_fault_kernel+0x110/0x110
[  286.865862]  ? mark_held_locks+0x24/0x90
[  286.866777]  __x64_sys_sendto+0x6f/0x80
[  286.867621]  do_syscall_64+0x33/0x40
[  286.868504]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  286.869788] RIP: 0033:0x7f1279a1014a
[  286.870857] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f
1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 76 c3 0f 1f 44 00 00 55 48 83 ec 30 44 89 4c
[  286.875110] RSP: 002b:00007ffe1a791af8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[  286.876758] RAX: ffffffffffffffda RBX: 00007ffe1a791b40 RCX: 00007f1279a1014a
[  286.878317] RDX: 0000000000000030 RSI: 00007ffe1a791b40 RDI: 0000000000000003
[  286.879885] RBP: 0000000000000030 R08: 00007ffe1a791b04 R09: 000000000000000c
[  286.881537] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[  286.883189] R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000000
Quoted 4 lines
Quoted 3 lines

--
Mat Martineau
Intel

--
Mat Martineau
Intel

Reviewed-by on the v2 series
#7 lore raw
In reply to Geliang Tang
Quoted 17 lines · Geliang Tang

v2:
- add patch 1 and patch 3.
- update the debug output in patch 2.
- tag: export/20210315T064655.

Note:
- Please insert this patchset between the commit "mptcp: move to next addr when subflow creation fail" and the commit "selftests: mptcp: signal addresses testcases" when merging it.

Geliang Tang (3):
mptcp: drop useless addr_signal clear
mptcp: send ack for rm_addr
mptcp: rename mptcp_pm_nl_add_addr_send_ack

Quoted 7 lines
net/mptcp/pm.c         |  1 +
net/mptcp/pm_netlink.c | 24 ++++++++----------------
net/mptcp/protocol.h   |  1 +
3 files changed, 10 insertions(+), 16 deletions(-)
Signature · 1 line
2.30.2

Geliang -

Thanks for pointing out the dependency I missed when testing. Patch set looks good for the export branch.

Reviewed-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

--
Mat Martineau
Intel

author
#8 lore raw

Hi Matt,

Quoted 28 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年3月18日周四 上午8:09写道:
Quoted 17 lines · Geliang Tang

v2:
- add patch 1 and patch 3.
- update the debug output in patch 2.
- tag: export/20210315T064655.

Note:
- Please insert this patchset between the commit "mptcp: move to next addr when subflow creation fail" and the commit "selftests: mptcp: signal addresses testcases" when merging it.

Geliang Tang (3):
mptcp: drop useless addr_signal clear
mptcp: send ack for rm_addr
mptcp: rename mptcp_pm_nl_add_addr_send_ack

Quoted 7 lines
net/mptcp/pm.c         |  1 +
net/mptcp/pm_netlink.c | 24 ++++++++----------------
net/mptcp/protocol.h   |  1 +
3 files changed, 10 insertions(+), 16 deletions(-)

--
2.30.2

Quoted 6 lines

Geliang -

Thanks for pointing out the dependency I missed when testing. Patch set looks good for the export branch.

Reviewed-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

Please insert this patchset between the commit "mptcp: move to next addr when subflow creation fail" and the commit "selftests: mptcp: signal addresses testcases" when merging it into the export branch.

Thanks.

-Geliang

Quoted 4 lines

--
Mat Martineau
Intel

#9 lore raw

Hi Geliang, Mat,

Quoted 33 lines · Geliang Tang

Hi Matt,

Quoted 30 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年3月18日周四 上午8:09写道:
Quoted 17 lines · Geliang Tang

v2:
- add patch 1 and patch 3.
- update the debug output in patch 2.
- tag: export/20210315T064655.

Note:
- Please insert this patchset between the commit "mptcp: move to next addr when subflow creation fail" and the commit "selftests: mptcp: signal addresses testcases" when merging it.

Geliang Tang (3):
mptcp: drop useless addr_signal clear
mptcp: send ack for rm_addr
mptcp: rename mptcp_pm_nl_add_addr_send_ack

Quoted 7 lines
net/mptcp/pm.c         |  1 +
net/mptcp/pm_netlink.c | 24 ++++++++----------------
net/mptcp/protocol.h   |  1 +
3 files changed, 10 insertions(+), 16 deletions(-)

--
2.30.2

Geliang -

Quoted 8 lines
Quoted 4 lines

Thanks for pointing out the dependency I missed when testing. Patch set looks good for the export branch.

Reviewed-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

Please insert this patchset between the commit "mptcp: move to next addr when subflow creation fail" and the commit "selftests: mptcp: signal addresses testcases" when merging it into the export branch.

Thank you for the patch, the review and the reminder!

Now in our tree with Mat's RvB tag and placed before "selftests: mptcp:
signal addresses testcases":

- 66d562873299: mptcp: drop useless addr_signal clear
- 8c3e5d0c47d0: mptcp: send ack for rm_addr
- 1790775f4e49: mptcp: rename mptcp_pm_nl_add_addr_send_ack
- Results: 1a2847789704..c11e1a8e9572

Tests + export are in progress!

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net