From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactions from semaphores to waitqueue
Date: Sat, 24 Jun 2006 22:28:58 +0200 [thread overview]
Message-ID: <449DA08A.10209@s5r6.in-berlin.de> (raw)
In-Reply-To: <1151172766.3181.75.camel@laptopd505.fenrus.org>
Arjan van de Ven wrote:
> On Sat, 2006-06-24 at 19:45 +0200, Stefan Richter wrote:
>>following semaphores remain in the ieee1394 subsystem:
>>
>>highlevel.c: hl_drivers_sem (RW semaphore)
>>nodemgr.c: subsys.rwsem (driver core's RW semaphores)
>>raw1394.c: fi->complete_sem (completion semaphore)
> can this last one move to an actual completion? That would get rid of it
> nicely ;)
Hmm. There are dozens of points in raw1394 which call
__queue_complete_req() which up()s the semaphore. ("fi" is the
private_data of a struct file. Multiple outstanding requests may be
associated with a file.) Then there are two places which wait on the
semaphore:
raw1394_read(), called when somebody reads /dev/raw1394:
if (file->f_flags & O_NONBLOCK) {
if (down_trylock(&fi->complete_sem))
return -EAGAIN;
} else {
if (down_interruptible(&fi->complete_sem))
return -ERESTARTSYS;
}
raw1394_release(), called when somebody closes (releases) /dev/raw1394:
done = 0;
while (!done) {
/* free all complete requests */
/* set "done" if there are no more pending requests */
if (!done)
down_interruptible(&fi->complete_sem);
}
/* cleanup, free fi */
It looks like fi->complete_sem is a actually a counting semaphore. It
could perhaps be replaced by a wait queue plus an atomic counter. There
is even already a wait queue in "fi" for use with poll_wait() via
raw1394_poll().
--
Stefan Richter
-=====-=-==- -==- ==---
http://arcgraph.de/sr/
next prev parent reply other threads:[~2006-06-24 20:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <449BEBFB.60302@s5r6.in-berlin.de>
[not found] ` <200606230904.k5N94Al3005245@shell0.pdx.osdl.net>
[not found] ` <30866.1151072338@warthog.cambridge.redhat.com>
[not found] ` <tkrat.df6845846c72176e@s5r6.in-berlin.de>
2006-06-24 9:32 ` [RFC PATCH 2.6.17-mm1 1/3] ieee1394: reduce size of hpsb_host by 252 bytes Stefan Richter
2006-06-24 9:33 ` [RFC PATCH 2.6.17-mm1 2/3] ieee1394: coarser locking for tlabel allocation Stefan Richter
2006-06-24 9:35 ` [RFC PATCH 2.6.17-mm1 3/3] ieee1394: nodemgr: read tlabel attributes atomically Stefan Richter
2006-06-24 17:32 ` [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactions from semaphores to waitqueue Stefan Richter
2006-06-24 17:45 ` Stefan Richter
2006-06-24 18:12 ` Arjan van de Ven
2006-06-24 20:28 ` Stefan Richter [this message]
2006-06-24 20:56 ` Stefan Richter
2006-06-25 19:37 ` [RFC PATCH 2.6.17-mm1 5/3] ieee1394: raw1394: remove redundant counting semaphore Stefan Richter
2006-06-25 19:54 ` Stefan Richter
2006-06-25 17:27 ` [RFC PATCH 2.6.17-mm1 4/3] ieee1394: convert ieee1394_transactions from semaphores to waitqueue Stefan Richter
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=449DA08A.10209@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®