linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@canonical.com>
To: Prarit Bhargava <prarit@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	x86@kernel.org, herrmann.der.user@googlemail.com,
	tigran@aivazian.fsnet.co.uk
Subject: Re: [PATCH 1/2] firmware, fix request_firmware_nowait() freeze with no uevent
Date: Mon, 21 Oct 2013 20:24:15 +0800	[thread overview]
Message-ID: <CACVXFVO_bbYsRRgZ+MfVKf5=VRNy=O3VUg0mh2fumEi7cObuiw@mail.gmail.com> (raw)
In-Reply-To: <1382304926-1641-2-git-send-email-prarit@redhat.com>

On Mon, Oct 21, 2013 at 5:35 AM, Prarit Bhargava <prarit@redhat.com> wrote:
> If request_firmware_nowait() is called with uevent == NULL, the firmware
> completion is never marked complete resulting in a hang in the process.
>
> If uevent is undefined, that means we're not waiting on anything and the
> process should just clean up and complete.  While we're at it, add a
> debug dev_dbg() to indicate that the FW has not been found.
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: x86@kernel.org
> Cc: herrmann.der.user@googlemail.com
> Cc: ming.lei@canonical.com
> Cc: tigran@aivazian.fsnet.co.uk
> ---
>  drivers/base/firmware_class.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 10a4467..95778dc 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -335,7 +335,8 @@ static bool fw_get_filesystem_firmware(struct device *device,
>                 set_bit(FW_STATUS_DONE, &buf->status);
>                 complete_all(&buf->completion);
>                 mutex_unlock(&fw_lock);
> -       }
> +       } else
> +               dev_dbg(device, "firmware: %s not found\n", buf->fw_id);
>
>         return success;
>  }
> @@ -886,6 +887,9 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
>                         schedule_delayed_work(&fw_priv->timeout_work, timeout);
>
>                 kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
> +       } else {
> +               /* if there is no uevent then just cleanup */
> +               schedule_delayed_work(&fw_priv->timeout_work, 0);
>         }

This may not a good idea and might break current NOHOTPLUG
users, and how can you make sure the user space application can
complete the request during the timeout time?

Thanks,
--
Ming Lei

  reply	other threads:[~2013-10-21 12:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-20 21:35 [PATCH 0/2] Improve firmware loading times on AMD and Intel Prarit Bhargava
2013-10-20 21:35 ` [PATCH 1/2] firmware, fix request_firmware_nowait() freeze with no uevent Prarit Bhargava
2013-10-21 12:24   ` Ming Lei [this message]
2013-10-21 22:24     ` Prarit Bhargava
2013-10-22  2:35       ` Ming Lei
2013-10-22 23:15         ` Prarit Bhargava
2013-10-23  4:16           ` Ming Lei
2013-10-23 10:36             ` Prarit Bhargava
2013-10-23 12:02               ` Prarit Bhargava
2013-10-23 13:21                 ` Ming Lei
2013-10-23 14:08                   ` Prarit Bhargava
2013-10-24  1:54                     ` Ming Lei
2013-10-24 11:17                 ` Henrique de Moraes Holschuh
2013-10-24 12:05                   ` Prarit Bhargava
2013-10-20 21:35 ` [PATCH 2/2] intel_microcode, Fix long microcode load time when firmware file is missing Prarit Bhargava
2013-10-21 12:20   ` Ming Lei
2013-10-21 12:26     ` Prarit Bhargava
2013-10-21 12:32       ` Ming Lei
2013-10-21 14:25         ` Prarit Bhargava
2013-10-22  2:43           ` Ming Lei
2013-10-22 23:16             ` Prarit Bhargava
2013-10-20 22:58 ` [PATCH 0/2] Improve firmware loading times on AMD and Intel Andi Kleen

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='CACVXFVO_bbYsRRgZ+MfVKf5=VRNy=O3VUg0mh2fumEi7cObuiw@mail.gmail.com' \
    --to=ming.lei@canonical.com \
    --cc=herrmann.der.user@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=tigran@aivazian.fsnet.co.uk \
    --cc=x86@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).