From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Jarek Poplawski <jarkao2@o2.pl>,
jeff@garzik.org, akpm@linux-foundation.org,
netdev@vger.kernel.org, Ben Greear <greearb@candelatech.com>,
Kyle Lucke <klucke@us.ibm.com>,
Raghavendra Koushik <raghavendra.koushik@neterion.com>,
Al Viro <viro@ftp.linux.org.uk>
Subject: Re: [PATCH 3/4] 8139too: RTNL and flush_scheduled_work deadlock
Date: Fri, 16 Feb 2007 12:36:05 -0800 [thread overview]
Message-ID: <20070216123605.56e697ac@freekitty> (raw)
In-Reply-To: <20070216202034.GA10353@electric-eye.fr.zoreil.com>
On Fri, 16 Feb 2007 21:20:34 +0100
Francois Romieu <romieu@fr.zoreil.com> wrote:
> Jarek Poplawski <jarkao2@o2.pl> :
> [...]
> > > diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
> > > index 35ad5cf..99304b2 100644
> > > --- a/drivers/net/8139too.c
> > > +++ b/drivers/net/8139too.c
> > > @@ -1109,6 +1109,8 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
> > >
> > > assert (dev != NULL);
> > >
> > > + flush_scheduled_work();
> > > +
> >
> > IMHO there should be rather cancel_rearming_delayed_work
> > instead of this.
>
> The delayed_work is initialized even if tp->have_thread is false,
> so cancel_rearming_delayed_work() will work, yes. Feel free to
> send a patch.
>
> [...]
> > > @@ -1603,18 +1605,21 @@ static void rtl8139_thread (struct work_struct *work)
> > > struct net_device *dev = tp->mii.dev;
> > > unsigned long thr_delay = next_tick;
> > >
> > > + rtnl_lock();
> > > +
> > > + if (!netif_running(dev))
> > > + goto out_unlock;
> >
> > I wonder, why you don't do netif_running before
> > rtnl_lock ? It's an atomic operation. And I'm not sure if increasing
> > rtnl_lock range is really needed here.
>
> thread A: netif_running()
> user task B: rtnl_lock()
> user task B: dev->close()
> user task B: rtnl_unlock()
> thread A: rtnl_lock()
> thread A: mess with closed device
>
> Btw, the thread runs every 3*HZ at most.
You need to hold a dev reference (dev_hold) as well. to keep the device
from disappearing. or do a flush_scheduled_work in the remove routine.
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-02-16 20:43 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 [this message]
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
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=20070216123605.56e697ac@freekitty \
--to=shemminger@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=greearb@candelatech.com \
--cc=jarkao2@o2.pl \
--cc=jeff@garzik.org \
--cc=klucke@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=raghavendra.koushik@neterion.com \
--cc=romieu@fr.zoreil.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.