linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>, Daniel Wagner <wagi@monom.org>
Cc: <linux-kernel@vger.kernel.org>, Ming Lei <ming.lei@canonical.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: [PATCH v4 1/4] firmware: Move umh locking code into fw_load_from_user_helper()
Date: Thu, 8 Sep 2016 14:41:33 +0200	[thread overview]
Message-ID: <509a727e-e784-8e6f-c112-760a0f8493b6@bmw-carit.de> (raw)
In-Reply-To: <20160907233306.GZ3296@wotan.suse.de>

On 09/08/2016 01:33 AM, Luis R. Rodriguez wrote:
>> The usermodehelper locking code was added by b298d289c792 ("PM / Sleep:
>> Fix freezer failures due to racy usermodehelper_is_disabled()").
>
> Thanks, this helps to give some perspective, I'll note that commit also refers
> to commit a144c6a (PM: Print a warning if firmware is requested when tasks are
> frozen) by Srivatsa a long time ago which added a warning print if a driver
> requested firmware when tasks are frozen. That commit log further clarifies
> that the issues is that some drivers erroneously use request_firmware() in
> their driver's ->resume() (or ->thaw(), or ->restore()) callbacks, it further
> clarifies that is not going to work unless the firmware has been built in.
> It did not explain *why* it wouldn't work though. But note it also mentioned
> how drivers that do have request_firmware() calls on resume stall resume --
> the reason for the stalling is the stupid usermode helper. The kernel now
> "fixed" these by returning an error in such cases, it does this by checking
> kernel user mode helper is disabled, this is why it would not work. But note
> that we should be disabling the usermode helper on suspend too, and likely
> the reason we never ran into an issue with the cache stuff is we would fail
> if the usermode helper was disabled anyway. This is a long winded way of
> saying that these commits further confirm removal of using the usermode helper
> from the firmware cache work for suspend/resume.

Okay, so let's finish this round of refactoring first. I prefer going in 
smaller steps and see if there are any regressions with those changes.


>> Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
>> Cc: Ming Lei <ming.lei@canonical.com>
>> Cc: Luis R. Rodriguez <mcgrof@kernel.org>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>>  drivers/base/firmware_class.c | 52 +++++++++++++++++++++++--------------------
>>  1 file changed, 28 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
>> index 960f8f7..d4fee06 100644
>> --- a/drivers/base/firmware_class.c
>> +++ b/drivers/base/firmware_class.c
>> @@ -981,13 +981,38 @@ static int fw_load_from_user_helper(struct firmware *firmware,
>>  				    unsigned int opt_flags, long timeout)
>>  {
>>  	struct firmware_priv *fw_priv;
>> +	int ret;
>> +
>> +	timeout = firmware_loading_timeout();
>> +	if (opt_flags & FW_OPT_NOWAIT) {
>> +		timeout = usermodehelper_read_lock_wait(timeout);
>> +		if (!timeout) {
>> +			dev_dbg(device, "firmware: %s loading timed out\n",
>> +				name);
>> +			return -EBUSY;
>> +		}
>> +	} else {
>> +		ret = usermodehelper_read_trylock();
>> +		if (WARN_ON(ret)) {
>> +			dev_err(device, "firmware: %s will not be loaded\n",
>> +				name);
>> +			return ret;
>> +		}
>> +	}
>
> fw_load_from_user_helper() no longer needs the timeout parameter then.

Updated the patch accordingly.

> Given this fact I'll chime in with some other, IMHO cosmetic things for
> this series. This however is the just the biggest issue for this series
> that I've found. That and testing this at run time didn't boot on my
> system, it could be an issue with linux-next next-20160907 booting
> on my system, I hadn't tried that yet. I did put your series through
> 0-day though and it went through fine though.

So far I have it tested with kvm. I'll give it a spin on real hardware. 
Good point.

> Since you will need a respin I'd appreciate if you can Cc Takashi,
> Bjorn, Daniel Vetter, and Arend van Spriel on these series as some
> of them have expressed interest in the umh stuff, so best to get wider
> review as well. While at it please Cc Rafael and Srivatsa.

Will do.

cheers,
daniel

  reply	other threads:[~2016-09-08 12:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07  8:45 [PATCH v4 0/4] firmware: encapsulate firmware loading status Daniel Wagner
2016-09-07  8:45 ` [PATCH v4 1/4] firmware: Move umh locking code into fw_load_from_user_helper() Daniel Wagner
2016-09-07 23:33   ` Luis R. Rodriguez
2016-09-08 12:41     ` Daniel Wagner [this message]
2016-09-08 14:55       ` Luis R. Rodriguez
2016-09-08 15:37   ` Ming Lei
2016-09-08 20:11     ` Luis R. Rodriguez
2016-09-09  1:22       ` Ming Lei
     [not found]         ` <CAB=NE6XK9g9muQ8p5+VaVGt2t0E_4K0wiavacQGqt_S4PyN28A@mail.gmail.com>
2016-09-09  4:19           ` Ming Lei
2016-09-09 22:10             ` Luis R. Rodriguez
     [not found]               ` <efba9730-d3bc-1fd4-2511-e509a4c60971@bmw-carit.de>
2016-09-15 15:43                 ` Luis R. Rodriguez
2016-09-07  8:45 ` [PATCH v4 2/4] firmware: encapsulate firmware loading status Daniel Wagner
2016-09-08  1:39   ` Luis R. Rodriguez
2016-09-08  8:05     ` Daniel Wagner
2016-09-08  9:45       ` Daniel Wagner
2016-09-08 11:26   ` Ming Lei
2016-09-08 12:26     ` Daniel Wagner
2016-09-08 15:49       ` Ming Lei
2016-09-09 11:43         ` Daniel Wagner
2016-09-08 12:32   ` Daniel Wagner
2016-09-07  8:45 ` [PATCH v4 3/4] firmware: Drop bit ops in favor of simple state machine Daniel Wagner
2016-09-08  1:45   ` Luis R. Rodriguez
2016-09-08 12:44     ` Daniel Wagner
2016-09-07  8:45 ` [PATCH v4 4/4] firmware: Do not use fw_lock for fw_status protection Daniel Wagner

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=509a727e-e784-8e6f-c112-760a0f8493b6@bmw-carit.de \
    --to=daniel.wagner@bmw-carit.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=rjw@sisk.pl \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=wagi@monom.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).