From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-usb" <linux-usb@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
Oliver Neukum <oneukum@suse.de>
Subject: Re: [RFC] firmware load: defer request_firmware during early boot and resume
Date: Sat, 21 Jul 2012 23:33:05 +0200 [thread overview]
Message-ID: <201207212333.05911.rjw@sisk.pl> (raw)
In-Reply-To: <CACVXFVM+yJeDanZaSVc-snxu6edaOy+47oMSmcDr8zngUw4DnA@mail.gmail.com>
On Saturday, July 21, 2012, Ming Lei wrote:
> On Sun, Jul 22, 2012 at 1:49 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Friday, July 20, 2012, Ming Lei wrote:
>
> >> + if (system_state != SYSTEM_RUNNING)
> >> + return -EPROBE_DEFER;
> >
> > You can't just return here, _request_firmware_cleanup() has to be done still.
>
> Good catch, thanks.
>
> >
> >> +
> >> ret = usermodehelper_read_trylock();
> >
> > So why don't you do this here, actually, like:
> >
> > if (ret) {
> > ret = -EPROBE_DEFER;
>
> The problem is that the 'ret' is zero for early boot situation.
If you don't use SYSTEM_SUSPEND, you could just leave your !SYSTEM_RUNNING
check above and use this one to cover the suspend/resume case.
However, this is all moot in the face of the Linus' objection.
> > } else {
> >
> > instead of the WARN_ON()?
> >
> > Arguably, all cases in which usermodehelper_read_trylock() returns error
> > codes will require deferred probing.
>
> Yes, looks !SYSTEM_RUNNING has covered all the cases already.
Well, not really.
> >
> >> if (WARN_ON(ret)) {
> >> dev_err(device, "firmware: %s will not be loaded\n", name);
> >> diff --git a/include/linux/device.h b/include/linux/device.h
> >> index d0e4d99..a63d3171 100644
> >> --- a/include/linux/device.h
> >> +++ b/include/linux/device.h
> >> @@ -244,7 +244,7 @@ extern struct device_driver *driver_find(const char *name,
> >> struct bus_type *bus);
> >> extern int driver_probe_done(void);
> >> extern void wait_for_device_probe(void);
> >> -
> >> +extern void driver_deferred_probe_trigger(void);
> >>
> >> /* sysfs interface for exporting driver attributes */
> >>
> >> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> >> index e07f5e0..c8d74c6 100644
> >> --- a/include/linux/kernel.h
> >> +++ b/include/linux/kernel.h
> >> @@ -378,6 +378,7 @@ extern enum system_states {
> >> SYSTEM_POWER_OFF,
> >> SYSTEM_RESTART,
> >> SYSTEM_SUSPEND_DISK,
> >> + SYSTEM_SUSPEND,
> >
> > First off, SYSTEM_SUSPEND_DISK is not used and probably should be removed.
> > Second, both SYSTEM_SUSPEND and SYSTEM_SUSPEND_DISK would require the same
> > kind of handling in the respect of device probing, so it is not sufficient
> > to change the state in suspend_devices_and_enter().
>
> suspend_devices_and_enter is used by hibernation too,
No now look for the second time and then tell me what you got wrong. OK?
> and the state is just updated to RUNNING after suspend_finish.
No, it is not.
> > Moreover, there are other situations in which tasks are frozen and
> > request_firmware() won't work just as well, so I don't think using
> > system_state for that is going to work in general.
>
> Looks system_state becoming SYSTEM_RUNNING means all tasks has
> been thawed completely.
No, it doesn't.
Thanks,
Rafael
prev parent reply other threads:[~2012-07-21 21:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 12:33 [RFC] firmware load: defer request_firmware during early boot and resume Ming Lei
2012-07-20 12:52 ` Borislav Petkov
2012-07-20 12:57 ` Ming Lei
2012-07-20 13:03 ` Borislav Petkov
2012-07-20 13:09 ` Ming Lei
2012-07-20 13:13 ` Borislav Petkov
2012-07-20 13:54 ` Oliver Neukum
2012-07-20 15:53 ` Ming Lei
2012-07-21 4:13 ` Ming Lei
2012-07-21 9:56 ` Rafael J. Wysocki
2012-07-21 13:25 ` Ming Lei
2012-07-21 17:35 ` Rafael J. Wysocki
2012-07-21 17:31 ` Linus Torvalds
2012-07-21 17:53 ` Rafael J. Wysocki
2012-07-21 19:55 ` Ming Lei
2012-07-21 20:38 ` Linus Torvalds
2012-07-21 20:46 ` david
2012-07-21 23:24 ` Ming Lei
2012-07-22 12:58 ` Borislav Petkov
2012-07-22 19:46 ` Linus Torvalds
2012-07-23 8:12 ` Borislav Petkov
2012-07-21 21:01 ` Francois Romieu
2012-07-21 17:49 ` Rafael J. Wysocki
2012-07-21 20:09 ` Ming Lei
2012-07-21 21:33 ` Rafael J. Wysocki [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=201207212333.05911.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.de \
--cc=stern@rowland.harvard.edu \
--cc=tom.leiming@gmail.com \
/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