linux/arch/um
Jeff Dike 5d33e4d7fd 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>
2008-05-13 08:02:22 -07:00
..
drivers uml: random driver fixes 2008-05-13 08:02:22 -07:00
include uml: random driver fixes 2008-05-13 08:02:22 -07:00
kernel uml: physical memory shouldn't include initial stack 2008-05-13 08:02:22 -07:00
os-Linux uml: random driver fixes 2008-05-13 08:02:22 -07:00
scripts uml: throw out CONFIG_MODE_TT 2007-10-16 09:43:05 -07:00
sys-i386 uml: tidy ptrace interface 2008-05-13 08:02:21 -07:00
sys-ia64
sys-ppc Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sys-x86_64 uml: tidy ptrace interface 2008-05-13 08:02:21 -07:00
defconfig UML: update defconfig 2008-02-23 17:12:13 -08:00
Kconfig uml: runtime host VMSPLIT detection 2008-02-08 09:22:42 -08:00
Kconfig.char uml: fix CONFIG_RAW dependencies 2008-05-13 08:02:22 -07:00
Kconfig.debug uml: GPROF needs to depend on FRAME_POINTER 2008-02-05 09:44:25 -08:00
Kconfig.i386 x86, bitops: select the generic bitmap search functions 2008-04-26 19:21:17 +02:00
Kconfig.net uml: fix URLs in Kconfig and help strings 2008-02-05 09:44:25 -08:00
Kconfig.x86_64 x86, bitops: select the generic bitmap search functions 2008-04-26 19:21:17 +02:00
Makefile Revert "uml: fix gcc problem" 2008-05-06 17:09:27 -07:00
Makefile-i386 no need to mess with KBUILD_CFLAGS on uml-i386 anymore 2007-12-05 09:25:20 -08:00
Makefile-ia64
Makefile-os-Linux kbuild: enable 'make CFLAGS=...' to add additional options to CC 2007-10-14 22:21:35 +02:00
Makefile-ppc
Makefile-skas
Makefile-x86_64 x86 merge fallout: uml 2007-10-29 07:41:32 -07:00