linux-sg2042/arch
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
..
alpha [PATCH] make osf_select() use core_sys_select() 2008-05-01 13:07:28 -04:00
arm Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/nico/orion into fixes 2008-05-09 23:24:09 +01:00
avr32 unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
blackfin [Blackfin] arch: protect linux/usb/musb.h include until the driver gets mainlined 2008-05-10 00:08:12 +08:00
cris cris: kill sys_pipe implementation 2008-05-09 08:03:03 -07:00
frv unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
h8300 unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
ia64 Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2008-05-02 08:17:58 -07:00
m32r m32r: use generic sys_pipe 2008-05-09 08:04:56 -07:00
m68k m68k: remove old mac_esp cruft 2008-05-05 12:38:50 -07:00
m68knommu unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
mips [MIPS] Pb1000: bury the remnants of the PCI code 2008-05-12 16:46:56 +01:00
mn10300 BKL: revert back to the old spinlock implementation 2008-05-10 20:58:02 -07:00
parisc unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
powerpc [POWERPC] ppc: More compile fixes 2008-05-12 22:57:51 +10:00
ppc [POWERPC] ppc: More compile fixes 2008-05-12 22:57:51 +10:00
s390 [S390] guest page hinting light 2008-05-07 09:23:02 +02:00
sh SH: catch negative denormal_subf1() retval in denormal_add() 2008-05-09 20:05:10 +09:00
sparc sparc32: fix rtrap.S typo 2008-05-11 18:05:20 -07:00
sparc64 sparc64: Work around memory probing bug in openfirmware. 2008-05-11 21:04:48 -07:00
um uml: random driver fixes 2008-05-13 08:02:22 -07:00
v850 unified (weak) sys_pipe implementation 2008-05-03 13:50:33 -07:00
x86 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86 2008-05-10 21:10:48 -07:00
xtensa xtensa: use kbuild.h macros instead of defining them in asm-offsets.c 2008-04-29 08:06:29 -07:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig dma: add dma_*map*_attrs() interfaces 2008-04-29 08:06:11 -07:00