[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVM5Nr9YdN80TkotAcKff3=cZVG-R2sCiwXMJPv1gx38dg@mail.gmail.com>
Date: Wed, 16 Jan 2013 11:30:46 +0800
From: Ming Lei <ming.lei@...onical.com>
To: Tejun Heo <tj@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Alex Riesen <raa.lkml@...il.com>,
Alan Stern <stern@...land.harvard.edu>,
Jens Axboe <axboe@...nel.dk>,
USB list <linux-usb@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH] module, async: async_synchronize_full() on module init
iff async is used
On Wed, Jan 16, 2013 at 10:52 AM, Tejun Heo <tj@...nel.org> wrote:
> If the default iosched is built as module, the kernel may deadlock
> while trying to load the iosched module on device probe if the probing
> was running off async. This is because async_synchronize_full() at
> the end of module init ends up waiting for the async job which
> initiated the module loading.
>
> async A modprobe
>
> 1. finds a device
> 2. registers the block device
> 3. request_module(default iosched)
> 4. modprobe in userland
> 5. load and init module
> 6. async_synchronize_full()
>
> Async A waits for modprobe to finish in request_module() and modprobe
> waits for async A to finish in async_synchronize_full().
>
> Because there's no easy to track dependency once control goes out to
> userland, implementing properly nested flushing is difficult. For
> now, make module init perform async_synchronize_full() iff module init
> has queued async jobs as suggested by Linus.
>
> This avoids the described deadlock because iosched module doesn't use
> async and thus wouldn't invoke async_synchronize_full(). This is
> hacky and incomplete. It will deadlock if async module loading nests;
> however, this works around the known problem case and seems to be the
> best of bad options.
>
> For more details, please refer to the following thread.
>
> http://thread.gmane.org/gmane.linux.kernel/1420814
>
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Reported-by: Alex Riesen <raa.lkml@...il.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> ---
Looks it does fix the deadlock problem on my Pandaboard,
also the scsi disk device node(/dev/sdX) comes just
after loading module of 'sd_mod'.
Tested-by: Ming Lei <ming.lei@...onical.com>
Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists