From patchwork Mon Mar 17 03:29:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 14018612 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D22901FAA for ; Mon, 17 Mar 2025 03:29:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742182179; cv=none; b=S23ormiftcr3A5U1dIDc05iNKImLXMI7jmoDUxUaqJ6mgHYV89JONmMwI/dlS7USBLSRhLnbqjLdFoyJ9lpevWUzzdDAdkxOoN39oa4jKQDFlx+meVO2yEXNOMfOaW/UbcAT2boi7LUMM6Hw2sd8cqTAacOfaMJboCTE04YGuB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742182179; c=relaxed/simple; bh=oT+Q0fCDbskubogdgnUfHfXCKhDMaKyX71+zz177ing=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cwaeYUmsb3zMKUtryE97SqoCliAQUV4tHWMyaFN+1Vh68xJ7/hANcjTvL9gfPy3GJ41gdIw/dWTnjCVremxTzMhWVnie3RyzH+vNmNay1z7sEDf88SZ4UmkJt8J+QRfTZpk/tqNuXibSJBR7WhBNCiUQKL27W112p4Sqx8dAnuU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UxtIPquF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UxtIPquF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E9FCC4CEED; Mon, 17 Mar 2025 03:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742182179; bh=oT+Q0fCDbskubogdgnUfHfXCKhDMaKyX71+zz177ing=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxtIPquFCX0i1cwxQ8PgUX6pv/VCxYOuSILsVVjIS0yFWFtFouAaAVffxht0UvlVp 7lktNL7EZV+SYofXmeNjcDP7YvzntgSlwqoTPFdliD9r9FrOmsbFlqn0l8gj/NkGpZ C18uIMqxYof706FmAY0rNZr1fhdwiEP5+Ju8f4IHd4tgpY3FPzHiqQRu2cRN4d3gcg 6HpXZLXqWAVFB6Gi3VFtpdfkOzYFrH3GlQWPvQsA2FvhaPEOyhenLSt2GZCLAzJbJD vJ9m/UZvP8LGUpUmGX0+ZB76WywiUFmBCx2g2bwyNu/iL4pQpf/Gw+T2UV17urhJtQ aildYGVExc0Tw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v1 1/3] Squash to "mptcp: pm: add subflow_established() interface" Date: Mon, 17 Mar 2025 11:29:27 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang .subflow_established can't be invoked under mptcp pm lock, otherwise this error occurs: TAP version 13 1..1 [ 65.985960][ T10] BUG: sleeping function called from invalid context at net/core/sock.c:3723 [ 65.986336][ T10] in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 10, name: kworker/0:1 [ 65.986630][ T10] preempt_count: 0, expected: 0 [ 65.986964][ T10] RCU nest depth: 1, expected: 0 [ 65.987157][ T10] 5 locks held by kworker/0:1/10: [ 65.987373][ T10] #0: ffff888001134d48 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x7e4/0x16b0 [ 65.987799][ T10] #1: ffffc900000a7d30 ((work_completion)(&msk->work)){+.+.}-{0:0}, at: process_one_work+0xdf9/0x16b0 [ 65.988348][ T10] #2: ffff88800816d818 (sk_lock-AF_INET6){+.+.}-{0:0}, at: mptcp_worker+0x7b/0xad0 [ 65.988806][ T10] #3: ffffffffae584460 (rcu_read_lock){....}-{1:3}, at: __bpf_prog_enter+0x1f/0x170 [ 65.989204][ T10] #4: ffff888011042258 (k-sk_lock-AF_INET6#2){+.+.}-{0:0}, at: mptcp_pm_addr_send_ack+0x31d/0x3b0 [ 65.989583][ T10] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Tainted: G W OE 6.14.0-rc6+ #137 [ 65.989606][ T10] Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE [ 65.989608][ T10] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 65.989609][ T10] Workqueue: events mptcp_worker [ 65.989632][ T10] Call Trace: [ 65.989634][ T10] [ 65.989637][ T10] dump_stack_lvl+0x9e/0xe0 [ 65.989642][ T10] __might_resched+0x35d/0x590 [ 65.989665][ T10] ? __pfx___might_resched+0x10/0x10 [ 65.989676][ T10] __lock_sock_fast+0x2f/0xd0 [ 65.989682][ T10] __mptcp_pm_send_ack+0x72/0x190 [ 65.989684][ T10] ? mptcp_pm_addr_send_ack+0x31d/0x3b0 [ 65.989709][ T10] mptcp_pm_addr_send_ack+0x31d/0x3b0 [ 65.989714][ T10] ? __pfx_mptcp_pm_addr_send_ack+0x10/0x10 [ 65.989719][ T10] ? mptcp_pm_announce_addr+0x2ef/0x410 [ 65.989726][ T10] mptcp_pm_create_subflow_or_signal_addr+0x75a/0xd10 [ 65.989731][ T10] ? hlock_class+0x4e/0x130 [ 65.989739][ T10] ? __pfx_mptcp_pm_create_subflow_or_signal_addr+0x10/0x10 [ 65.989746][ T10] ? __lock_acquire+0xb70/0x1650 [ 65.989762][ T10] ? lock_acquire.part.0+0xed/0x340 [ 65.989766][ T10] ? bpf_prog_66794828a779e50d_mptcp_pm_netlink_subflow_established+0x2e/0x43 [ 65.989775][ T10] ? __pfx_lock_acquire.part.0+0x10/0x10 [ 65.989782][ T10] ? do_raw_spin_lock+0x131/0x270 [ 65.989787][ T10] ? __pfx_do_raw_spin_lock+0x10/0x10 [ 65.989791][ T10] ? lock_acquire+0x31/0xc0 [ 65.989795][ T10] ? bpf_prog_66794828a779e50d_mptcp_pm_netlink_subflow_established+0x2e/0x43 [ 65.989806][ T10] bpf_prog_66794828a779e50d_mptcp_pm_netlink_subflow_established+0x36/0x43 [ 65.989811][ T10] bpf__mptcp_pm_ops_subflow_established+0x47/0xa3 [ 65.989818][ T10] mptcp_pm_worker+0x221/0x4e0 [ 65.989825][ T10] mptcp_worker+0xcd/0xad0 [ 65.989828][ T10] ? __pfx_lock_acquire.part.0+0x10/0x10 [ 65.989833][ T10] ? trace_lock_acquire+0x14e/0x1e0 [ 65.989836][ T10] ? trace_lock_acquire+0x14e/0x1e0 [ 65.989840][ T10] ? __pfx_mptcp_worker+0x10/0x10 [ 65.989845][ T10] ? process_one_work+0xdf9/0x16b0 [ 65.989848][ T10] ? lock_acquire+0x31/0xc0 [ 65.989850][ T10] ? process_one_work+0xdf9/0x16b0 [ 65.989860][ T10] process_one_work+0xe43/0x16b0 [ 65.989875][ T10] ? __pfx_process_one_work+0x10/0x10 [ 65.989888][ T10] ? assign_work+0x16c/0x240 [ 65.989898][ T10] worker_thread+0x593/0xf90 [ 65.989911][ T10] ? __kthread_parkme+0xba/0x1e0 [ 65.989915][ T10] ? __pfx_worker_thread+0x10/0x10 [ 65.989920][ T10] ? __pfx_worker_thread+0x10/0x10 [ 65.989924][ T10] kthread+0x34f/0x5d0 [ 65.989928][ T10] ? __pfx_kthread+0x10/0x10 [ 65.989938][ T10] ? __pfx_kthread+0x10/0x10 [ 65.989943][ T10] ret_from_fork+0x31/0x70 [ 65.989946][ T10] ? __pfx_kthread+0x10/0x10 [ 65.989949][ T10] ret_from_fork_asm+0x1a/0x30 [ 65.989969][ T10] [ 66.432902][ T1536] ip (1536) used greatest stack depth: 23384 bytes left Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 2 ++ net/mptcp/pm_kernel.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index d504f9b31893..38abf15718b9 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -942,7 +942,9 @@ void mptcp_pm_worker(struct mptcp_sock *msk) } if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) { pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED); + spin_unlock_bh(&msk->pm.lock); pm->ops->subflow_established(msk); + spin_lock_bh(&msk->pm.lock); } __mptcp_pm_kernel_worker(msk); diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c index d04dd1cece09..0c78715ed87f 100644 --- a/net/mptcp/pm_kernel.c +++ b/net/mptcp/pm_kernel.c @@ -374,7 +374,9 @@ static void mptcp_pm_kernel_established(struct mptcp_sock *msk) static void mptcp_pm_kernel_subflow_established(struct mptcp_sock *msk) { + spin_lock_bh(&msk->pm.lock); mptcp_pm_create_subflow_or_signal_addr(msk); + spin_unlock_bh(&msk->pm.lock); } /* Fill all the local addresses into the array addrs[], From patchwork Mon Mar 17 03:29:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 14018613 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EA2E1FAA for ; Mon, 17 Mar 2025 03:29:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742182181; cv=none; b=VpZXVcIz1r7ed/9e5BBiPgH7Qx+XHpl3BOEpCAsRm1EGUmbpi/QxdaFNceyL3izNx6rDcCvgR8dlk9LgAC3z6a6tCu3dZjtrg+4erWgbDd2EzUPv/tPDMvC9XO8LjKqJz9huc8W/Z91X9IdSDX30QKK4jR7HGBaS40f3BA9nAeU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742182181; c=relaxed/simple; bh=+BHezsHc1gqy99U6METqoEda3MyfLV9kcSSM37rajjM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XQkvAaieocE3HKYBpvbYX+3nNeWpJvF02p4oBJ7eOvxcAL+DNUdPoyRGaz2OPxq+SisPZdPhYebgeEDwt/D+lbJmiVbpzu3yz1bTE9FrFNSRXuD2W8y71HKHcwJ9s4F10KhL3M0fsytYUYVv75oEg7gOXGTg0gXAOHu4xVCJ1ms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JklmXRPP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JklmXRPP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA761C4CEEC; Mon, 17 Mar 2025 03:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742182181; bh=+BHezsHc1gqy99U6METqoEda3MyfLV9kcSSM37rajjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JklmXRPPYgoGo2spiZc+aXqMHKC51gUlsqPW+pBpCwZoTLcN+JggZwNBIe710UZoT YGqw8gdOYC+756cVm4cVLZAApa9X2YQomt9wyoHw3+8ODJEEBW2iRt5jQTJmQv1hYI hgedbSanvu+Pt/1VWVdT5XTRJjsNw5iRqm1wJmCcp3AROL6n6CtcFzU3TDMmzau0bn tZmiO271R2Rl+fDdEVmFc9GX3LpfvyUhhuOVLrullVyOc53Q3+5e2Vt8DwxuwqX2uP qV2HgxTf2meiJ5Xwv4xvsp7x5zV0oL5VdbPdcPI5oSWv4BIpJQrYo8YpqaoLwbaVIM UTEuXTqXQRPzA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v1 2/3] Squash to "mptcp: pm: add established() interface" Date: Mon, 17 Mar 2025 11:29:28 +0800 Message-ID: <2979f2af3a16e17153a22a2ee6b6dd254a75bd3b.1742181977.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Same as .subflow_established, .established can't be invoked under mptcp pm lock too. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 2 ++ net/mptcp/pm_kernel.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 38abf15718b9..788fbe31a40f 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -938,7 +938,9 @@ void mptcp_pm_worker(struct mptcp_sock *msk) } if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) { pm->status &= ~BIT(MPTCP_PM_ESTABLISHED); + spin_unlock_bh(&msk->pm.lock); pm->ops->established(msk); + spin_lock_bh(&msk->pm.lock); } if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) { pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED); diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c index 0c78715ed87f..f8cac996694c 100644 --- a/net/mptcp/pm_kernel.c +++ b/net/mptcp/pm_kernel.c @@ -369,7 +369,9 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) static void mptcp_pm_kernel_established(struct mptcp_sock *msk) { + spin_lock_bh(&msk->pm.lock); mptcp_pm_create_subflow_or_signal_addr(msk); + spin_unlock_bh(&msk->pm.lock); } static void mptcp_pm_kernel_subflow_established(struct mptcp_sock *msk) From patchwork Mon Mar 17 03:29:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 14018614 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64C5D1FAA for ; Mon, 17 Mar 2025 03:29:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742182183; cv=none; b=etdR7LNjoHF5a1Ei5y9ws1NXgakB5/MrgSv4w3hTRReYLyjUqvrHtUeKe5vnDUpJ80fSSSFLdNj5EAbuVsGBHFoU7yLohvXTjwNEu4QvTtHc1eL7gbyj4CmIeHnK08QRYeMfdRtQGJxQCM21zQvcmGOaVCJ8hGStVWt+VDsHV6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742182183; c=relaxed/simple; bh=Hc8xVr98N62IvQNngfXlT1YA+ksTnniKSgja7hZQ0sg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EUiS+pwC2IazwPbXAzow0Vll0JXWsD9fGsNR60LM3IgyC0dktFcTxJKbjOZtd/T5SRfw5uKHOPEKAdMDk5PAjlvG9dcLEjTfZleB4kda9mtGnhiNv75NJTtw9XEfpLCXEvbVn++gzD6v9a+WEsdSOM3Ychzprw8qMWY/p4En6Po= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qvFtW3hr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qvFtW3hr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A75AFC4CEED; Mon, 17 Mar 2025 03:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742182182; bh=Hc8xVr98N62IvQNngfXlT1YA+ksTnniKSgja7hZQ0sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvFtW3hrHw2gFTsAnMakDSRb6JsHM3beXR7YKDWaLLX/lRTIsqsulKuy0scgDLfwb L0Pv9EEqp+JYR196QnpDF+XJujW+ZmiQe1DBgZuXD74XceYazil5x+G/w3aifouRyk C40yOgkVgwpPJ67jJ3MOaI7/6GUJdHmYXEyruC4tEftstPOkkJeMyTx7VPVr6diJ5Y mOVUePWKBO8q07joaKyu9kDiQrvgFvMZqD6C3oNRLWNJiK/FppSFHzedKXmM6tAXWz nCJjeQAoKhVqHRFeFhVtW+NJ0gcNvt0tLDBb7mg7Z6Al1VxsDOwRYmNir566Tp5CHZ spGmzCRkXNIyQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v1 3/3] Squash to "mptcp: pm: add rm_addr_received() interface" Date: Mon, 17 Mar 2025 11:29:29 +0800 Message-ID: <9bebb11d7b981b9b130a3921ea1764c33fb5fdfc.1742181977.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Shouldn't return here, should give a chance to call __mptcp_pm_kernel_worker(). Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 788fbe31a40f..5ef989abb4c0 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -934,7 +934,7 @@ void mptcp_pm_worker(struct mptcp_sock *msk) pm->status &= ~BIT(MPTCP_PM_RM_ADDR_RECEIVED); spin_unlock_bh(&msk->pm.lock); pm->ops->rm_addr_received(msk); - return; + spin_lock_bh(&msk->pm.lock); } if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) { pm->status &= ~BIT(MPTCP_PM_ESTABLISHED);