[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160906215204.GR3296@wotan.suse.de>
Date: Tue, 6 Sep 2016 23:52:04 +0200
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Jacek Anaszewski <j.anaszewski@...sung.com>,
David Woodhouse <dwmw2@...radead.org>,
Christian Lamparter <chunkeey@...glemail.com>,
Julia Lawall <Julia.Lawall@...6.fr>,
Andrew Morton <akpm@...ux-foundation.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
Andy Lutomirski <luto@...capital.net>,
Richard Purdie <rpurdie@...ys.net>,
Wu Fengguang <fengguang.wu@...el.com>,
Johannes Berg <johannes@...solutions.net>,
"Luis R. Rodriguez" <mcgrof@...nel.org>,
Michal Marek <mmarek@...e.com>,
Hauke Mehrtens <hauke@...ke-m.de>,
Mark Brown <broonie@...nel.org>, Jiri Slaby <jslaby@...e.com>,
Ming Lei <ming.lei@...onical.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Kevin Cernekee <cernekee@...il.com>,
Jeff Mahoney <jeffm@...e.com>,
Greg KH <gregkh@...uxfoundation.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Jonathan Corbet <corbet@....net>, Felix Fietkau <nbd@....name>,
David Howells <dhowells@...hat.com>,
Vikram Mulukutla <markivx@...eaurora.org>,
Alessandro Rubini <rubini@...dd.com>,
Tom Gundersen <teg@...m.no>, Kees Cook <keescook@...omium.org>,
Takashi Iwai <tiwai@...e.de>, Gilles.Muller@...6.fr,
linux-serial <linux-serial@...r.kernel.org>,
Roman Pen <r.peniaev@...il.com>, Kay Sievers <kay@...y.org>,
Stephen Boyd <stephen.boyd@...aro.org>, nicolas.palix@...g.fr,
"Abhay_Salunke@...l.com" <Abhay_Salunke@...l.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thierry Martinez <martinez@...p.org>,
Josh Boyer <jwboyer@...oraproject.org>
Subject: Re: [RFC] fs: add userspace critical mounts event support
On Sat, Sep 03, 2016 at 11:10:02AM -0700, Dmitry Torokhov wrote:
> On Sat, Sep 3, 2016 at 11:01 AM, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> > On Sat, Sep 3, 2016 at 10:49 AM, Dmitry Torokhov
> > <dmitry.torokhov@...il.com> wrote:
> >>
> >> Unfortunately module loading and availability of firmware is very
> >> loosely coupled.
> >
> > The whole "let's add a new magical proc entry
To be fair it was using a generic sysfs entry.
> > to say that all
> > filesystems are mounted" is all about the user space coupling them.
>
> I was thinking if we kernel could post "conditions" (maybe simple strings)
> that it waits for, and userspace could unlock these "conditions". One of them
> might be "firmware available".
Dmitry, you seem to be suggesting a generic kernel-userspace "registry" for
intertwined dependencies that the kernel needs and only userspace can provide,
is that right?
If so it sounds overly complicated to resolve this. Do we have other uses
outside of kernel_read_file_from_path() you had in mind for this?
> > I'm just saying that if user space must know about when firmware is
> > ready to be loaded anyway, just do it right. Not with some hacky "you
> > can now do random things" flag.
Note, this isn't just about firmware since we now have a generic API to read
files from the kernel, so kernel_read_file_from_path(). Firmware is now just
*one* user case. Also a complexity here is this is not just for modules but
also for built-in drivers as well. And you want the option to update the
files without the driver.
The proposed solution provides a generic broad syfs entry for letting userspace
inform the kernel when files from the filesystems where it would typically read
from (I'm calling them critical filesystems for lack of a better term) can be
accessible. Something more specific requires a bit more thought given this is
not anymore about just firmware, must also address built-in drivers, and allow
for updates.
> > But by having user space actually say
> > "put this module together with this firmware".
Keep in mind this isn't about just firmware anymore, and we have to consider
built-in drivers as well. But if we were to just consider firmware... for the
sake of following with examples.
How would this registry work?
We already have MODULE_FIRMWARE(), we could have MODULE_FIRMWARE_REQ() or
something like it to help annotate the the driver was only functional with the
firmware, punt things to kmod to deal with the requirements. kmod would only
load the driver if the firmware is present as well, otherwise it could just
return a new -ENOFIRMWARE and try to defer module loading for a later time, it
would load the driver once and if the firmware becomes available... This all
seems rather hacky.
For built-in drivers.. the vmlinux would have the associated firmware reqs, it
would still need a way to let userspace know when such firmware is ready. What
kernel <-> userspace API would we want to use for this ? Or as you note we
could just prevent such drivers to be built-in. I'd be happy with this, however
I don't think the distributions using non-modular kernels will be.
Now whatever we come up with recall this isn't just about firmware anymore.
Which is why I ended up bundling all these requirements up into one generic
"kernel reads file from filesystem" requirement. I can see the syfs approach
being considered hacky -- but I gladly welcome an actual alternative
suggestion.
> > If you just put the two pieces together, then the module "will just work".
> >
> > And quite frankly, that sounds like a much better maintenance practice
> > anyway. If some module doesn't work without the firmware, then dammit,
> > the two *should* go together. Putting them in two different places
> > would be *INSANE*.
>
> Quite often it does until it does not. Most of the touch controllers
> work just fine until some event (abrupt cutting of power for example)
> where nvram gets corrupted and they come up in bootloader mode. It is
> just an example.
You want to also opt-in for updates, you don't want to require re-building
a driver for a firmware fix, for instance.
Luis
Powered by blists - more mailing lists