wait_event and preemption in 2.6

From: michael_soulier
Date: Fri Oct 08 2004 - 14:22:06 EST



I am sending this on behalf of a coworker who is unfortunate enough to
be using a crappy email client. We are not subscribed to the mailing
list, so please include us in your replies.

---quote---
Dear kernel folks,

I'm writing a device driver for PPC Linux and I'm using wait_event. It
seems to me that there is a potential race condition in wait_event when
preemption is turned on (2.6 kernel).

The scenario goes something like this: After the waiting process is
woken up and returns from schedule it goes to the top of the loop and
prepares to wait again (despite the condition being true). Then it will
check the condition and break out of the loop. But what if in-kernel
preemption occurs while it's doing that and another process is
immediately scheduled to run? Does the process sleep forever? Assume
that the event (say interrupt) that caused the original wakeup is a one
shot.

I'm probably missing something. I've googled for an answer and asked
some of my Linux friends but it's not clear. Thanks for any replies.
Please cc me.

John
---end---

Thank you,
Mike

--
Michael P. Soulier <michael_soulier@xxxxxxxxx>
6000/6010/60* Development, Mitel Networks Corporation
"...the word HACK is used as a verb to indicate a massive amount of nerd-like
effort." -Harley Hahn, A Student's Guide to Unix
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/