Re: [PATCH] driver core: add wait event for deferred probe
From: Andrew Morton
Date: Mon Feb 11 2013 - 18:10:46 EST
On Sun, 10 Feb 2013 00:57:57 +0800
Haojian Zhuang <haojian.zhuang@xxxxxxxxxx> 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().
It sounds like this:
static int __ref kernel_init(void *unused)
/* need to finish all async __init code before freeing the memory */
is designed to prevent the problem you describe?
> --- a/init/main.c
> +++ b/init/main.c
> @@ -786,6 +786,7 @@ static void __init do_basic_setup(void)
> + wait_for_device_probe();
Needs a nice comment here explaining what's going on.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/