netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Benjamin Thery <Benjamin.Thery@bull.net>
Cc: Daniel Lezcano <dlezcano@fr.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: deadlock during net device unregistration - V2
Date: Sat, 4 Oct 2008 09:42:48 +0200	[thread overview]
Message-ID: <20081004074248.GA2536@ami.dom.local> (raw)
In-Reply-To: <20081002203435.GC2664@ami.dom.local>

On Thu, Oct 02, 2008 at 10:34:35PM +0200, Jarek Poplawski wrote:
> On Thu, Oct 02, 2008 at 09:55:02PM +0200, Benjamin Thery  wrote:
> > Quoting Jarek Poplawski <jarkao2@gmail.com>:
> ...
> >> As a matter of fact I've thought about something even simpler, which
> >> probably should help for all above concerns too:
> >>
> >> 	if (event == NETDEV_UNREGISTER)
> >>   	        dst_gc_task(&dst_gc_work.work);
> >>
> >> dst_gc_task() locking allows for this, and running this two times in
> >> a row could be even faster than trying to cancel the unnecessary run.
> >
> > I've thought a bit more about my last proposal and come to the same
> > conclusion as you, hmm, almost. I thought we could call
> > cancel_delayed_work() unconditionally and then dst_gc_task().
> >
> >  	if (event == NETDEV_UNREGISTER) {
> >                 cancel_delayed_work(&dst_gc_work);
> >    	        dst_gc_task(&dst_gc_work.work);
> >         }
> >
> > But, you're right, calling only dst_gc_task() seems fine to me.
> 
> I'm OK with any of these versions.
> 
> >
> > I'll run some tests tomorrow and send a new patch.
> >
> > Do we agree that this fix (calling dst_gc_task() in dst_dev_event())
> > is better/more appropriate than the first one (replacing rtnl_unlock()
> > by the non-blocking __rtnl_unlock() in linkwatch_event())?

Hmm... You can kill me, but after more looking at this I've changed my
mind.

> I agree it's more appropriate, because:
> a) the job is done according to the rules (in the comment) during
>    the notification and not in some future,

But, since the rules are wrong or protocols buggy, the solution isn't
effective: there should be no deadlock after this, but it's also hard
to predict how many dst_gc_task() runs are needed to free all refs.
During this all other works would be unnecessarily blocked by the
linkwatch, what looks a bit too hoggish.

My current idea is we should move linkwatch or dst_gc_task() (or both)
to it's own workqueue.

> b) it removes some hidden dependencies between processes/works, which,
>    even if they currently don't exist except this one in the linkwatch,
>    could be extremly hard to diagnose, if added accidentally in the
>    future.
> 
> On the other hand, until we are not sure of the reasons, why something

BTW, sorry, of course:
"On the other hand, until we are sure of the reasons, why something"

> like this (the full destroying) was avoided in the past, and until it's
> heavily tested (with lockdep), your first patch looks to me much safer
> if applying to any -stable is considered.

And this first patch looks better and better each time...

Jarek P.

  reply	other threads:[~2008-10-04  7:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080929175412.866679567@theryb.frec.bull.fr>
2008-09-29 17:54 ` [PATCH] net: deadlock during net device unregistration Benjamin Thery
2008-09-30  6:32   ` Jarek Poplawski
2008-09-30 11:52     ` Benjamin Thery
2008-09-30 13:58       ` David Miller
2008-09-30 14:07         ` Benjamin Thery
2008-09-30 14:42       ` Jarek Poplawski
2008-09-30 14:57         ` Jarek Poplawski
2008-09-30 15:18           ` Benjamin Thery
2008-10-01  9:59             ` David Miller
2008-10-01 10:10               ` Daniel Lezcano
2008-10-01 10:12                 ` David Miller
2008-10-01 14:14                   ` [PATCH] net: deadlock during net device unregistration - V2 Benjamin Thery
2008-10-01 19:48                     ` Jarek Poplawski
2008-10-01 21:06                       ` Daniel Lezcano
2008-10-01 21:52                         ` Jarek Poplawski
2008-10-01 23:31                         ` Jarek Poplawski
2008-10-02 15:23                           ` Benjamin Thery
2008-10-02 18:38                             ` Jarek Poplawski
2008-10-02 19:55                               ` Benjamin Thery 
2008-10-02 20:34                                 ` Jarek Poplawski
2008-10-04  7:42                                   ` Jarek Poplawski [this message]
2008-10-04  7:52                                     ` Jarek Poplawski
2008-10-03  0:41   ` [PATCH] net: deadlock during net device unregistration Eric W. Biederman
2008-10-05  4:26   ` Herbert Xu
2008-10-05  6:55     ` Jarek Poplawski
2008-10-05  6:56       ` Herbert Xu
2008-10-05  7:12         ` Jarek Poplawski
2008-10-05  7:28           ` Stephen Hemminger
2008-10-05  7:38             ` Herbert Xu
2008-10-05  7:39           ` Herbert Xu
2008-10-06 15:19     ` Benjamin Thery
2008-10-07 22:46       ` David Miller
2008-10-07 22:50     ` 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=20081004074248.GA2536@ami.dom.local \
    --to=jarkao2@gmail.com \
    --cc=Benjamin.Thery@bull.net \
    --cc=davem@davemloft.net \
    --cc=dlezcano@fr.ibm.com \
    --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).