linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie-yetKDKU6eevNLxjTenLetw@public.gmane.org>
To: David VomLehn <dvomlehn-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Cc: Alan Stern
	<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
	Alan Cox <alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>,
	Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>,
	Arjan van de Ven <arjan-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Linus Torvalds
	<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux USB Mailing List
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux Embedded Mailing List
	<linux-embedded-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: Wait for console to become available, v3.2
Date: Sat, 25 Apr 2009 02:41:52 +0100	[thread overview]
Message-ID: <20090425014152.GD23106@shareable.org> (raw)
In-Reply-To: <20090424231013.GA18340-CFZJ1or75eBPWxJt6d6B6bQa8qPdvLwY@public.gmane.org>

David VomLehn wrote:
> I think this is over-engineered. This focused on boot devices, so you really
> don't care about things like buses, and I don't perceive a broader use. What
> really matters is particular boot device types, wherever they came from.

I'm thinking this broader use:

    - My boot _script_ is waiting for a disk which identifies as
      UUID=392852908752345749857 to appear before it can mount it on
      /data.  If there's no such disk, it proceeds without it.  It's a
      USB disk, behind a USB hub.

    - My boot script is looking to see if I'm holding down 'z' on the
      keyboard, to do something different.  But how does it know if
      there's a USB keyboard plugged in (behind two USB hubs) that
      hasn't finished being detected?

It just seemed to fit comfortably into what's being discussed.

(I do have these a system with these requirements, by the way.  It's
solved at the moment by waiting 5 seconds after booting, and by using
an older kernel which doesn't have boot parallelisation yet...)

There was a thread about BTRFS wanting to match up multiple disks
being scranned with volume ids some months ago, which might have
similar requirements, I'm not sure.

> I've been thinking about the issue of handling device classes because, as you
> clearly understand, distingishing between them can give you finer granularity
> during boot initialization. There are really three possible steps:
> 1. Discover a device exists.
> 2. Discover the device type
> 3. Completion of the probe function for the device.

Yes.

> The existing code is great if the interval between 1 and 2, or 2 and 3, is
> nearly zero. In the first case, you do nothing at step 1 and at step 2 you
> indicate that a boot device of the given type it found. In the second case,
> you indicate that you have found a device of unknown type was found (passing
> BOOTDEV_ANY_MASK) at step 1, ignore the information at step 2, and report
> completion of the probe for a generic device type at step 3 (again passing
> BOOTDEV_ANY_MASK).

Yes.

> There is one additional possibility, that there is a significant
> amount of time that passes between steps 1, 2, and 3. The existing
> interfaces already handle that, but I'm thinking a clearer interface
> is in order. The key is that, when you indicate a possible boot
> device was found, and when you indicate the completion of probing,
> you are actually passing a mask of boot device types.

This too, yes.

> Say that the device is actually a console, my favorite example. In
> this case, you'd pass BOOTDEV_ANY_MASK to bootdev_found at step 1,
> indicating that you don't really know the device type. This
> increments the pending count for all boot device types. At step 2,
> you find out you have a console, so you pass BOOTDEV_ANY_MASK &
> ~BOOTDEV_CONSOLE_MASK to bootdev_probe_done. This decrements the
> pending count for all device types except consoles. Then, at step 3,
> you call bootdev_probe_done with BOOTDEV_CONSOLE_MASK. Which
> decrements the pending count for console devices and wakes up any
> waiters.

Only one problem I see: what happens when there's an attempt to open
/dev/console before you increment the pending count?  It seems to me
you have to wait for all buses to have been detected, which is why I
mentioned buses, as some buses are _themselves_ slow devices to detect.

> The key question is, are there cases where there is enough time between steps
> 1 and 2, and steps 2 and 3, to add this complexity? If not, let's skip it.

The time between enumerating that a USB device exists and what it's
class is (could be a console?), and actually initialising the device
to find out if it's then usable, including loading firmware, can be a
little while.

I don't know if the times are long enough to matter.

Possibly related to all this: it would be really nice if the ATA
rather slow probe time didn't have to delay boot scripts until they
depend on the not-yet-probed disks, as sometimes they might not.

-- Jamie
 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2009-04-25  1:41 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 23:40 Wait for console to become available, v3.2 David VomLehn
2009-04-21  6:43 ` Ingo Molnar
     [not found]   ` <20090421064346.GB8020-X9Un+BFzKDI@public.gmane.org>
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
     [not found]           ` <20090421172929.GC8251-CFZJ1or75eBPWxJt6d6B6bQa8qPdvLwY@public.gmane.org>
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
     [not found]           ` <alpine.LFD.2.00.0904211016190.2199-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
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
     [not found]               ` <20090422101109.7beee3ee-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2009-04-22 10:39                 ` Jamie Lokier
2009-04-21 13:35   ` Arjan van de Ven
     [not found]     ` <20090421063549.3b71881d-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2009-04-21 13:50       ` Ingo Molnar
     [not found]         ` <20090421135034.GA30114-X9Un+BFzKDI@public.gmane.org>
2009-04-21 14:05           ` Jamie Lokier
2009-04-21 14:26             ` Ingo Molnar
     [not found]               ` <20090421142627.GA18129-X9Un+BFzKDI@public.gmane.org>
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
     [not found]               ` <Pine.LNX.4.44L0.0904211026080.2981-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-04-21 16:52                 ` David VomLehn
2009-04-21 19:09                   ` Alan Stern
     [not found]                     ` <Pine.LNX.4.44L0.0904211457150.3986-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-04-21 23:08                       ` David VomLehn
2009-04-22 15:40                         ` Alan Stern
     [not found]                           ` <Pine.LNX.4.44L0.0904221111320.3405-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
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
     [not found]                                     ` <20090424003555.GA31173-CFZJ1or75eBPWxJt6d6B6bQa8qPdvLwY@public.gmane.org>
2009-04-24 19:20                                       ` Alan Stern
     [not found]                                         ` <Pine.LNX.4.44L0.0904241502440.4531-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-04-24 21:32                                           ` David VomLehn
2009-04-24 22:19                                             ` Jamie Lokier
     [not found]                                               ` <20090424221951.GC18260-yetKDKU6eevNLxjTenLetw@public.gmane.org>
2009-04-24 23:10                                                 ` David VomLehn
     [not found]                                                   ` <20090424231013.GA18340-CFZJ1or75eBPWxJt6d6B6bQa8qPdvLwY@public.gmane.org>
2009-04-25  1:41                                                     ` Jamie Lokier [this message]
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
     [not found]                                                       ` <20090425014152.GD23106-yetKDKU6eevNLxjTenLetw@public.gmane.org>
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=20090425014152.GD23106@shareable.org \
    --to=jamie-yetkdku6eevnlxjtenletw@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
    --cc=arjan-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=dvomlehn-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=linux-embedded-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mingo-X9Un+BFzKDI@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.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).