mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David VomLehn <dvomlehn@cisco.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jamie Lokier <jamie@shareable.org>, Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux USB Mailing List <linux-usb@vger.kernel.org>,
	Linux Embedded Mailing List <linux-embedded@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: Wait for console to become available, v3.2
Date: Fri, 24 Apr 2009 14:32:38 -0700	[thread overview]
Message-ID: <20090424213238.GA5973@cuplxvomd02.corp.sa.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0904241502440.4531-100000@iolanthe.rowland.org>

On Fri, Apr 24, 2009 at 03:20:42PM -0400, Alan Stern wrote:
> On Thu, 23 Apr 2009, David VomLehn wrote:
> 
> > I'm still scratching my head, trying to figure out where I can tap into the
> > 'USB notion of "all devices that were present at boot time have been probed"'
> > that Alan mentions above, so I don't have a specific implementation yet. I'm
> > open to any tips in this area.
> 
> This is a general notion; it applies to all subsystems that do
> asynchronous device discovery or registration.  The idea is simple
> enough: Keep a count of all devices which are known or suspected to be
> present, and decrement the count each time one of them is registered or
> determined not to exist.  When the count first reaches 0, all devices
> that were present (or reachable) at boot time will have been
> registered.
> 
> Isn't this basically what you had in mind?  If you're concerned about 
> the USB implementation, don't be -- I can write it quite easily.

I will absolutely take you up on your offer to lash this into USB. I'm still
fine-tuning a few details but will send out a patch soon, probably today. It's
a bit hard to test it and I'm sure it will need revision, but it will help a
whole bunch to have a USB implementation to play with.

> It's not just hot-pluggable devices.  These ideas are appropriate 
> whenever detection or registration is asynchronous.

This is very true, and I should modify the nomenclature to reflect this.

> > There currently two types supported:
> > -	consoles
> > -	network devices
> 
> You might as well add block devices too.

Yes, we should. My guess is block devices that hang off of buses besides USB
would be able to use this.

> > bus_bootdev_initialized(int bootdev_mask)
> > 	This function must be called by the bus support code after it calls the
> > 	initialiation function for a boot device. Every call to
> > 	bus_bootdev_found must be matched by a call to
> > 	bus_bootdev_initialized with the same bootdev_mask.
> 
> Even if the device can't be initialized for some reason, or if it turns
> out not the be the sort of boot device originally thought, this
> function still has to be called.  That should be made extremely clear.

True, and I was hoping that was clear enough, but I'll go back and emphasize
this more.

> > 	Device initialization functions must have called the appropriate
> > 	registration function for that device before bus_bootdev_initialized
> > 	is called. So, for console devices, register_console must be called
> > 	before bus_bootdev_initialized, and for network devices,
> > 	register_netdevice must be called first.
> 
> It's not clear how either of these two functions is bus-specific.

They aren't, not directly.  I *think* there isn't a problem here, but it
is certainly possible that the driver wouldn't register the device until some
time after its probe function is called. If that's the case, we would still
have a race condition when we went to use the device, which would defeat the
whole purpose of this change. Determining whether actually have a problem
here is probably too difficult to do beforehand; if an issue exists will find
it during use. Not the ideal approach, but this is engineering and not math.

> This looks like a good plan and not hard to implement.  It even should 
> be possible to fit USB disk drives into the scheme.

That would definitely rock. 

> Alan Stern

David VomLehn

  reply	other threads:[~2009-04-24 21:32 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 23:40 David VomLehn
2009-04-21  6:43 ` Ingo Molnar
2009-04-21  7:13   ` David Brownell
2009-04-21  8:03     ` Ingo Molnar
2009-04-21 17:11     ` David Woodhouse
2009-04-21 17:29       ` David VomLehn
2009-04-21 17:37         ` Linus Torvalds
2009-04-21 17:59           ` David VomLehn
2009-04-21 17:41         ` David Woodhouse
2009-04-21 17:31       ` Linus Torvalds
2009-04-21 19:25         ` Alan Cox
2009-04-21 23:17           ` David VomLehn
2009-04-22  8:25         ` Jamie Lokier
2009-04-22  9:11           ` Alan Cox
2009-04-22 10:39             ` Jamie Lokier
2009-04-21 13:35   ` Arjan van de Ven
2009-04-21 13:50     ` Ingo Molnar
2009-04-21 14:05       ` Jamie Lokier
2009-04-21 14:26         ` Ingo Molnar
2009-04-21 14:37           ` Alan Cox
2009-04-22  8:22             ` Jamie Lokier
2009-04-22  9:13               ` Alan Cox
2009-04-21 16:42           ` David VomLehn
2009-04-21 14:36         ` Alan Stern
2009-04-21 16:52           ` David VomLehn
2009-04-21 19:09             ` Alan Stern
2009-04-21 23:08               ` David VomLehn
2009-04-22 15:40                 ` Alan Stern
2009-04-22 20:54                   ` David VomLehn
2009-04-22 21:08                     ` Alan Cox
2009-04-22 21:24                       ` Alan Stern
2009-04-24  0:35                         ` David VomLehn
2009-04-24 19:20                           ` Alan Stern
2009-04-24 21:32                             ` David VomLehn [this message]
2009-04-24 22:19                               ` Jamie Lokier
2009-04-24 23:10                                 ` David VomLehn
2009-04-25  1:41                                   ` Jamie Lokier
2009-04-25  3:11                                     ` Alan Stern
2009-04-26 19:52                                       ` Jamie Lokier
2009-04-26 21:20                                         ` Alan Stern
2009-04-26 21:37                                           ` Jamie Lokier
2009-04-26 22:36                                             ` Kay Sievers
2009-04-26 23:12                                               ` Jamie Lokier
2009-04-26 23:23                                                 ` Kay Sievers
2009-04-26 23:46                                                   ` Jamie Lokier
2009-04-26 17:55                                     ` David VomLehn
2009-04-22  5:35               ` David VomLehn

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=20090424213238.GA5973@cuplxvomd02.corp.sa.net \
    --to=dvomlehn@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=hpa@zytor.com \
    --cc=jamie@shareable.org \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®