netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net] af_unix: remove redundant lockdep class
@ 2018-04-02 18:01 Cong Wang
  2018-04-03  9:07 ` Paolo Abeni
  2018-04-04 15:14 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2018-04-02 18:01 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Paolo Abeni

After commit 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
sock queue locks now have per-af lockdep classes, including unix socket.
It is no longer necessary to workaround it.

I noticed this while looking at a syzbot deadlock report, this patch
itself doesn't fix it (this is why I don't add Reported-by).

Fixes: 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
Cc: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/unix/af_unix.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2d465bdeccbc..45971e173924 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -745,14 +745,6 @@ static struct proto unix_proto = {
 	.obj_size		= sizeof(struct unix_sock),
 };
 
-/*
- * AF_UNIX sockets do not interact with hardware, hence they
- * dont trigger interrupts - so it's safe for them to have
- * bh-unsafe locking for their sk_receive_queue.lock. Split off
- * this special lock-class by reinitializing the spinlock key:
- */
-static struct lock_class_key af_unix_sk_receive_queue_lock_key;
-
 static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 {
 	struct sock *sk = NULL;
@@ -767,8 +759,6 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 		goto out;
 
 	sock_init_data(sock, sk);
-	lockdep_set_class(&sk->sk_receive_queue.lock,
-				&af_unix_sk_receive_queue_lock_key);
 
 	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
 	sk->sk_write_space	= unix_write_space;
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch net] af_unix: remove redundant lockdep class
  2018-04-02 18:01 [Patch net] af_unix: remove redundant lockdep class Cong Wang
@ 2018-04-03  9:07 ` Paolo Abeni
  2018-04-04 15:14 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2018-04-03  9:07 UTC (permalink / raw)
  To: Cong Wang, netdev

On Mon, 2018-04-02 at 11:01 -0700, Cong Wang wrote:
> After commit 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
> sock queue locks now have per-af lockdep classes, including unix socket.
> It is no longer necessary to workaround it.
> 
> I noticed this while looking at a syzbot deadlock report, this patch
> itself doesn't fix it (this is why I don't add Reported-by).
> 
> Fixes: 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
> Cc: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
>  net/unix/af_unix.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 2d465bdeccbc..45971e173924 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -745,14 +745,6 @@ static struct proto unix_proto = {
>  	.obj_size		= sizeof(struct unix_sock),
>  };
>  
> -/*
> - * AF_UNIX sockets do not interact with hardware, hence they
> - * dont trigger interrupts - so it's safe for them to have
> - * bh-unsafe locking for their sk_receive_queue.lock. Split off
> - * this special lock-class by reinitializing the spinlock key:
> - */
> -static struct lock_class_key af_unix_sk_receive_queue_lock_key;
> -
>  static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
>  {
>  	struct sock *sk = NULL;
> @@ -767,8 +759,6 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
>  		goto out;
>  
>  	sock_init_data(sock, sk);
> -	lockdep_set_class(&sk->sk_receive_queue.lock,
> -				&af_unix_sk_receive_queue_lock_key);
>  
>  	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
>  	sk->sk_write_space	= unix_write_space;

LGTM

Acked-by: Paolo Abeni <pabeni@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch net] af_unix: remove redundant lockdep class
  2018-04-02 18:01 [Patch net] af_unix: remove redundant lockdep class Cong Wang
  2018-04-03  9:07 ` Paolo Abeni
@ 2018-04-04 15:14 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-04-04 15:14 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, pabeni

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon,  2 Apr 2018 11:01:27 -0700

> After commit 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
> sock queue locks now have per-af lockdep classes, including unix socket.
> It is no longer necessary to workaround it.
> 
> I noticed this while looking at a syzbot deadlock report, this patch
> itself doesn't fix it (this is why I don't add Reported-by).
> 
> Fixes: 581319c58600 ("net/socket: use per af lockdep classes for sk queues")
> Cc: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thanks Cong.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-04 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-02 18:01 [Patch net] af_unix: remove redundant lockdep class Cong Wang
2018-04-03  9:07 ` Paolo Abeni
2018-04-04 15:14 ` David Miller

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).