netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] netdev sysfs failure handling
Date: Tue, 9 May 2006 15:50:33 -0700	[thread overview]
Message-ID: <20060509155033.022708c9@localhost.localdomain> (raw)
In-Reply-To: <20060509.154322.09145595.davem@davemloft.net>

On Tue, 09 May 2006 15:43:22 -0700 (PDT)
"David S. Miller" <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@osdl.org>
> Date: Tue, 9 May 2006 14:40:49 -0700
> 
> > Agreed, especially since rtnl is now a real mutex.  The case, that
> > I was worried about:
> > 	rtnl_lock()
> > 	spin_lock_irq(&mylock);
> > 	x = register_netdevice();
> > ...
> > 
> > Doesn't show up in any current code, even for the pseudo devices
> > and funny virtualized interfaces.
> 
> Right, therefore I think we should put something like your patch in
> there now.... perhaps.
> 
> The case where we really needed the todo list is unregister, so that
> we can safely wait for all references to the net device to go away.
> 
> I still wonder about those mentioned hotplug races wrt. linkwatch
> in the comment above netdev_run_todo().
> 
> Linkwatch is such a nuissance because it combines asynchronous link
> state change processing with keventd and RTNL locking.  It sleeps
> waiting for __LINK_STATE_SCHED to clear with the RTNL held (via
> dev_deactivate()).  But then again dev_close() code paths do this
> too, so the dev_deactivate() bit should be OK.
> 
> Linkwatch, after doing the dev_activate(), emits a NETDEV_CHANGE
> notifier on netdev_chain and also sends out an RTM_NETLINK
> message.  This is for the case where IFF_UP is set.
> 
> Until we release the RTNL semaphore, during netdev register, nobody
> can go in an inspect the state of a net device.  So doing the sysfs
> node creation in register_netdevice() should be OK as far as I can
> tell.
> 
> Can anyone find a problem with this?

Also, by getting the netdevice fully in sysfs under RTNL,
we are safe from races with the hotplug uevent that occurs.

Right now, it might be possible on SMP for the hotplug to happen
after register_netdevice, but before the device shows up
in sysfs.

      reply	other threads:[~2006-05-09 22:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-21 20:42 [RFC] netdev sysfs failure handling Stephen Hemminger
2006-05-07  1:06 ` David S. Miller
2006-05-09 19:01   ` Stephen Hemminger
2006-05-09 21:05     ` David S. Miller
2006-05-09 21:40       ` Stephen Hemminger
2006-05-09 22:43         ` David S. Miller
2006-05-09 22:50           ` Stephen Hemminger [this message]

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=20060509155033.022708c9@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=davem@davemloft.net \
    --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).