linux/arch/um/drivers
Jeff Dike 3d564047a5 uml: start fixing os_read_file and os_write_file
This patch starts the removal of a very old, very broken piece of code.  This
stems from the problem of passing a userspace buffer into read() or write() on
the host.  If that buffer had not yet been faulted in, read and write will
return -EFAULT.

To avoid this problem, the solution was to fault the buffer in before the
system call by touching the pages that hold the buffer by doing a copy-user of
a byte to each page.  This is obviously bogus, but it does usually work, in tt
mode, since the kernel and process are in the same address space and userspace
addresses can be accessed directly in the kernel.

In skas mode, where the kernel and process are in separate address spaces, it
is completely bogus because the userspace address, which is invalid in the
kernel, is passed into the system call instead of the corresponding physical
address, which would be valid.  Here, it appears that this code, on every host
read() or write(), tries to fault in a random process page.  This doesn't seem
to cause any correctness problems, but there is a performance impact.  This
patch, and the ones following, result in a 10-15% performance gain on a kernel
build.

This code can't be immediately tossed out because when it is, you can't log
in.  Apparently, there is some code in the console driver which depends on
this somehow.

However, we can start removing it by switching the code which does I/O using
kernel addresses to using plain read() and write().  This patch introduces
os_read_file_k and os_write_file_k for use with kernel buffers and converts
all call locations which use obvious kernel buffers to use them.  These
include I/O using buffers which are local variables which are on the stack or
kmalloc-ed.  Later patches will handle the less obvious cases, followed by a
mass conversion back to the original interface.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-07 12:13:03 -07:00
..
chan_kern.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
chan_user.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
cow_sys.h uml: remove user_util.h 2007-05-07 12:13:01 -07:00
cow_user.c [PATCH] uml: fix patch mismerge 2006-05-01 18:17:44 -07:00
cow.h [PATCH] uml: avoid warnings for diffent names for an unsigned quadword 2006-04-11 06:18:37 -07:00
daemon_kern.c [SK_BUFF]: Introduce skb_mac_header() 2007-04-25 22:24:41 -07:00
daemon_user.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
daemon.h [PATCH] uml: const more data 2006-09-27 08:26:15 -07:00
fd.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
harddog_kern.c [PATCH] mark struct file_operations const 2 2007-02-12 09:48:44 -08:00
harddog_user.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
hostaudio_kern.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
line.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
Makefile [PATCH] uml: revert block driver use of host AIO 2005-10-12 08:22:26 -07:00
mcast_kern.c [SK_BUFF]: Introduce skb_mac_header() 2007-04-25 22:24:41 -07:00
mcast_user.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
mcast.h [PATCH] uml: const more data 2006-09-27 08:26:15 -07:00
mconsole_kern.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
mconsole_user.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
mmapper_kern.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
net_kern.c uml: drivers get release methods 2007-05-07 12:13:02 -07:00
net_user.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
null.c [PATCH] uml: locking documentation 2006-09-29 09:18:04 -07:00
pcap_kern.c [SK_BUFF]: Introduce skb_mac_header() 2007-04-25 22:24:41 -07:00
pcap_user.c uml: network interface hotplug error handling 2007-05-07 12:13:00 -07:00
pcap_user.h [PATCH] missed const in prototype 2006-10-10 15:37:24 -07:00
port_kern.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
port_user.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
port.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pty.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
random.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
slip_common.c [PATCH] uml: slirp and slip driver cleanups and fixes 2005-06-13 20:58:43 -07:00
slip_common.h [PATCH] uml: fix hugest stack users 2006-02-01 08:53:22 -08:00
slip_kern.c [SK_BUFF]: Introduce skb_mac_header() 2007-04-25 22:24:41 -07:00
slip_user.c uml: remove page_size() 2007-05-07 12:13:02 -07:00
slip.h [PATCH] uml: const more data 2006-09-27 08:26:15 -07:00
slirp_kern.c [SK_BUFF]: Introduce skb_mac_header() 2007-04-25 22:24:41 -07:00
slirp_user.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
slirp.h [PATCH] uml: const more data 2006-09-27 08:26:15 -07:00
ssl.c uml: fix umid in xterm titles 2007-05-07 12:13:02 -07:00
ssl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
stderr_console.c [PATCH] uml: locking documentation 2006-09-29 09:18:04 -07:00
stdio_console.c uml: fix umid in xterm titles 2007-05-07 12:13:02 -07:00
stdio_console.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tty.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
ubd_kern.c uml: start fixing os_read_file and os_write_file 2007-05-07 12:13:03 -07:00
ubd_user.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
xterm_kern.c [PATCH] uml pt_regs fixes 2006-10-08 16:34:08 -07:00
xterm.c uml: remove user_util.h 2007-05-07 12:13:01 -07:00
xterm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00