[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwTZjLHvZLBuNG-aO-+ex_yTYfaqOGqQ+6Krx9Z7EUNQQ@mail.gmail.com>
Date: Fri, 16 Mar 2012 16:37:43 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Christian Lamparter <chunkeey@...glemail.com>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
alan@...rguk.ukuu.org.uk,
Linux PM mailing list <linux-pm@...r.kernel.org>
Subject: Re: [RFC] firmware loader: retry _nowait requests when userhelper is
not yet available
On Fri, Mar 16, 2012 at 3:57 PM, Rafael J. Wysocki <rjw@...k.pl> wrote:
> + if (nowait) {
> + int limit = loading_timeout * MSEC_PER_SEC;
> + int timeout = 10; /* in msec */
> +
> + while (usermodehelper_is_disabled()) {
> + read_unlock_usermodehelper();
> +
> + msleep(timeout);
Ugh, this is disgusting.
The whole point of nowait was that it's not synchronous - so it should
just be driven by timers, not some kind of random "while sleep" loop.
And that fw thing already does have a timeout associated with it, and
quite frankly, the *sane* approach is to do all this not in
_request_firmware(), but in request_firmware_work_func() - never even
call _request_firmware() in the first place if the system isn't ready,
just reset the timeout to retry it again later.
Seriously. The rule should be really simple: nothing should *ever*
call "request_firmware()" (or the _request_firmware() helper function)
while the system is not up. That WARN_ON() should remain totally and
utterly unconditional, and it should *not* be conditional on "nowait"
or any idiotic crappy hack like that.
If there is an asynchronous thread - and there is, for the _nowait()
case - that asynchronous thread should set up the timer and retry in
ten seconds or whatever. It should *not* call 'request_firmware()" and
expect that to do something special.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists