public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Haojian Zhuang <haojian.zhuang@linaro.org>,
	gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk,
	rusty@rustcorp.com.au, hpa@linux.intel.com, jim.cromie@gmail.com,
	linux-kernel@vger.kernel.org, linux@arm.linux.org.uk,
	linus.walleij@linaro.org, arnd@arndb.de,
	broonie@opensource.wolfsonmicro.com, akpm@linux-foundation.org
Cc: patches@linaro.org, Haojian Zhuang <haojian.zhuang@linaro.org>
Subject: Re: [PATCH v2] driver core: add wait event for deferred probe
Date: Wed, 13 Feb 2013 21:39:59 +0000	[thread overview]
Message-ID: <20130213213959.BE1D53E3557@localhost> (raw)
In-Reply-To: <1360637915-11212-1-git-send-email-haojian.zhuang@linaro.org>

On Tue, 12 Feb 2013 10:58:35 +0800, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> do_initcalls() could call all driver initialization code in kernel_init
> thread. It means that probe() function will be also called from that
> time. After this, kernel could access console & release __init section
> in the same thread.
> 
> But if device probe fails and moves into deferred probe list, a new
> thread is created to reinvoke probe. If the device is serial console,
> kernel has to open console failure & release __init section before
> reinvoking failure. Because there's no synchronization mechanism.
> Now add wait event to synchronize after do_initcalls().
> 
> Changelog:
> v2: add comments on wait_for_device_probe().
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

As replied to on v1 of your patch, this change will cause a deadlock.
The following change would do the same without the deadlock issue:

 static int deferred_probe_initcall(void)
 {
 	deferred_wq = create_singlethread_workqueue("deferwq");
 	if (WARN_ON(!deferred_wq))
 		return -ENOMEM;

 	driver_deferred_probe_enable = true;
+	deferred_probe_work_func(NULL);
-	driver_deferred_probe_trigger();
 	return 0;
 }
 late_initcall(deferred_probe_initcall);

g.

      parent reply	other threads:[~2013-02-13 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  2:58 [PATCH v2] driver core: add wait event for deferred probe Haojian Zhuang
2013-02-13 16:41 ` anish kumar
2013-02-13 21:39 ` Grant Likely [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=20130213213959.BE1D53E3557@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=hpa@linux.intel.com \
    --cc=jim.cromie@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=patches@linaro.org \
    --cc=rusty@rustcorp.com.au \
    --cc=viro@zeniv.linux.org.uk \
    /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