public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Kim, Milo" <milo.kim@ti.com>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>,
	<linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Richard Purdie <rpurdie@rpsys.net>, Bryan Wu <cooloney@gmail.com>
Subject: Re: [PATCH] leds:lp55xx: Correct Kconfig dependency for f/w user helper
Date: Tue, 08 Sep 2015 11:03:52 +0200	[thread overview]
Message-ID: <s5hy4ghffk7.wl-tiwai@suse.de> (raw)
In-Reply-To: <55EE9B7B.7020503@ti.com>

On Tue, 08 Sep 2015 10:25:31 +0200,
Kim, Milo wrote:
> 
> > The fallback to user helper mode is bad for the recent udev, since
> > udev already dropped the f/w support code completely.  Thus every
> > non-existing f/w load will result in 60 seconds stall.
> 
> However, timeout is changed to MAX_JIFFY_OFFSET when FW_OPT_UEVENT flag 
> is not set.
> 
> static int _request_firmware_load(struct firmware_priv *fw_priv,
> 				  unsigned int opt_flags, long timeout)
> {
> 	(snip)
> 
> 	if (opt_flags & FW_OPT_UEVENT) {
> 		buf->need_uevent = true;
> 		dev_set_uevent_suppress(f_dev, false);
> 		dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id);
> 		kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
> 	} else {
> 		timeout = MAX_JIFFY_OFFSET;
> 	}
> 
> 	retval = wait_for_completion_interruptible_timeout(&buf->completion,
> 			timeout);
> }
> 
> It will take too long to get the result.

Why it takes too long?  It's the timeout, so it happens only when the
input isn't completed.

> I don't know the reason why 
> timeout was modified in the commit [68ff2a00dbf5: firmware_loader: 
> handle timeout via wait_for_completion_interruptible_timeout()].

My guess about the rationale behind the change is that, if it's no
udev event, the (more-or-less) manual interaction is expected.  If
it's done by human, we can't expect that it's typed always so quickly
in time.

> Moreover, this time value is not identical to the result of 
> timeout_show().

That's bad, indeed.

> Is it OK to remove the line as follows?
> 
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 171841a..8187404 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -909,8 +909,6 @@ static int _request_firmware_load(struct 
> firmware_priv *fw_priv,
>   		dev_set_uevent_suppress(f_dev, false);
>   		dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id);
>   		kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
> -	} else {
> -		timeout = MAX_JIFFY_OFFSET;
>   	}
> 
>   	retval = wait_for_completion_interruptible_timeout(&buf->completion,
> 
> If the driver requires longer loading time, then it can be done by 
> updating '/sys/class/firmware/timeout'.

I guess this would be harmless for most cases.  But it's better to
have a clarification why the shorter timeout is mandatory...


thanks,

Takashi

      reply	other threads:[~2015-09-08  9:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 12:25 [PATCH] leds:lp55xx: Correct Kconfig dependency for f/w user helper Takashi Iwai
2015-09-07 14:19 ` Jacek Anaszewski
2015-09-08  0:30   ` Kim, Milo
2015-09-08  5:06     ` Takashi Iwai
2015-09-08  7:37       ` Jacek Anaszewski
2015-09-08  8:25       ` Kim, Milo
2015-09-08  9:03         ` Takashi Iwai [this message]

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=s5hy4ghffk7.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=cooloney@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=milo.kim@ti.com \
    --cc=rpurdie@rpsys.net \
    /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