netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, akpm@osdl.org, mingo@elte.hu,
	gandalf@wlug.westbo.se
Subject: Re: [PATCH] lockdep: fix sk->sk_callback_lock locking
Date: Wed, 29 Nov 2006 12:42:24 +0100	[thread overview]
Message-ID: <1164800544.6588.118.camel@twins> (raw)
In-Reply-To: <E1GpKC4-0005Vc-00@gondolin.me.apana.org.au>

On Wed, 2006-11-29 at 18:49 +1100, Herbert Xu wrote:
> Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > 
> > =========================================================
> > [ INFO: possible irq lock inversion dependency detected ]
> > 2.6.19-rc6 #4
> > ---------------------------------------------------------
> > nc/1854 just changed the state of lock:
> > (af_callback_keys + sk->sk_family#2){-.-?}, at: [<c0268a7f>] sock_def_error_report+0x1f/0x90
> > but this lock was taken by another, soft-irq-safe lock in the past:
> > (slock-AF_INET){-+..}
> > 
> > and interrupts could create inverse lock ordering between them.
> 
> I think this is bogus.  The slock is not a standard lock.  When we
> hold it in process context we don't actually hold the spin lock part
> of it.  However, it does prevent the softirq path from running in
> critical sections which also prevents any attempt to grab the
> callback lock from softirq context.
> 
> If you still think there is a problem, please show an actual scenario
> where it dead locks.

process context does lock_sock(sk) which is basically a sleeping lock
and sets an owner field when acquired.

BH context does bh_lock_sock(sk); which spins on the spinlock protecting
the owner field; and checks for an owner under this lock. When an owner
is found it will stick the skb on a queue for later processing.

This scheme does indeed seem to avoid the reported deadlock scenario -
although I didn't audit all code paths.

However I'm not quite sure yet how to teach lockdep about this. The
proposed patch will shut it up though.


  parent reply	other threads:[~2006-11-29 11:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1164547971.30244.22.camel@localhost.localdomain>
     [not found] ` <1164635760.6588.27.camel@twins>
     [not found]   ` <1164660685.30244.36.camel@localhost.localdomain>
2006-11-28 12:07     ` [PATCH] lockdep: fix sk->sk_callback_lock locking Peter Zijlstra
2006-11-29  7:49       ` Herbert Xu
2006-11-29  8:44         ` Jarek Poplawski
2006-11-29 11:42         ` Peter Zijlstra [this message]
2006-11-29 12:07           ` Herbert Xu
2006-11-29 20:06             ` David Miller

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=1164800544.6588.118.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=gandalf@wlug.westbo.se \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    /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 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).