From: Marek Vasut <marek.vasut@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Oliver Neukum <oliver@neukum.org>,
Matthew Garrett <mjg@redhat.com>, Dave Jones <davej@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Larry Finger <Larry.Finger@lwfinger.net>,
Chaoming Li <chaoming_li@realsil.com.cn>,
"John W. Linville" <linville@tuxdriver.com>,
"Greg Kroah-Hartman" <gregkh@suse.de>,
USB list <linux-usb@vger.kernel.org>,
Linux Wireless List <linux-wireless@vger.kernel.org>
Subject: Re: loading firmware while usermodehelper disabled.
Date: Mon, 2 Jan 2012 05:17:19 +0100 [thread overview]
Message-ID: <201201020517.19624.marek.vasut@gmail.com> (raw)
In-Reply-To: <CA+55aFw-ar6dnPvn5wy=3Tv8fc_7Witri2mV=cCvH+aMv+jH1Q@mail.gmail.com>
> On Sun, Jan 1, 2012 at 8:17 AM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > As Linus pointed out, the real problem here is the firmware loader.
> > The way it is now, a driver can't always depend on the data being
> > available, even during a normal boot. It ought to use an asynchronous
> > approach; then none of these problems would arise.
>
> WRONG.
>
> Alan, you're not getting it. Loading firmware as part of
> suspend/resume is WRONG.
>
> It would not be made any better by an asynchronous approach, and that
> isn't the problem with request_firmware().
>
> Suspend/resume is *special*, and it's special for a very simple
> reason: unlike bootup or attaching a new device, suspend/resume
> happens WHILE THE USER IS ACTIVE.
>
> Loading firmware at that time is wrong. It's impossible. You have to
> have the firmware available *before* any processes might need it, but
> at the same time actually loading the firmware may need help from user
> space and/or other devices. It's a chicken-and-egg problem.
>
> So let me repeat one more time: Loading firmware at resume time is a
> device driver bug. Seriously. How many times do I have to say it?
>
> And making it asynchronous doesn't make it *any* less of a bug. It
> doesn't change anything but timing, but the problem was never about
> timing in the first place! The problem was about dependencies. User
> space may well depend on the device, and *other* devices may well
> depend on the device working.
>
> So stop with the inanity. I've already told people what the fix is:
> make sure that the firmware image is in memory before the suspend ever
> happens, and just reload it from memory. NOT with
> "request_firmware()". Because requesting the firmware at resume time
> is buggy and wrong, and has nothing to do with "asynchronous" or
> "synchronous". It has everything to do with "it's buggy".
>
> Really really really.
>
> So the problem with request_firmware() has absolutely nothing to do
> with "asynchronous". The problem is that the firmware interfaces do
> not cache the data in memory, and currently *cannot* sanely cache the
> firmware data simply because the interface doesn't have any kind of
> lifetime rules.
>
> In other words: we could make "request_firmware()" cache *all*
> firmware images forever, but there is currently no way to say "ok, the
> device was unplugged - and not fakily so by a resume event, but for
> real, and physically - so now you can drop the cache". Which means
> that effectively request_firmware() can do no caching at all, because
> it might eventually just run out of memory.
>
> It is *possible* that we might tie the firmware lifetime rules to the
> driver module lifetime. But it would probably be much better if we
> made for an explicit model of "ok, the device is now really gone" so
> that it would work properly with compiled-in drivers etc too.
>
> And yes, the firmware would have to stay around even around a
> resume/suspend that causes unplug events over USB. The "use USB and
> lose power" actually happens also for built-in devices that may well
> be disks and network cards that are *needed* by user space, so even if
> the device has been electrically unplugged, it is still attached and
> needs to be brought back *before* user space comes back.
>
> That's the whole point of suspend/resume: we're not starting from a
> clean slate. We are supposed to continue as if nothing happened!
>
> Linus
FYI this is not only problem with USB, but with PCMCIA too for example.
M
next prev parent reply other threads:[~2012-01-02 4:17 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20111230235421.GA6054@redhat.com>
2011-12-31 0:22 ` loading firmware while usermodehelper disabled Linus Torvalds
2011-12-31 0:40 ` Matthew Garrett
2011-12-31 15:33 ` Alan Stern
2011-12-31 15:59 ` Oliver Neukum
2012-01-01 2:21 ` Alan Stern
2012-01-01 12:22 ` Oliver Neukum
2012-01-01 16:17 ` Alan Stern
2012-01-01 16:25 ` Michael Büsch
2012-01-01 20:30 ` Linus Torvalds
2012-01-01 21:27 ` Oliver Neukum
2012-01-01 21:39 ` Michael Büsch
2012-01-02 3:33 ` Matthew Garrett
2012-01-02 7:56 ` Oliver Neukum
2012-01-02 4:17 ` Marek Vasut [this message]
2012-01-02 5:35 ` Gábor Stefanik
2012-01-02 8:38 ` Marek Vasut
2012-01-02 16:54 ` Alan Stern
2012-01-02 20:41 ` Jack Stone
2012-01-02 20:48 ` Linus Torvalds
2012-01-02 20:55 ` Jack Stone
2012-01-02 21:00 ` Linus Torvalds
2012-01-02 21:09 ` Jack Stone
2012-01-02 21:23 ` Linus Torvalds
2012-01-02 21:31 ` Jack Stone
2012-01-02 21:52 ` Marek Vasut
2012-01-02 21:57 ` Jack Stone
2012-01-02 22:31 ` Marek Vasut
2012-01-02 23:25 ` Jack Stone
2012-01-03 0:31 ` Marek Vasut
2012-01-03 0:44 ` Jack Stone
2012-01-03 0:58 ` Alan Cox
2012-01-03 7:17 ` Marek Vasut
2012-01-03 7:41 ` Oliver Neukum
2012-01-03 0:35 ` Alan Cox
2012-01-03 0:50 ` Alan Cox
2012-01-02 21:19 ` Matthew Garrett
2012-01-02 21:26 ` Jack Stone
2012-01-03 0:42 ` Alan Cox
2012-01-03 11:57 ` Oliver Neukum
2012-01-03 12:19 ` Jack Stone
2012-01-03 13:20 ` Alan Cox
2012-01-03 13:30 ` Oliver Neukum
2012-01-03 13:36 ` Alan Cox
2012-01-02 21:27 ` Linus Torvalds
2012-01-02 21:50 ` Matthew Garrett
2012-01-02 22:03 ` Linus Torvalds
2012-01-02 22:12 ` Matthew Garrett
2012-01-02 22:19 ` Linus Torvalds
2012-01-02 22:29 ` Matthew Garrett
2012-01-02 22:46 ` Linus Torvalds
2012-01-02 23:00 ` Matthew Garrett
2012-01-02 23:31 ` Jack Stone
2012-01-03 0:13 ` Matthew Garrett
2012-01-03 0:20 ` Alan Cox
2012-01-03 0:37 ` Matthew Garrett
2012-01-03 0:22 ` Jack Stone
2012-01-03 0:31 ` Alan Cox
2012-01-03 0:41 ` Jack Stone
2012-01-03 0:38 ` Matthew Garrett
2012-01-03 0:47 ` Alan Cox
2012-01-03 0:18 ` Alan Cox
2012-01-03 8:26 ` Ingo Molnar
2012-01-03 2:45 ` Alan Stern
2012-01-03 3:25 ` Matthew Garrett
2012-01-03 5:53 ` Linus Torvalds
2012-01-03 11:50 ` Oliver Neukum
2012-01-03 15:16 ` Alan Stern
2012-01-03 12:24 ` Matthew Garrett
2012-01-03 16:29 ` Linus Torvalds
2012-01-03 15:09 ` Alan Stern
2012-01-03 9:16 ` Alexander E. Patrakov
2012-01-03 9:24 ` david
2012-01-03 13:43 ` Alan Cox
2012-01-03 14:12 ` Bernd Petrovitsch
2012-01-03 0:00 ` Alan Cox
2012-01-02 23:50 ` Alan Cox
2012-01-02 23:53 ` Alan Cox
2011-12-31 16:27 ` Matthew Garrett
2011-12-31 14:20 ` Martin Schleier
2011-12-31 18:39 ` Marek Vasut
2012-01-01 9:48 ` Oliver Neukum
2012-01-01 9:54 ` Marek Vasut
2012-01-01 12:28 ` Oliver Neukum
2012-01-01 16:32 ` Marek Vasut
2012-01-01 17:06 ` Marek Vasut
2012-01-01 20:39 ` Alan Cox
2012-01-01 20:50 ` Michael Büsch
2012-01-02 3:24 ` Marek Vasut
2012-01-02 3:29 ` Marek Vasut
2012-01-01 3:49 ` Larry Finger
2012-01-01 22:45 ` Jack Stone
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=201201020517.19624.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=chaoming_li@realsil.com.cn \
--cc=davej@redhat.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mjg@redhat.com \
--cc=oliver@neukum.org \
--cc=stern@rowland.harvard.edu \
--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;
as well as URLs for NNTP newsgroup(s).