linux/arch/um/include
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
..
skas uml: delete some unused headers 2008-02-05 09:44:26 -08:00
sysdep-i386 uml: tidy ptrace interface 2008-05-13 08:02:21 -07:00
sysdep-ia64 [PATCH] uml: S390 preparation, abstract host page fault data 2005-05-05 16:36:36 -07:00
sysdep-ppc Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
sysdep-x86_64 uml: tidy ptrace interface 2008-05-13 08:02:21 -07:00
aio.h [PATCH] uml: revert block driver use of host AIO 2005-10-12 08:22:26 -07:00
arch.h uml: further bugs.c tidying 2008-02-05 09:44:25 -08:00
as-layout.h uml: use PAGE_SIZE in linker scripts 2008-05-13 08:02:22 -07:00
chan_kern.h uml: remove a useless function 2008-04-28 08:58:28 -07:00
chan_user.h uml: fix URLs in Kconfig and help strings 2008-02-05 09:44:25 -08:00
common-offsets.h uml: cover stubs with a VMA 2008-02-05 09:44:29 -08:00
elf_user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
frame_kern.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
init.h uml: arch/um/include/init.h needs a definition of __used 2008-02-05 09:44:24 -08:00
initrd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irq_kern.h IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
irq_user.h uml: miscellaneous code cleanups 2008-02-05 09:44:29 -08:00
kern_util.h uml: get rid of syscall counters 2008-02-05 09:44:30 -08:00
kern.h [PATCH] uml: fix declaration of exit() 2006-03-27 08:44:37 -08:00
line.h uml: use __SPIN_LOCK_UNLOCKED 2008-05-13 08:02:22 -07:00
longjmp.h [PATCH] uml: make UML_SETJMP always safe 2006-10-11 11:14:20 -07:00
mconsole_kern.h [PATCH] uml: console whitespace and comment tidying 2007-02-11 10:51:21 -08:00
mconsole.h uml: remove os_* usage from userspace files 2007-10-16 09:43:06 -07:00
mem_kern.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mem_user.h uml: SMP locking commentary 2008-02-05 09:44:30 -08:00
mem.h uml: remove __u64 usage from physical memory subsystem 2007-10-16 09:43:05 -07:00
net_kern.h uml: network driver MTU cleanups 2007-10-16 09:43:08 -07:00
net_user.h uml: network driver MTU cleanups 2007-10-16 09:43:08 -07:00
os.h uml: random driver fixes 2008-05-13 08:02:22 -07:00
process.h uml: random driver fixes 2008-05-13 08:02:22 -07:00
ptrace_user.h uml: style fixes in arch/um/sys-x86_64 2008-02-05 09:44:31 -08:00
registers.h uml: fix FP register corruption 2008-02-23 17:12:15 -08:00
sigcontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sigio.h [PATCH] uml: SIGIO formatting fixes 2007-02-11 10:51:23 -08:00
skas_ptrace.h uml: style fixes 2008-05-13 08:02:21 -07:00
skas_ptregs.h [PATCH] uml makefiles sanitized 2005-09-29 08:46:26 -07:00
syscall.h [PATCH] uml: system call path cleanup 2005-09-05 00:06:23 -07:00
sysrq.h [PATCH] uml: stack dump fix 2005-05-28 16:46:13 -07:00
task.h uml: remove code made redundant by CHOOSE_MODE removal 2007-10-16 09:43:05 -07:00
tlb.h uml: clean up tlb flush path 2007-10-16 09:43:06 -07:00
ubd_user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
um_malloc.h uml: fix build when SLOB is enabled 2008-05-13 08:02:22 -07:00
um_mmu.h uml: fix mm_context memory leak 2008-02-08 09:22:43 -08:00
um_uaccess.h uml: header untangling 2008-02-05 09:44:28 -08:00
user.h uml: fix build for !CONFIG_PRINTK 2007-11-14 18:45:43 -08:00