All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next 1/2] mptcp: give MPTCP sockets a distinct lockdep class
Date: Thu, 15 Oct 2026 10:59:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-172701@kernel.org> (raw)
In-Reply-To: <23c5f34fa80bff87b4c49981b1ab19d13bf7f136.1792060837.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mptcp: passive sockets miss lockdep reclassification causing warnings
--

commit c0431dba7b7ab62b7e71ad2f4ff94fb4913cc837
Author: Geliang Tang <geliang@kernel.org>

mptcp: give MPTCP sockets a distinct lockdep class

MPTCP sockets and their subflows share the same k-sk_lock-AF_INET
lockdep class. When both are kernel sockets, lockdep flags every path
that holds the MPTCP socket lock and then locks a subflow (setsockopt,
connect, bind, worker send-ack) as "possible recursive locking".

Reclassify the MPTCP socket lock in mptcp_init_sock() to use a distinct
lock class (sk_lock-AF_INET-MPTCP for IPv4, sk_lock-AF_INET6-MPTCP for
IPv6). This approach is similar to nvme-tcp and avoids the need to
reclassify each subflow socket individually.

The implementation is based on nvme_tcp_reclassify_socket() from
drivers/nvme/host/tcp.c.

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 60cbd91be6320..e63896a605953 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -3292,6 +3327,8 @@ static int mptcp_init_sock(struct sock *sk)
>  	sk->sk_sndbuf = READ_ONCE(net->ipv4.sysctl_tcp_wmem[1]);
>  	sk->sk_write_space = sk_stream_write_space;
>  
> +	mptcp_reclassify_socket(sk->sk_socket);
> +
>  	return 0;
>  }

[Severity: Medium]
Since mptcp_init_sock() is only used for active socket creation, are cloned
(passive) connections missing this lockdep reclassification?

When an incoming MPTCP connection is accepted, the socket is cloned:

net/mptcp/protocol.c:mptcp_sk_clone_init() {
	...
	struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC);
	...
	__mptcp_init_sock(nsk);
	...
}

sk_clone_lock() initializes the lockdep class back to the generic AF_INET
default. Because mptcp_reclassify_socket() is never called for these cloned
sockets, will lockdep continue to falsely report recursive locking when an
accepted MPTCP socket and its subflow are locked simultaneously?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1792060837.git.tanggeliang@kylinos.cn?part=1

  reply	other threads:[~2026-10-15 10:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 10:42 [PATCH mptcp-next 0/2] add distinct lockdep class for MPTCP sockets Geliang Tang
2026-10-15 10:42 ` [PATCH mptcp-next 1/2] mptcp: give MPTCP sockets a distinct lockdep class Geliang Tang
2026-10-15 10:59   ` sashiko-bot [this message]
2026-10-15 17:30   ` Matthieu Baerts
2026-10-15 10:42 ` [PATCH mptcp-next 2/2] mptcp: kunit: add sockopt test for subflow socket locking Geliang Tang
2026-10-15 11:48 ` [PATCH mptcp-next 0/2] add distinct lockdep class for MPTCP sockets MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-172701@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.