From: Andrew Morton <akpm@linux-foundation.org>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Daniel Walker <dwalker@mvista.com>,
mingo@elte.hu, linux-kernel@vger.kernel.org, linux@bohmer.net,
jonathan@jonmasters.org, matthias.kaehlcke@gmail.com,
kjwinchester@gmail.com
Subject: Re: [PATCH 4/4] usb: libusual: locking cleanup
Date: Fri, 21 Dec 2007 22:31:34 -0800 [thread overview]
Message-ID: <20071221223134.1567b755.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071221222428.a75a5a34.zaitcev@redhat.com>
On Fri, 21 Dec 2007 22:24:28 -0800 Pete Zaitcev <zaitcev@redhat.com> wrote:
> On Fri, 21 Dec 2007 00:00:04 -0800, Daniel Walker <dwalker@mvista.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 ;)
next prev parent reply other threads:[~2007-12-22 6:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-21 8:00 [PATCH 1/4] usb microtek: remove unused semaphore Daniel Walker
2007-12-21 8:00 ` Daniel Walker
2007-12-21 8:00 ` [PATCH 2/4] prism54: remove questionable down_interruptible usage Daniel Walker
2007-12-21 8:00 ` [PATCH 3/4] docs: convert kref semaphore to mutex Daniel Walker
2007-12-21 21:33 ` Corey Minyard
2007-12-21 8:00 ` [PATCH 4/4] usb: libusual: locking cleanup Daniel Walker
2007-12-22 4:22 ` Andrew Morton
2007-12-22 6:24 ` Pete Zaitcev
2007-12-22 6:31 ` Andrew Morton [this message]
2007-12-22 17:01 ` Daniel Walker
2007-12-23 7:37 ` Pete Zaitcev
2007-12-23 16:46 ` Daniel Walker
2007-12-24 14:12 ` Pete Zaitcev
2007-12-24 16:04 ` Daniel Walker
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=20071221223134.1567b755.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dwalker@mvista.com \
--cc=jonathan@jonmasters.org \
--cc=kjwinchester@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@bohmer.net \
--cc=matthias.kaehlcke@gmail.com \
--cc=mingo@elte.hu \
--cc=zaitcev@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.