public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: Michael-Luke Jones <mlj28@cam.ac.uk>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
	Kay Sievers <kay.sievers@vrfy.org>,
	LKML <linux-kernel@vger.kernel.org>, Pavel Machek <pavel@ucw.cz>,
	pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: [RFC][PATCH -mm 3/3] PM: Disable _request_firmware before hibernation/suspend
Date: Tue, 29 May 2007 18:51:38 -0400	[thread overview]
Message-ID: <200705291851.41027.rob@landley.net> (raw)
In-Reply-To: <9D3FC259-8391-4C2F-9F0F-AEF6CB3030E8@cam.ac.uk>

On Monday 28 May 2007 4:48 am, Michael-Luke Jones wrote:
> On 28 May 2007, at 08:43, Rafael J. Wysocki wrote:
> 
> >> Seems, that's just the broken synchronous firmware loading interface
> >> with the useless timeout handling. The nowait version of the same  
> >> loader
> >> doesn't time out, and should not have that problem. The sync version
> >> should be removed from the kernel, it just causes all sorts of  
> >> problems
> >> since it exists.
> >>
> >> Userspace should handle the async request just fine when it comes  
> >> back
> >> running, regardless of the time it was submitted.
> >
> > Okay, so the solution is to convert the drivers to use
> > request_firmware_nowait() instead of request_firmware() in  
> > their .resume()
> > routines.
> 
> [added Rob Landley to CC]
> 
> I think asynchronous loading should be made the default behaviour.  
> However, we need to think and document how to do firmware loading.

I'd love to write up documentation on this if anybody can tell me what it 
should say. :)

> Firmware loading can be done at two different times:
> Device Driver Load
> First use of Device Driver
> 
> For a network device, this correlates to when the driver is first  
> loaded into memory or at 'ifconfig up' respectively.

And for block devices ala:
https://bugs.launchpad.net/ubuntu/dapper/+source/initramfs-tools/+bug/74004
https://issues.rpath.com/browse/RPL-1350

The first use could be "mount" or open of the block device under /dev.  So now 
you have the mount and open syscalls returning -ENOFIRMWARE.  This is not a 
small change.

> At device driver load, firmware loading must be asynchronous. This is  
> because device driver init can occur before userspace runs and  
> registers a hotplug/uevent event handler.

Userspace doesn't have to register a hotplug handler: /sys/hotplug is the 
default and if there is one in initramfs it should get called.  You shouldn't 
have to wait for init to run for this to be the case.

I believe the initramfs cpio archive used to get extracted just before the 
attempt to exec /init out of it, and that it was moved to much earlier in the 
boot process so that firmware loading could be done out of it for statically 
linked drivers.

Look at do_basic_setup() in init/main.c: notice how usermodehelper_init() gets 
called right before driver_init().  Ask yourself: "why did it do that"?  
Notice how rest_init() forks the first kernel thread (PID 1) to run 
kernel_init(), and then becomes PID 0 (the idle task).  So from kernel_init() 
it's ok to spawn all the new tasks we want because they can't take any 
reserved PIDs.

> If device use is attempted   
> before firmware loads, a -ENOFIRMWARE call would be great so that  
> userspace and thus the user can be clearly informed what the problem is.

Because of course every userspace utility in the world will immediately be 
rewritten to provide clear and informative error messages for this race 
condition corner case.

Somehow, I can't bring myself to believe this.

> However, at 'first use' firmware loading, the synchronous interface  
> should remain. 'ifconfig up' either works or it doesn't, and as I see  
> it, has to just hang around until firmware turns up.

Why would you make two different code paths for module load and first use?

> Documentation for how hotplug/uevent handlers should cope with these  
> types of firmware loading is also *strongly* requested, in order for  
> lightweight but fully functional implementations to be made.

Happy to.  I'm just trying to figure out what the correct behavior is so I can 
document it.

Rob

  parent reply	other threads:[~2007-05-29 22:51 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200705272229.21263.rjw@sisk.pl>
2007-05-27 20:30 ` [RFC][PATCH -mm 1/3] PM: Hibernation and suspend notifiers Rafael J. Wysocki
2007-05-27 20:30 ` [RFC][PATCH -mm 2/3] PM: Disable usermode helper before hibernation/suspend Rafael J. Wysocki
2007-05-27 20:31 ` [RFC][PATCH -mm 3/3] PM: Disable _request_firmware " Rafael J. Wysocki
     [not found] ` <200705272230.56863.rjw@sisk.pl>
2007-05-28 13:04   ` [RFC][PATCH -mm 2/3] PM: Disable usermode helper " Pavel Machek
     [not found] ` <200705272230.04478.rjw@sisk.pl>
2007-05-28  9:49   ` [RFC][PATCH -mm 1/3] PM: Hibernation and suspend notifiers Nigel Cunningham
2007-05-28 13:12   ` Pavel Machek
2007-05-28 17:26     ` Rafael J. Wysocki
2007-05-28 15:56   ` Alan Stern
2007-05-28 17:29     ` Rafael J. Wysocki
2007-05-29 22:24     ` Rafael J. Wysocki
     [not found]     ` <200705300024.32455.rjw@sisk.pl>
2007-05-30 15:37       ` Pavel Machek
     [not found]       ` <20070530153740.GA4772@ucw.cz>
2007-05-30 20:44         ` Rafael J. Wysocki
     [not found]         ` <200705302244.25927.rjw@sisk.pl>
2007-05-30 21:11           ` Rafael J. Wysocki
     [not found]           ` <200705302311.40123.rjw@sisk.pl>
2007-05-30 22:24             ` Nigel Cunningham
2007-05-31  5:44               ` Rafael J. Wysocki
     [not found]               ` <200705310744.44488.rjw@sisk.pl>
2007-05-31 14:23                 ` Pavel Machek
     [not found]                 ` <20070531142357.GK27309@elf.ucw.cz>
2007-05-31 20:02                   ` Rafael J. Wysocki
2007-05-31 21:56                     ` Nigel Cunningham
2007-05-30 22:29             ` Pavel Machek
     [not found]             ` <20070530222956.GD27309@elf.ucw.cz>
2007-05-31  5:42               ` Rafael J. Wysocki
     [not found] ` <200705272231.54535.rjw@sisk.pl>
2007-05-27 20:45   ` [RFC][PATCH -mm 3/3] PM: Disable _request_firmware before hibernation/suspend Michael-Luke Jones
2007-05-27 20:49   ` Matthew Garrett
     [not found]   ` <20070527204955.GA22202@srcf.ucam.org>
2007-05-27 21:45     ` Rafael J. Wysocki
2007-05-27 21:49     ` Kay Sievers
     [not found]     ` <3ae72650705271449q37f523c3t5980541122ab871@mail.gmail.com>
2007-05-27 22:01       ` Rafael J. Wysocki
2007-05-27 22:04       ` Matthew Garrett
     [not found]       ` <20070527220412.GC22687@srcf.ucam.org>
2007-05-27 22:16         ` Kay Sievers
     [not found]         ` <1180304166.3131.66.camel@lov.localdomain>
2007-05-28  7:43           ` Rafael J. Wysocki
2007-05-28  8:48             ` Michael-Luke Jones
2007-05-28  9:06               ` Kay Sievers
2007-05-28 10:26                 ` Michael-Luke Jones
2007-05-28 12:01                   ` Kay Sievers
2007-05-28 12:07                     ` Michael-Luke Jones
2007-05-28 10:41                 ` Michael-Luke Jones
2007-05-29 21:19                 ` Rob Landley
2007-05-29 22:51               ` Rob Landley [this message]
2007-05-30 19:50                 ` Pavel Machek
2007-05-28 11:15             ` Pavel Machek
2007-05-28 11:24               ` Kay Sievers
2007-05-28 11:28                 ` Pavel Machek
2007-05-28 11:38                 ` Michael-Luke Jones
2007-05-28 11:45                   ` Pavel Machek
2007-05-28 11:51                   ` Kay Sievers
2007-05-28 12:26                     ` Michael-Luke Jones
2007-05-28 12:47                       ` Kay Sievers
2007-05-28 13:00                       ` Pavel Machek
2007-05-28 13:10                         ` Michael-Luke Jones
2007-05-28 11:28               ` Rafael J. Wysocki
     [not found]     ` <200705272345.04518.rjw@sisk.pl>
2007-05-27 22:01       ` Matthew Garrett
     [not found]       ` <20070527220158.GB22687@srcf.ucam.org>
2007-05-28  7:44         ` Rafael J. Wysocki
2007-05-28 16:09         ` Alan Stern
2007-05-28 16:12           ` Matthew Garrett
2007-05-28 16:43             ` Alan Stern
2007-05-28 16:54               ` Matthew Garrett
2007-05-28 20:03                 ` Alan Stern
2007-05-28 20:57               ` Pavel Machek
2007-05-28 22:29                 ` Alan Stern
     [not found]                 ` <Pine.LNX.4.44L0.0705281719200.10323-100000@netrider.rowland.org>
2007-05-29 20:09                   ` David Brownell
2007-06-04 11:00                   ` Pavel Machek
2007-05-28  8:30       ` Nigel Cunningham
2007-05-28 11:22         ` Rafael J. Wysocki
     [not found]   ` <6BD5252F-96CD-49D9-86C7-18115294D913@cam.ac.uk>
2007-05-27 21:55     ` Rafael J. Wysocki
2007-05-28 13:01     ` Pavel Machek
2007-05-29 20:41     ` Rob Landley
2007-05-28 13:07   ` Pavel Machek
2007-05-28 15:55   ` Alan Stern
2007-05-28 17:43     ` Rafael J. Wysocki
2007-05-28 20:51       ` Ray Lee
2007-05-28 20:59         ` Pavel Machek
2007-06-02  0:41 ` [RFC][PATCH -mm 0/2] PM: Hibernation and suspend notifiers (rev. 2) Rafael J. Wysocki
     [not found] ` <200706020241.53788.rjw@sisk.pl>
2007-06-02  0:43   ` [RFC][PATCH -mm 1/2] PM: Introduce hibernation and suspend notifiers Rafael J. Wysocki
2007-06-02  0:44   ` [RFC][PATCH -mm 2/2] PM: Disable usermode helper before hibernation and suspend Rafael J. Wysocki
     [not found]   ` <200706020243.20117.rjw@sisk.pl>
2007-06-03 16:41     ` [RFC][PATCH -mm 1/2] PM: Introduce hibernation and suspend notifiers Pavel Machek
     [not found]     ` <20070603164143.GB4093@ucw.cz>
2007-06-03 22:38       ` Rafael J. Wysocki
     [not found]       ` <200706040038.54161.rjw@sisk.pl>
2007-06-03 22:59         ` Pavel Machek
     [not found]         ` <20070603225903.GC2971@elf.ucw.cz>
2007-06-04  7:56           ` Rafael J. Wysocki
     [not found]   ` <200706020244.50180.rjw@sisk.pl>
2007-06-03 16:42     ` [RFC][PATCH -mm 2/2] PM: Disable usermode helper before hibernation and suspend Pavel Machek
     [not found] <20070604110052.GI4363@elf.ucw.cz>
2007-06-05 18:45 ` [RFC][PATCH -mm 3/3] PM: Disable _request_firmware before hibernation/suspend Alan Stern
     [not found] ` <Pine.LNX.4.44L0.0706051420351.2606-100000@iolanthe.rowland.org>
2007-06-05 20:26   ` Pavel Machek

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=200705291851.41027.rob@landley.net \
    --to=rob@landley.net \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=mlj28@cam.ac.uk \
    --cc=pavel@ucw.cz \
    /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