netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@o2.pl>
To: Ben Greear <greearb@candelatech.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>,
	Francois Romieu <romieu@fr.zoreil.com>,
	netdev@vger.kernel.org, Kyle Lucke <klucke@us.ibm.com>,
	Raghavendra Koushik <raghavendra.koushik@neterion.com>,
	Al Viro <viro@ftp.linux.org.uk>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [BUG] RTNL and flush_scheduled_work deadlocks
Date: Tue, 20 Feb 2007 09:23:41 +0100	[thread overview]
Message-ID: <20070220082341.GB981@ff.dom.local> (raw)
In-Reply-To: <45D5D681.5060104@candelatech.com>

On Fri, Feb 16, 2007 at 08:06:25AM -0800, Ben Greear wrote:
...
> Well, I had lockdep and all of the locking debugging I could find 
> enabled, but
> it did not catch this problem..I had to use sysctl -t and manually dig 
> through the backtraces
> to find the deadlock....
> 
> It may be that lockdep could be enhanced to catch this sort of thing....

I think you are really good at traceing very interesting
(subtle) problems.

I guess the scenario is like this:

1) some process takes some lock (e.g. RTNL), 
2) kthread runs a work function, which tries to get the
   same lock,
3) the process with the lock calls flush_scheduled_work,
4) the flush_cpu_workqueue waits for kthread to finish.

So, the process #1 (with the lock) waits for the end 
of the process #2, which waits for the lock held by
process #1.

Of course it's a lockup - similar to circular dependency
but not the same: there is only one lock. I don't think
lockdep could be blamed here - if it's not a lock it
can't know the reason of process' #1 waiting.

In my opinion the solution should be looked for in the
workqueue code. My idea is: maybe there should be used
some additional lock taken by kthread before running
the workqueue and by a process calling the flush. Then
lockdep shouldn't have any problems with this dependency.
This lock could be #ifdef DEBUG_LOCK... so only where
it could be analyzed. Of course there may be some simpler
solution of this otherwise hard to track problem.

I CC this message to Ingo Molnar and hope he could find
some time to think about it.

Regards,
Jarek P.

  reply	other threads:[~2007-02-20  8:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-14 21:27 [BUG] RTNL and flush_scheduled_work deadlocks Stephen Hemminger
2007-02-14 21:44 ` Ben Greear
2007-02-14 23:54   ` Francois Romieu
2007-02-15 18:58     ` Ben Greear
2007-02-15 22:37 ` [PATCH 1/4] r8169: RTNL and flush_scheduled_work deadlock Francois Romieu
2007-02-20 16:18   ` Jeff Garzik
2007-02-15 22:37 ` [PATCH 2/4] sis190: " Francois Romieu
2007-02-15 22:37 ` [PATCH 3/4] 8139too: " Francois Romieu
2007-02-16  7:59   ` Jarek Poplawski
2007-02-16 20:20     ` Francois Romieu
2007-02-16 20:36       ` Stephen Hemminger
2007-02-17 20:54         ` Francois Romieu
2007-02-19 12:05       ` Jarek Poplawski
2007-02-19 21:08         ` Francois Romieu
2007-04-04 23:38   ` Ben Greear
2007-04-05 11:17     ` Francois Romieu
2007-02-15 22:37 ` [PATCH 4/4] s2io: " Francois Romieu
2007-02-16  7:29 ` [BUG] RTNL and flush_scheduled_work deadlocks Jarek Poplawski
2007-02-16  7:40   ` Ben Greear
2007-02-16  8:10     ` Jarek Poplawski
2007-02-16  8:23       ` Ben Greear
2007-02-16  9:04         ` Jarek Poplawski
2007-02-16 12:12           ` Jarek Poplawski
2007-02-16 16:06             ` Ben Greear
2007-02-20  8:23               ` Jarek Poplawski [this message]
2007-02-16 18:31     ` Stephen Hemminger
2007-02-16 19:04       ` Ben Greear
2007-02-19  6:13         ` [PATCH 1/2] " Jarek Poplawski
2007-02-19  6:27           ` Ben Greear
2007-02-19  7:11             ` Jarek Poplawski
2007-02-19  7:40               ` Jarek Poplawski
2007-03-05  8:36             ` [PATCH v.2] " Jarek Poplawski
2007-02-19  6:55         ` [PATCH 2/2] " Jarek Poplawski
2007-02-19  7:18           ` Jarek Poplawski

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=20070220082341.GB981@ff.dom.local \
    --to=jarkao2@o2.pl \
    --cc=greearb@candelatech.com \
    --cc=klucke@us.ibm.com \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=raghavendra.koushik@neterion.com \
    --cc=romieu@fr.zoreil.com \
    --cc=shemminger@linux-foundation.org \
    --cc=viro@ftp.linux.org.uk \
    /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).