From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Roman Peniaev <r.peniaev@gmail.com>
Cc: Ming Lei <ming.lei@canonical.com>,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [v4 PATCH 1/1] init: fix race between rootfs mount and firmware loading
Date: Sat, 20 Sep 2014 07:42:57 -0700 [thread overview]
Message-ID: <20140920144257.GD14094@kroah.com> (raw)
In-Reply-To: <CACZ9PQVEmzCSjaVX53ZoNw0MHCGeMVpXg63+URq8rYLXns6C0w@mail.gmail.com>
On Sat, Sep 20, 2014 at 10:18:39PM +0900, Roman Peniaev wrote:
> On Sat, Sep 20, 2014 at 6:42 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Fri, Sep 19, 2014 at 09:44:24PM +0900, Roman Pen wrote:
> >> The thing is that built-in modules are being inited before
> >> rootfs mount. Some of the modules can request firmware loading
> >> from another thread using async 'request_firmware_nowait' call
> >> on inition, so we can catch this kind of race:
> >> rootfs does not exist yet, but we are going to open and load
> >> firmware file requesting it from the kernel thread.
> >>
> >> Solution is simple: before any rootfs access firmware loader
> >> must wait for rootfs mount.
> >
> > Even simpler solution, don't do that :)
> >
> > If your hardware needs firmware this early, and you don't put the
> > firmare into the initrd/initramfs, then it will just be loaded later on,
> > when the root filesystem is needed and the driver asks for it again
> > (your driver is failing "nicely" and allows the firmware to be loaded
> > later, right? If not, that should be fixed...)
> >
> > Or, build the firmware into the kernel, I think we still have that
> > option for some drivers that really wanted/needed this.
> >
> > What has changed recently that requires this type of patch? What is
> > wrong with the above solutions?
>
>
> I definitely agree with that "do not do that", I do agree.
Great, no need for a patch, we can move on now. :)
> But, I did not find any other solution, because in my case this "to be loaded
> later" really matters. The source of the problem is the rtlwifi, which randomly
> delays the startup, it randomly warns me about "firmware loading failed" and
> repeats loading later. This later costs around one second. For my tiny arm
> setup it is important. And it happens because of this race.
What "costs one second"? I don't understand, if the firmware isn't
there, are you timing out? Fix the driver to do async firmware loading
and that timeout shouldn't be an issue.
> So, all I want to say with this patch is:
>
> 1. 'mount / firmware loading' race exists, and it can cost time.
Switch the driver to do async firmware loading and you should be able to
fix this.
thanks,
greg k-h
next prev parent reply other threads:[~2014-09-20 14:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-15 14:45 [PATCH " Roman Pen
2014-09-15 16:39 ` Oleg Nesterov
2014-09-17 13:18 ` Roman Peniaev
2014-09-17 13:28 ` [v2 PATCH " Roman Pen
2014-09-17 17:46 ` Oleg Nesterov
2014-09-18 13:31 ` Roman Peniaev
2014-09-18 17:28 ` Oleg Nesterov
2014-09-18 13:33 ` [v3 " Roman Pen
2014-09-18 17:41 ` Oleg Nesterov
2014-09-19 12:41 ` Roman Peniaev
2014-09-19 18:03 ` Oleg Nesterov
2014-09-19 12:44 ` [v4 " Roman Pen
2014-09-19 19:45 ` Oleg Nesterov
2014-09-20 13:20 ` Roman Peniaev
2014-09-19 21:42 ` Greg Kroah-Hartman
2014-09-20 13:18 ` Roman Peniaev
2014-09-20 14:42 ` Greg Kroah-Hartman [this message]
2014-09-20 15:12 ` Roman Peniaev
2014-09-17 17:59 ` [PATCH " Oleg Nesterov
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=20140920144257.GD14094@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=oleg@redhat.com \
--cc=r.peniaev@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
Powered by JetHome