[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130115183204.GE2668@htj.dyndns.org>
Date: Tue, 15 Jan 2013 10:32:04 -0800
From: Tejun Heo <tj@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ming Lei <ming.lei@...onical.com>,
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>
Subject: Re: USB device cannot be reconnected and khubd "blocked for more
than 120 seconds"
Hello, Linus.
On Tue, Jan 15, 2013 at 09:36:57AM -0800, Linus Torvalds wrote:
> Tejun, comments? You can see the whole thread on lkml, but the basic
> problem is that the module loading doing the unconditional
> async_synchronize_full() has caused problems, because we have
>
> - load module A
> - module A does per-controller async discovery of its devices (eg
> scsi or ata probing)
> - in the async thread, it initializes somethign that needs another
> module B (in this case the default IO scheduler module)
> - modprobe for B loads the IO scheduler module successfully
> at the end of the module load, it does
> async_synchronize_full() to make sure load_module won't return before
> the module is ready
> *DEADLOCK*, because the async_synchronize_full() thing
> actually waits for not the module B async code (it didn't have any),
> but for the module *A* async code, which is waiting for module B to
> finish.
I think the root problem here, apart from request_module() from block
- which is a bit nasty but making that part completely async would too
be quite nasty albeit in a different way - is that
async_synchronize_full() is way too indescriminate. It's something
only suitable for things like the end of system init.
I'm wondering whether what we need is a rudimentray nesting like the
following.
finished_loading()
{
blah blah;
cookie = async_current_cookie();
do init calls;
async_synchronize_upto(cookie);
blah blah;
}
The nesting here would be an approximation as the dependency recorded
here is chronological. I *suspect* this should be safe unless the
module is doing something weird. Need to think more about it. One
way or the other, I think what we need is some form of scoping for
flushing async ops.
BTW, the current synchronization is broken - cookie isn't transferred
to running->domain in queueing order but __lowest_in_progress()
assumes that. I think I broke that while converting it to workqueue.
Anyways, working on it.
Thanks.
--
tejun
--
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