[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071221223134.1567b755.akpm@linux-foundation.org>
Date: Fri, 21 Dec 2007 22:31:34 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Pete Zaitcev <zaitcev@...hat.com>
Cc: Daniel Walker <dwalker@...sta.com>, mingo@...e.hu,
linux-kernel@...r.kernel.org, linux@...mer.net,
jonathan@...masters.org, matthias.kaehlcke@...il.com,
kjwinchester@...il.com
Subject: Re: [PATCH 4/4] usb: libusual: locking cleanup
On Fri, 21 Dec 2007 22:24:28 -0800 Pete Zaitcev <zaitcev@...hat.com> wrote:
> On Fri, 21 Dec 2007 00:00:04 -0800, Daniel Walker <dwalker@...sta.com> wrote:
>
> > I converted the usu_init_notify semaphore to normal mutex usage, and it
> > should still prevent the request_module before the init routine is
> > complete. Before it acted more like a complete, now the mutex protects
> > two distinct section from running at the same time..
>
> Let's see.
>
> > @@ -178,10 +179,7 @@ static int usu_probe_thread(void *arg)
> > int rc;
> > unsigned long flags;
> >
> > - /* A completion does not work here because it's counted. */
> > - down(&usu_init_notify);
> > - up(&usu_init_notify);
> > -
> > + mutex_lock(&usu_probe_mutex);
> > rc = request_module(bias_names[type]);
>
> When I tried it, usb-storage would not load with unresolved symbols.
> It happens if child (usu_probe_thread) runs ahead of its parent
> (usb_usual_init -> usb_register -> usu_probe). It's entirely possible,
> depending on your scheduler.
afaict Daniel's change will fix that?
He releases usu_probe_mutex once the usb_register() has completed and this
then allows the usb_probe_thread() to start working.
I'm still wondering if that theory has been tested though.
> I hate this down-up trick too
I'd be worried if you were proud of it ;)
--
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