linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Wait queue question
@ 2001-02-14 15:05 Ralph Blach
  2001-02-14 17:30 ` Roland Dreier
  2001-02-14 18:34 ` Ron Bianco
  0 siblings, 2 replies; 6+ messages in thread
From: Ralph Blach @ 2001-02-14 15:05 UTC (permalink / raw)
  To: Embedded Linux list

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

If I have a wait queue thats I am using to wake up a device driver read
from an interrupt service routine.
If I get three interrupt and three wake_up_interrables, will I need to
execute three sleep_ons to get the wait queue back to the null state, or
is it just back after the first sleep_on?

Chip

[-- Attachment #2: Card for Ralph Blach --]
[-- Type: text/x-vcard, Size: 247 bytes --]

begin:vcard
n:Blach;Ralph
tel;work:919-543-1207
x-mozilla-html:TRUE
url:www.ibm.com
org:IBM MicroElectronics
adr:;;3039 Cornwallis		;RTP;NC;27709;USA
version:2.1
email;internet:rcblach@raleigh.ibm.com
x-mozilla-cpt:;15936
fn:Ralph Blach
end:vcard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Wait queue question
  2001-02-14 15:05 Wait queue question Ralph Blach
@ 2001-02-14 17:30 ` Roland Dreier
  2001-02-15 13:59   ` Ralph Blach
  2001-02-14 18:34 ` Ron Bianco
  1 sibling, 1 reply; 6+ messages in thread
From: Roland Dreier @ 2001-02-14 17:30 UTC (permalink / raw)
  To: Ralph Blach; +Cc: Embedded Linux list


    Ralph> If I have a wait queue thats I am using to wake up a device
    Ralph> driver read from an interrupt service routine.  If I get
    Ralph> three interrupt and three wake_up_interrables, will I need
    Ralph> to execute three sleep_ons to get the wait queue back to
    Ralph> the null state, or is it just back after the first
    Ralph> sleep_on?

You really don't want to use sleep_on() any more (Linux wants to
remove it out for 2.5).  Take a look at

<http://lwn.net/2001/0201/a/sleep-fix.php3>

for a safer way to sleep, or use the wait_event macro (in
linux/sched.h).

Roland

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Wait queue question
@ 2001-02-14 18:04 Ian Abbott
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Abbott @ 2001-02-14 18:04 UTC (permalink / raw)
  To: Embedded Linux list


Ralph Blach wrote:

> If I have a wait queue thats I am using to wake up a device
> driver read
> from an interrupt service routine.
> If I get three interrupt and three wake_up_interrables, will I need to
> execute three sleep_ons to get the wait queue back to the
> null state, or
> is it just back after the first sleep_on?

They do not work like semaphores. wake_up and wake_up_interruptible have
an immediate effect on processes waiting on the specified queue, but
don't modify a counter or anything like that. This also means you can't
sleep on an event that has already happened, like you could with a
semaphore.

Also, you probably want to use interruptible_sleep_on rather than
sleep_on, unless you've already considered this.

These are general Linux driver writing questions, rather than embedded
Linux PPC questions. You may be better off addressing these sorts of
questions to a different list or newsgroup. Also, you may wish to
consider investing in Alessandro Rubini's "Linux Device Drivers",
published by O'Reilly. It's starting to get a little out-of-date in
places but is still a good introduction to writing device drivers for
Linux.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Wait queue question
  2001-02-14 15:05 Wait queue question Ralph Blach
  2001-02-14 17:30 ` Roland Dreier
@ 2001-02-14 18:34 ` Ron Bianco
  1 sibling, 0 replies; 6+ messages in thread
From: Ron Bianco @ 2001-02-14 18:34 UTC (permalink / raw)
  To: Ralph Blach; +Cc: linuxppc-embedded


Hi Ralph, perhaps you could not attach your .vcf files anymore?

If your driver implements non-blocking read() and write() functions, then you don't
have to sleep.
Else others have commented on the alternative to sleep_on().

For non-blocking:
Just use poll_wait() in your poll() function and wakeup_interruptible when there data
available on your Qs.
Then user program's select() and poll() system calls will work properly.

Ron

> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Ralph
> Blach
> Sent: Wednesday, February 14, 2001 7:05 AM
> To: Embedded Linux list
> Subject: Wait queue question
>
>
> If I have a wait queue thats I am using to wake up a device driver read
> from an interrupt service routine.
> If I get three interrupt and three wake_up_interrables, will I need to
> execute three sleep_ons to get the wait queue back to the null state, or
> is it just back after the first sleep_on?
>
> Chip


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Wait queue question
  2001-02-14 17:30 ` Roland Dreier
@ 2001-02-15 13:59   ` Ralph Blach
  2001-02-15 16:39     ` Roland Dreier
  0 siblings, 1 reply; 6+ messages in thread
From: Ralph Blach @ 2001-02-15 13:59 UTC (permalink / raw)
  To: Roland Dreier; +Cc: Embedded Linux list

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

Roland,

Ok, but were is an example of how to use a wait_event macro.  I dont see
it in any of the documentation.

Chip
Roland Dreier wrote:
>
>     Ralph> If I have a wait queue thats I am using to wake up a device
>     Ralph> driver read from an interrupt service routine.  If I get
>     Ralph> three interrupt and three wake_up_interrables, will I need
>     Ralph> to execute three sleep_ons to get the wait queue back to
>     Ralph> the null state, or is it just back after the first
>     Ralph> sleep_on?
>
> You really don't want to use sleep_on() any more (Linux wants to
> remove it out for 2.5).  Take a look at
>
> <http://lwn.net/2001/0201/a/sleep-fix.php3>
>
> for a safer way to sleep, or use the wait_event macro (in
> linux/sched.h).
>
> Roland

[-- Attachment #2: Card for Ralph Blach --]
[-- Type: text/x-vcard, Size: 247 bytes --]

begin:vcard
n:Blach;Ralph
tel;work:919-543-1207
x-mozilla-html:TRUE
url:www.ibm.com
org:IBM MicroElectronics
adr:;;3039 Cornwallis		;RTP;NC;27709;USA
version:2.1
email;internet:rcblach@raleigh.ibm.com
x-mozilla-cpt:;15936
fn:Ralph Blach
end:vcard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Wait queue question
  2001-02-15 13:59   ` Ralph Blach
@ 2001-02-15 16:39     ` Roland Dreier
  0 siblings, 0 replies; 6+ messages in thread
From: Roland Dreier @ 2001-02-15 16:39 UTC (permalink / raw)
  To: Ralph Blach; +Cc: Embedded Linux list


>>>>> "Ralph" == Ralph Blach <rcblach@raleigh.ibm.com> writes:

    Ralph> Roland, Ok, but were is an example of how to use a
    Ralph> wait_event macro.  I dont see it in any of the
    Ralph> documentation.

Documentation/DocBook/kernel-hacking.tmpl does mention wait_event(),
although it's pretty short on details.  But your best bet is just to
grep through some driver sources and look at how people actually use
it.

Roland

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-02-15 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-14 15:05 Wait queue question Ralph Blach
2001-02-14 17:30 ` Roland Dreier
2001-02-15 13:59   ` Ralph Blach
2001-02-15 16:39     ` Roland Dreier
2001-02-14 18:34 ` Ron Bianco
  -- strict thread matches above, loose matches on Subject: below --
2001-02-14 18:04 Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).