All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Ming Lei <ming.lei@canonical.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Kay Sievers <kay@vrfy.org>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: A workaround for request_firmware() stuck in module_init
Date: Wed, 05 Sep 2012 16:01:23 +0200	[thread overview]
Message-ID: <s5htxvczhzg.wl%tiwai@suse.de> (raw)
In-Reply-To: <20120905140304.5c5c58a4@pyramind.ukuu.org.uk>

At Wed, 5 Sep 2012 14:03:04 +0100,
Alan Cox wrote:
> 
> > If the driver is built in kernel, the request_firmware in .probe() may
> > prolong kernel init, and it might be a problem. But looks it is not a
> > big deal since most of drivers are built as module.
> 
> Doing it by deferring the load also fixes that. The built in ones will
> defer their final probe until the firmware appears and all will be well.
> 
> If your rootfs needs firmware not in your initrd you already broke it and
> there is a certain level beyond which you just have to give up trying to
> save people from themselves.
> 
> It may actually make sense to push more of it into the core driver layer
> and take some of the ability to make mistakes away from driver authors.
> For the general case of "load firmware if we see one" there isn't really
> any reason we can't have a firmware_name entry in the probe table
> entries themselves. If that was present the core bus probe would kick a
> firmware load off and only when the firmware had loaded would it call
> ->probe with dev->firmware pointing at a refcounted firmware struct.
> 
> At that point it should be much faster to fix existing drivers and much
> harder for a random device driver to get it wrong. We can even add
> helpers which manage dev->firmware, and free the relevant objects when
> needed, plus doing automatic ref/deref on probe/remove so that for a
> typical driver the author only has to do
> 
> 	{PCI_blah , ... .firmware_name="wibble500.xcr", }
> 
> and all the loading, unloading, not loading twice happens by "magic" for
> the driver author.
> 
> Add a dev_discard_firmware() for drivers that do this and know they can
> then dump the file and all is good 8)

This sounds like an interesting idea.  I guess majority of drivers can
be covered by this scenario.  Of course, there are a few drivers that
need more complex handling (e.g. iwlwifi handles fallback fw loading),
but they can be implemented manually if needed anyway.


Takashi

  reply	other threads:[~2012-09-05 14:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 13:06 A workaround for request_firmware() stuck in module_init Takashi Iwai
2012-09-04 15:52 ` Ming Lei
2012-09-04 16:10   ` Takashi Iwai
2012-09-05  1:15     ` Ming Lei
2012-09-05  5:53       ` Takashi Iwai
2012-09-05 11:32         ` Ming Lei
2012-09-05 13:03           ` Alan Cox
2012-09-05 14:01             ` Takashi Iwai [this message]
2012-09-05 15:22             ` Ming Lei
2012-09-05 16:30               ` Alan Cox
2012-09-05 21:08                 ` Benjamin Herrenschmidt
2012-09-05 23:18                   ` Alan Cox
2012-09-06  5:06                     ` Benjamin Herrenschmidt
2012-09-06  2:47                 ` Linus Torvalds
2012-09-06  4:12                 ` Ming Lei
2012-09-06 12:59                   ` Alan Cox
2012-09-06 15:38                     ` Ming Lei
2012-09-05 16:59             ` Lucas De Marchi
2012-09-05 17:09               ` Takashi Iwai
2012-09-05 16:51 ` Lucas De Marchi
2012-09-05 17:08   ` Takashi Iwai

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=s5htxvczhzg.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=kay@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=rjw@sisk.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.