linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Lukas Middendorf <kernel@tuxforce.de>
Cc: Anand Jain <anand.jain@oracle.com>,
	linux-btrfs@vger.kernel.org, Antti Palosaari <crope@iki.fi>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org
Subject: Re: Is request_firmware() really safe to call in resume callback when /usr/lib/firmware is on btrfs?
Date: Fri, 14 Aug 2020 16:37:23 +0000	[thread overview]
Message-ID: <20200814163723.GC4332@42.do-not-panic.com> (raw)
In-Reply-To: <fc887e06-874c-79d8-0607-4e27ae788446@tuxforce.de>

On Fri, Aug 14, 2020 at 01:38:40PM +0200, Lukas Middendorf wrote:
> Hey Louis,
> 
> On 14/08/2020 00:13, Luis Chamberlain wrote:
> > On Thu, Aug 13, 2020 at 11:53:36PM +0200, Lukas Middendorf wrote:
> > > With "not used" I mean that the device has been recognized, the si2168
> > > module is loaded and si2168_probe() has been called on the device, but I
> > > have not started a media player which actually plays a DVB-C stream.
> > > Therefore si2168_init() has never been called and the firmware has never
> > > been requested or loaded to the device.
> > > 
> > > On resume si2168_init() will be called (although I don't think this actually
> > > is really necessary)
> > 
> > Indeed, that seems odd given its not on probe. So yet another possible
> > si2168 bug. Or another way to put it: your cache calls are not needed
> > if you remove that si2168_init() if init was not called yet. So simply
> > extending the data structure for the driver and seting a bool flag to
> > true if init was called should do the trick.
> > 
> > Then the two cache calls would not be needed.
> 
> I already thought about a way to remove the firmware load on suspend if it
> has not happened earlier. But I saw no way to distinguish between calls to
> si2168_init() during resume and calls to si2168_init() at the start of
> device usage.
> 
> In contrast to struct dvb_tuner_ops the relevant struct dvb_frontend_ops has
> no separate members "suspend" and "resume" to store callbacks to be called
> instead of sleep and init during suspend and resume. Changing the behavior
> of si2168 would likely include some bigger architectural work on the
> dvb_frontend system to extend dvb_frontend_ops.
> It might be possible to just put nothing into dvb_frontend_ops.init but
> instead populate the dvb_tuner_ops part of the struct, but those pointers
> might already be populated externally for some other use.
> 
> If I try to do this on my very first kernel contribution without in-depth
> knowledge of how the dvb drivers really work, this will likely just explode,
> if not for me then for somebody else with different hardware.

Indeed, the dvb init is called from dvb, so your two patches are good
for now I think.

> > > If the kernel does not already know that the files
> > > are not present without access to the file system, the system just freezes.
> > 
> > It is not clear to me what this means. Can you clarify?
> > 
> > > > >      e) having the firmware files not installed freezes the system during
> > > > > resume if the content of /usr/lib/firmware has not been listed before
> > > > > suspend (e.g. installing the nvidia driver, so the nouveau driver does not
> > > > > access this directory)
> > > > 
> > > > That may be the same issue as in b) assuming that you meant you didn't
> > > > use the dvb device, and that the firmware load issue is from nouveau.
> > > 
> > > This is actually just the inverted case of b).
> > > The only real relevance of the nouveau driver here is that its (perfectly
> > > working) firmware caching on suspend actually seems to be equivalent to
> > > manually running "ls" on the firmware directory and afterwards the kernel
> > > also knows whether or not the si2168 firmware files are present without file
> > > system access.
> > 
> > OK.. I still don't get it, so let me see if we can decipher what you
> > mean here.
> > 
> > If the firmware is *not* present for the si2168 driver and the device
> > has *not* been used yet you get a system freeze which you cannot recover
> > from, but only if you are *not* using a driver which also caches its
> > firmware already?
> 
> Yes, this is exactly what I wanted to say.
> 

OK great.. but..

> A new installation of Fedora 32 without firmware files 

Fedora 32 comes with no firmware at all? Are you sure? How about your
wifi?

> and with nouveau did
> not show my freeze problem. Installing either the firmware files or the
> nvidia driver started the freeze during resume.

Here now you say that if you install either the firmware files for
either si2168 or nouveau can cause a freeze, meanwhile what I wrote
above and you agreed is what you meant, says that the freeze happens
only if you *don't* have the firmware for nouveau present *and* you
also don't have the any other firmware present.

You also clarify here your freeze happens on resume only. Is that right?
Never on suspend, but if the freeze happens, it happens only on resume?

The actual case where you reach a freeze is still not clear yet. Let's
try to clarify this.

  Luis

  reply	other threads:[~2020-08-14 16:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-09 18:51 Is request_firmware() really safe to call in resume callback when /usr/lib/firmware is on btrfs? Lukas Middendorf
2020-08-13 16:37 ` Luis Chamberlain
2020-08-13 21:53   ` Lukas Middendorf
2020-08-13 22:13     ` Luis Chamberlain
2020-08-14 11:38       ` Lukas Middendorf
2020-08-14 16:37         ` Luis Chamberlain [this message]
2020-08-14 21:59           ` Lukas Middendorf
2020-08-17 15:20             ` Luis Chamberlain
2020-08-17 22:04               ` Lukas Middendorf
2020-08-18 14:37                 ` Luis Chamberlain
2021-04-01 14:59                   ` Lukas Middendorf
2021-04-02 18:02                     ` Luis Chamberlain
2021-04-02 22:19                       ` Luis Chamberlain
2021-04-02 22:58                         ` Luis Chamberlain
2021-04-03 10:24                           ` Lukas Middendorf
2021-04-03 16:07                             ` Lukas Middendorf
2021-04-03 20:25                             ` Luis Chamberlain
2021-04-03 21:04                               ` Luis Chamberlain
2021-04-05  9:52                                 ` Lukas Middendorf
2021-04-04  0:50                               ` Lukas Middendorf
2021-04-08 18:02                               ` Luis Chamberlain
2021-04-16 23:17                                 ` Luis Chamberlain

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=20200814163723.GC4332@42.do-not-panic.com \
    --to=mcgrof@kernel.org \
    --cc=anand.jain@oracle.com \
    --cc=crope@iki.fi \
    --cc=kernel@tuxforce.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.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).