From: Ingo Molnar <mingo@elte.hu>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>, linux-kernel@vger.kernel.org
Subject: Re: [lock validator] inet6_destroy_sock(): soft-safe -> soft-unsafe lock dependency
Date: Thu, 2 Feb 2006 14:54:02 +0100 [thread overview]
Message-ID: <20060202135402.GA30251@elte.hu> (raw)
In-Reply-To: <20060202121729.GA18620@gondor.apana.org.au>
* Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Thu, Feb 02, 2006 at 11:54:29AM +0100, Ingo Molnar wrote:
> >
> > hm, i got a new one:
> >
> > ============================================
> > [ BUG: circular locking deadlock detected! ]
> > --------------------------------------------
> > sshd/28997 is trying to acquire lock:
> > (&sk->sk_lock.slock){-+}, at: [<c0c6be28>] packet_rcv+0xbf/0x34b
> >
> > but task is already holding lock:
> > (&dev->xmit_lock){-+}, at: [<c0bb04ec>] qdisc_restart+0x46/0x207
> >
> > which lock already depends on the new lock,
> > which could lead to circular deadlocks!
> >
> > the dependency chain (in reverse order) is:
> > -> #2 (&dev->xmit_lock){-+}: [<c0bb04ec>] qdisc_restart+0x46/0x207
> > -> #1 (&dev->queue_lock){-+}: [<c0b98137>] dev_queue_xmit+0xc3/0x21e
> > -> #0 (&sk->sk_lock.slock){-+}: [<c0c6be28>] packet_rcv+0xbf/0x34b
>
> I believe this is a false positive and I think I can see where it went
> wrong. The dependency between #0 and #1 is the broken premise.
>
> The validator is probably putting all sk_lock's in the same basket.
> That is, it's mixing up the socket locks for TCP, UDP as well as
> AF_PACKET. While it is true that TCP and UDP's sk_lock may sit
> outside queue_lock, AF_PACKET never transmits while holding its
> sk_lock.
you are right, the validator indeed treated all these protocols as one,
so this is a false positive. (there are two slock buckets already,
because there is some natural lock nesting between listen sockets and
ordinary sockets, but otherwise you are right that all net protocols
were indeed treated as one category.)
> So the #0 => #1 dependency shouldn't exist. Can you get the validator
> to print out the reasoning for the #0 => #1 dependency? That should
> clarify the problem.
the slock -> queue_lock dependency was first observed at:
-> (&sk->sk_lock.slock/1){-+}
-> &dev->queue_lock [<c0b98137>] dev_queue_xmit+0xc3/0x21e
so it comes from dev_queue_xmit(). No further information about where
that was done - but i suspect it was TCP's sendmsg. af_packet.c never
seems to be doing that.
The queue_lock -> xmit_lock dependency was first observed at:
-> (&dev->queue_lock){-+}
-> &dev->xmit_lock [<c0bb0827>] dev_activate+0xc8/0xe5
i think i'll solve this by splitting af_packet.c's slock into a separate
bucket (separate lock type). (Such exceptions and locking assymetries
can be expressed towards the validator in a pretty straightforward way,
by initializing those locks in a special way.)
Ingo
next prev parent reply other threads:[~2006-02-02 13:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-27 0:18 [lock validator] net/ipv4/fib_hash.c: illegal {enabled-softirqs} -> {used-in-softirq} usage? Ingo Molnar
2006-01-27 1:41 ` Herbert Xu
2006-01-28 15:22 ` [lock validator] inet6_destroy_sock(): soft-safe -> soft-unsafe lock dependency Ingo Molnar
2006-01-28 15:44 ` Ingo Molnar
2006-01-31 10:27 ` Herbert Xu
2006-01-31 10:43 ` David S. Miller
2006-01-31 11:21 ` Ingo Molnar
2006-02-01 13:32 ` Ingo Molnar
2006-02-01 20:26 ` Herbert Xu
2006-02-02 7:46 ` Ingo Molnar
2006-02-02 8:48 ` Herbert Xu
2006-02-02 9:04 ` David S. Miller
2006-02-02 10:54 ` Ingo Molnar
2006-02-02 11:27 ` Ingo Molnar
2006-02-02 12:19 ` Herbert Xu
2006-02-02 12:17 ` Herbert Xu
2006-02-02 13:54 ` Ingo Molnar [this message]
2006-01-31 21:24 ` Ingo Molnar
2006-01-31 22:06 ` Herbert Xu
2006-02-01 10:42 ` Herbert Xu
2006-02-01 11:13 ` Ingo Molnar
2006-02-03 1:01 ` David S. 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=20060202135402.GA30251@elte.hu \
--to=mingo@elte.hu \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@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).