* [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization
@ 2024-05-26 14:57 Gou Hao
2024-05-26 14:57 ` [PATCH 2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common() Gou Hao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gou Hao @ 2024-05-26 14:57 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, kuniyu, wuyun.abel, leitao,
alexander, dhowells, netdev
Cc: linux-kernel, zhanjun, gouhaojake
sk_callback_lock has already been initialized in sk_init_common().
Signed-off-by: Gou Hao <gouhao@uniontech.com>
---
net/core/sock.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 8629f9aecf91..67b10954e0cf 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3460,7 +3460,6 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
}
sk->sk_uid = uid;
- rwlock_init(&sk->sk_callback_lock);
if (sk->sk_kern_sock)
lockdep_set_class_and_name(
&sk->sk_callback_lock,
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common()
2024-05-26 14:57 [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Gou Hao
@ 2024-05-26 14:57 ` Gou Hao
2024-05-28 8:00 ` [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Breno Leitao
2024-05-28 12:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Gou Hao @ 2024-05-26 14:57 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, kuniyu, wuyun.abel, leitao,
alexander, dhowells, netdev
Cc: linux-kernel, zhanjun, gouhaojake
In commit cdfbabfb2f0c ("net: Work around lockdep limitation in
sockets that use sockets"), it introduces 'af_kern_callback_keys'
to lockdep-init of sk_callback_lock according to 'sk_kern_sock',
it modifies sock_init_data() only, and sk_clone_lock() calls
sk_init_common() to initialize sk_callback_lock too, so the
lockdep-init of sk_callback_lock should be moved to sk_init_common().
Signed-off-by: Gou Hao <gouhao@uniontech.com>
---
net/core/sock.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 67b10954e0cf..521e6373d4f7 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2262,7 +2262,12 @@ static void sk_init_common(struct sock *sk)
lockdep_set_class_and_name(&sk->sk_error_queue.lock,
af_elock_keys + sk->sk_family,
af_family_elock_key_strings[sk->sk_family]);
- lockdep_set_class_and_name(&sk->sk_callback_lock,
+ if (sk->sk_kern_sock)
+ lockdep_set_class_and_name(&sk->sk_callback_lock,
+ af_kern_callback_keys + sk->sk_family,
+ af_family_kern_clock_key_strings[sk->sk_family]);
+ else
+ lockdep_set_class_and_name(&sk->sk_callback_lock,
af_callback_keys + sk->sk_family,
af_family_clock_key_strings[sk->sk_family]);
}
@@ -3460,17 +3465,6 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
}
sk->sk_uid = uid;
- if (sk->sk_kern_sock)
- lockdep_set_class_and_name(
- &sk->sk_callback_lock,
- af_kern_callback_keys + sk->sk_family,
- af_family_kern_clock_key_strings[sk->sk_family]);
- else
- lockdep_set_class_and_name(
- &sk->sk_callback_lock,
- af_callback_keys + sk->sk_family,
- af_family_clock_key_strings[sk->sk_family]);
-
sk->sk_state_change = sock_def_wakeup;
sk->sk_data_ready = sock_def_readable;
sk->sk_write_space = sock_def_write_space;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization
2024-05-26 14:57 [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Gou Hao
2024-05-26 14:57 ` [PATCH 2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common() Gou Hao
@ 2024-05-28 8:00 ` Breno Leitao
2024-05-28 12:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2024-05-28 8:00 UTC (permalink / raw)
To: Gou Hao
Cc: davem, edumazet, kuba, pabeni, kuniyu, wuyun.abel, alexander,
dhowells, netdev, linux-kernel, zhanjun, gouhaojake
On Sun, May 26, 2024 at 10:57:17PM +0800, Gou Hao wrote:
> sk_callback_lock has already been initialized in sk_init_common().
>
> Signed-off-by: Gou Hao <gouhao@uniontech.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization
2024-05-26 14:57 [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Gou Hao
2024-05-26 14:57 ` [PATCH 2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common() Gou Hao
2024-05-28 8:00 ` [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Breno Leitao
@ 2024-05-28 12:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-28 12:00 UTC (permalink / raw)
To: Gou Hao
Cc: davem, edumazet, kuba, pabeni, kuniyu, wuyun.abel, leitao,
alexander, dhowells, netdev, linux-kernel, zhanjun, gouhaojake
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Sun, 26 May 2024 22:57:17 +0800 you wrote:
> sk_callback_lock has already been initialized in sk_init_common().
>
> Signed-off-by: Gou Hao <gouhao@uniontech.com>
> ---
> net/core/sock.c | 1 -
> 1 file changed, 1 deletion(-)
Here is the summary with links:
- [1/2] net/core: remove redundant sk_callback_lock initialization
https://git.kernel.org/netdev/net-next/c/c65b6521115e
- [2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common()
https://git.kernel.org/netdev/net-next/c/de31e96cf423
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-28 12:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-26 14:57 [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Gou Hao
2024-05-26 14:57 ` [PATCH 2/2] net/core: move the lockdep-init of sk_callback_lock to sk_init_common() Gou Hao
2024-05-28 8:00 ` [PATCH 1/2] net/core: remove redundant sk_callback_lock initialization Breno Leitao
2024-05-28 12:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).