summaryrefslogtreecommitdiffstats
path: root/include/asm-um/mman.h
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-05-12 14:01:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-13 08:02:22 -0700
commit5d33e4d7fd9a52d2673e5c730eab81856e100a74 (patch)
treec4d5014fa21ebde900441b4a5b51092a09c47823 /include/asm-um/mman.h
parent60a2988aea701a6424809a5432bf068667aac177 (diff)
downloadkernel-crypto-5d33e4d7fd9a52d2673e5c730eab81856e100a74.tar.gz
kernel-crypto-5d33e4d7fd9a52d2673e5c730eab81856e100a74.tar.xz
kernel-crypto-5d33e4d7fd9a52d2673e5c730eab81856e100a74.zip
uml: random driver fixes
The random driver would essentially hang if the host's /dev/random returned -EAGAIN. There was a test of need_resched followed by a schedule inside the loop, but that didn't help and it's the wrong way to work anyway. The right way is to ask for an interrupt when there is input available from the host and handle it then rather than polling. Now, when the host's /dev/random returns -EAGAIN, the driver asks for a wakeup when there's randomness available again and sleeps. The interrupt routine just wakes up whatever processes are sleeping on host_read_wait. There is an atomic_t, host_sleep_count, which counts the number of processes waiting for randomness. When this reaches zero, the interrupt is disabled. An added complication is that async I/O notification was only recently added to /dev/random (by me), so essentially all hosts will lack it. So, we use the sigio workaround here, which is to have a separate thread poll on the descriptor and send an interrupt when there is input on it. This mechanism is activated when a process gets -EAGAIN (activating this multiple times is harmless, if a bit wasteful) and deactivated by the last process still waiting. The module name was changed from "random" to "hw_random" in order for udev to recognize it. The sigio workaround needed some changes. sigio_broken was added for cases when we know that async notification doesn't work. This is now called from maybe_sigio_broken, which deals with pts devices. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-um/mman.h')
0 files changed, 0 insertions, 0 deletions