From: David Herrmann <hidden> Date: 2012-03-16 20:04:48
Consider two threads calling read() on the same uinput-fd, both
non-blocking. Assume there is data-available so both will simultaneously
pass:
udev->head == udev->tail
Then the first thread goes to sleep and the second one pops the message
from the queue. Now assume udev->head == udev->tail. If the first thread
wakes up it will call wait_event_*() and sleep in the waitq. This
effectively turns the non-blocking FD into a blocking one.
We fix this by never calling wait_event_*() for non-blocking FDs hence we
will never sleep in the waitq here.
Signed-off-by: David Herrmann <redacted>
---
drivers/input/misc/uinput.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
On Fri, Mar 16, 2012 at 09:04:29PM +0100, David Herrmann wrote:
quoted hunk
Consider two threads calling read() on the same uinput-fd, both
non-blocking. Assume there is data-available so both will simultaneously
pass:
udev->head == udev->tail
Then the first thread goes to sleep and the second one pops the message
from the queue. Now assume udev->head == udev->tail. If the first thread
wakes up it will call wait_event_*() and sleep in the waitq. This
effectively turns the non-blocking FD into a blocking one.
We fix this by never calling wait_event_*() for non-blocking FDs hence we
will never sleep in the waitq here.
Signed-off-by: David Herrmann <redacted>
---
drivers/input/misc/uinput.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
From: David Herrmann <hidden> Date: 2012-03-26 20:28:10
Hi Dmitry
On Mon, Mar 19, 2012 at 6:25 PM, Aristeu Rozanski
[off-list ref] wrote:
On Fri, Mar 16, 2012 at 09:04:29PM +0100, David Herrmann wrote:
quoted
Consider two threads calling read() on the same uinput-fd, both
non-blocking. Assume there is data-available so both will simultaneously
pass:
udev->head == udev->tail
Then the first thread goes to sleep and the second one pops the message
from the queue. Now assume udev->head == udev->tail. If the first thread
wakes up it will call wait_event_*() and sleep in the waitq. This
effectively turns the non-blocking FD into a blocking one.
We fix this by never calling wait_event_*() for non-blocking FDs hence we
will never sleep in the waitq here.
Signed-off-by: David Herrmann <redacted>
---
drivers/input/misc/uinput.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
makes sense, patch looks good
Acked-by: Aristeu Rozanski <redacted>
Ping (and the other uinput fix ;)).
Regards
David
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html