Commit Graph

887 Commits (35a10a80daa04b7316d6bac1b1402cc347c35b1e)

Author SHA1 Message Date
Jeff Dike 1f6f61649d [PATCH] uml: include tidying
In order to get the __NR_* constants, we need sys/syscall.h.
linux/unistd.h works as well since it includes syscall.h, however syscall.h
is more parsimonious.  We were inconsistent in this, and this patch adds
syscall.h includes where necessary and removes linux/unistd.h includes
where they are not needed.

asm/unistd.h also includes the __NR_* constants, but these are not the
glibc-sanctioned ones, so this also removes one such inclusion.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-03 12:27:59 -08:00
Jeff Dike 53b173327d [PATCH] uml: fix I/O hang
Fix a UML hang in which everything would just stop until some I/O happened
- a ping, someone whacking the keyboard - at which point everything would
start up again as though nothing had happened.

The cause was gcc reordering some code which absolutely needed to be
executed in the order in the source.  When unblock_signals switches signals
from off to on, it needs to see if any interrupts had happened in the
critical section.  The interrupt handlers check signals_enabled - if it is
zero, then the handler adds a bit to the "pending" bitmask and returns.
unblock_signals checks this mask to see if any signals need to be
delivered.

The crucial part is this:
	signals_enabled = 1;
	save_pending = pending;
	if(save_pending == 0)
		return;
	pending = 0;

In order to avoid an interrupt arriving between reading pending and setting
it to zero, in which case, the record of the interrupt would be erased,
signals are enabled.

What happened was that gcc reordered this so that 'save_pending = pending'
came before 'signals_enabled = 1', creating a one-instruction window within
which an interrupt could arrive, set its bit in pending, and have it be
immediately erased.

When the I/O workload is purely disk-based, the loss of a block device
interrupt stops the entire I/O system because the next block request will
wait for the current one to finish.  Thus the system hangs until something
else causes some I/O to arrive, such as a network packet or console input.

The fix to this particular problem is a memory barrier between enabling
signals and reading the pending signal mask.  An xchg would also probably
work.

Looking over this code for similar problems led me to do a few more
things:

- make signals_enabled and pending volatile so that they don't get cached
  in registers

- add an mb() to the return paths of block_signals and unblock_signals so
  that the modification of signals_enabled doesn't get shuffled into the
  caller in the event that these are inlined in the future.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-03 12:27:58 -08:00
Jeff Dike d1480c56fe [PATCH] uml: add _text definition to linker scripts
kallsyms now refers to addresses as '_text + 0xADDRESS', rather than just
'0xADDRESS', so we need to define _text.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:07:00 -08:00
Paolo 'Blaisorblade' Giarrusso d8d7c28ec0 [PATCH] uml ubd driver: various little changes
Fix a small memory leak in ubd_config, and clearify the confusion which lead
to it.

Then, some little changes not affecting operations -
* move init functions together,
* add a comment about a potential problem in case of some evolution in the block layer,
* mark all initcalls as static __init functions
* mark an used once little function as inline
* document that mconsole methods are all called in process context (was
  triggered when checking ubd mconsole methods).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:07:00 -08:00
Paolo 'Blaisorblade' Giarrusso 0bf16bffee [PATCH] uml ubd driver: do not store error codes as ->fd
To simplify error handling, make sure fd is saved into ubd_dev->fd only when
we are sure it is an fd and not an error code.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:07:00 -08:00
Paolo 'Blaisorblade' Giarrusso 84e945e399 [PATCH] uml ubd driver: use bitfields where possible
Use bitfields for boolean fields in ubd data structure.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:07:00 -08:00
Paolo 'Blaisorblade' Giarrusso e7f6552f23 [PATCH] uml ubd driver: reformat ubd_config
Pure whitespace and style fixes split out from subsequent patch.  Some changes
(err -> ret) don't make sense now, only later, but I split them out anyway
since they cluttered the patch.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:07:00 -08:00
Paolo 'Blaisorblade' Giarrusso 2fe30a34a1 [PATCH] uml ubd driver: convert do_ubd to a boolean variable
do_ubd is actually just a boolean variable - the way it is used currently is a
leftover from the old 2.4 block layer, but it is still used; its use is
suspicious, but removing it would be too intrusive for now and needs more
thinking.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
Paolo 'Blaisorblade' Giarrusso 33f775eea1 [PATCH] uml ubd driver: ubd_io_lock usage fixup
Add some comments about requirements for ubd_io_lock and expand its use.

When an irq signals that the "controller" (i.e.  another thread on the host,
which does the actual requests and is the only one blocked on I/O on the host)
has done some work, we call again the request function ourselves
(do_ubd_request).

We now do that with ubd_io_lock held - that's useful to protect against
concurrent calls to elv_next_request and so on.

XXX: Maybe we shouldn't call at all the request function.  Input needed on
this.  Are we supposed to plug and unplug the queue?  That code "indirectly"
does that by setting a flag, called do_ubd, which makes the request function
return (it's a residual of 2.4 block layer interface).

Meanwhile, however, merge this patch, which improves things.

Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
Paolo 'Blaisorblade' Giarrusso d7fb2c3865 [PATCH] uml ubd driver: change ubd_lock to be a mutex
This lock protects ubd setup and teardown, so is only used in process context;
beyond that, during such setup memory allocations must be performed and some
generic functions which can sleep must be called (such as add_disk()).  So the
only correct solution is to make it a mutex instead of a spin_lock.  No other
change is done - this lock must be acquired in different places but it's done
afterwards.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
Paolo 'Blaisorblade' Giarrusso 5f75a4f887 [PATCH] uml ubd driver: give better names to some functions.
To rethink locking, I needed to understand well what each function does.
While doing this I renamed some:

* ubd_close -> ubd_close_dev (since it pairs with ubd_open_dev)

* ubd_new_disk -> ubd_disk_register (it handles registration with the block
  layer - one hopes this makes clearer the difference with ubd_add())

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
Paolo 'Blaisorblade' Giarrusso 7d314e346d [PATCH] uml ubd driver: var renames
Rename the ubd_dev array to ubd_devs and then call any "struct ubd" ubd_dev
instead of dev, which doesn't make clear what we're treating (and no, it's not
hungarian notation - not any more than calling all vm_area_struct vma or all
inodes inode).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
Paolo 'Blaisorblade' Giarrusso 2a9d32f682 [PATCH] uml ubd driver: document some struct fields
Add documentation about some fields in struct ubd, whose meaning is
non-obvious due to struct names (should change names altogether, I agree).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
Paolo 'Blaisorblade' Giarrusso 97d88ac835 [PATCH] uml ubd driver: allow using up to 16 UBD devices
With 256 minors and 16 minors used per each UBD device, we can allow the use
of up to 16 UBD devices per UML.

Also chnage parse_unit and leave to the caller (which already do it) the check
for excess numbers, since this is just supposed to do raw parsing.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-31 08:06:59 -08:00
akpm@osdl.org d45e44d4be [PATCH] uml: fix compilation options for USER_OBJS
From: Jeff Dike <jdike@addtoit.com>, Paolo Giarrusso <blaisorblade@yahoo.it>

Make sure that when compiling USER_OBJS the correct compilation options are
passed; since they are compiled with USER_CFLAGS which is derived from
CFLAGS, make sure it is a recursively evaluated variable, so that changes
to CFLAGS done afterwards the inclusion of arch/$(ARCH)/Makefile are
reflected in USER_CFLAGS.

For instance, without this patch userspace objects are never compiled with
debug info active.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-30 12:08:41 -08:00
Paolo 'Blaisorblade' Giarrusso b428b51ed9 [PATCH] Fix "Remove the use of _syscallX macros in UML"
Fix commit 5f4c6bc1f369f20807a8e753c2308d1629478c61: it spits out warnings
about missing syscall prototype (it is in <unistd.h>) and it does not
recognize that two uses of _syscallX are to be resolved against kernel
headers in the source tree, not against _syscallX; they in fact do not
compile and would not work anyway.

If _syscallX macros will be removed from the kernel tree altogether, the
only reasonable solution for that piece of code is switching to open-coded
inline assembly (it's remapping the whole executable from memory, except
the page containing this code).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-30 12:08:41 -08:00
Al Viro 3a51237dc1 [PATCH] uml: mconsole fixes
* when we have stop/sysrq/go, we get pt_regs of whatever executes
   mc_work_proc().  Would be better to see what we had at the time of
   interrupt that got us stop.

 * stop/stop/stop.....  will give stack overflow.  Shouldn't allow stop
   from mconsole_stop().

 * stop/stop/go leaves us inside mconsole_stop() with
	os_set_fd_block(req->originating_fd, 0);
	reactivate_fd(req->originating_fd, MCONSOLE_IRQ);
   just done by nested mconsole_stop().  Ditto.

 * once we'd seen stop, there's a period when INTR commands are executed
   out of order (as they should; we might have the things stuck badly
   enough to never reach mconsole_stop(), but still not badly enough to
   block mconsole_interrupt(); in that situation we _want_ things like
   "cad" to be executed immediately).  Once we enter monsole_stop(), all
   INTR commands will be executed in order, mixed with PROC ones.  We'd
   better let user see that such change of behaviour has happened.
   (Suggested by lennert).

 * stack footprint of monsole_interrupt() is an atrocity; AFAICS we can
   safely make struct mc_request req; static in function there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-24 22:01:10 -07:00
Paolo 'Blaisorblade' Giarrusso 1ba0ce6f9c [PATCH] uml: mmapper - remove just added but wrong "const" attribute
When enabling the mmapper driver I got warnings because this "const"
miscdevice structure is passed to function as non-const pointer; unlike struct
tty_operations, however, I verified that misc_{de,}register _do_ modify their
parameter, so this const attribute must be removed.

Since the purpose of the change was to guarantee that no lock was needed, add
a comment to prove this differently.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Paolo 'Blaisorblade' Giarrusso f43e6a5a72 [PATCH] uml: kconfig - silence warning
Silence useless warning about undefined symbol in Kconfig.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Paolo 'Blaisorblade' Giarrusso d9d645f06a [PATCH] uml: cleanup run_helper() API to fix a leak
Freeing the stack is left uselessly to the caller of run_helper in some cases
- this is taken from run_helper_thread, but here it is useless, so no caller
needs it and the only place where this happens has a potential leak - in case
of error neither run_helper() nor xterm_open() call free_stack().  At this
point passing a pointer is not needed - the stack pointer should be passed
directly, but this change is not done here.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Paolo 'Blaisorblade' Giarrusso b2670eacfb [PATCH] uml: use DEFCONFIG_LIST to avoid reading host's config
This should make sure that, for UML, host's configuration files are not
considered, which avoids various pains to the user.  Our dependency are such
that the obtained Kconfig will be valid and will lead to successful
compilation - however they cannot prevent an user from disabling any boot
device, and if an option is not set in the read .config (say
/boot/config-XXX), with make menuconfig ARCH=um, it is not set.  This always
disables UBD and all console I/O channels, which leads to non-working UML
kernels, so this bothers users - especially now, since it will happen on
almost every machine (/boot/config-`uname -r` exists almost on every machine).
 It can be workarounded with make defconfig ARCH=um, but it is non-obvious and
can be avoided, so please _do_ merge this patch.

Given the existence of options, it could be interesting to implement
(additionally) "option required" - with it, Kconfig will refuse reading a
.config file (from wherever it comes) if the given option is not set.  With
this, one could mark with it the option characteristic of the given
architecture (it was an old proposal of Roman Zippel, when I pointed out our
problem):

config UML
	option required
	default y

However this should be further discussed:
*) for x86, it must support constructs like:

==arch/i386/Kconfig==
config 64BIT
	option required
	default n
where Kconfig must require that CONFIG_64BIT is disabled or not present in the
read .config.

*) do we want to do such checks only for the starting defconfig or also for
   .config? Which leads to:
*) I may want to port a x86_64 .config to x86 and viceversa, or even among more
   different archs. Should that be allowed, and in which measure (the user may
   force skipping the check for a .config or it is only given a warning by
   default)?

Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: <kbuild-devel@lists.sourceforge.net>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Paolo 'Blaisorblade' Giarrusso 493e3758be [PATCH] uml: reenable compilation of enable_timer, disabled by mistake
CONFIG_MODE_TT does not work there, the UML_ prefixed version must be used -
this causes a link-time failure when CONFIG_MODE_TT is enabled (i.e.  always
here, never by Jeff).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Paolo 'Blaisorblade' Giarrusso 8b028bcd0e [PATCH] uml: code convention cleanup of a file
Fix coding conventions violations is arch/um/os-Linux/helper.c.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Paolo 'Blaisorblade' Giarrusso c13e569073 [PATCH] uml: split memory allocation prototypes out of user.h
user.h is too generic a header name.  I've split out allocation routines from
it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:36 -07:00
Jeff Dike 1a3e9ad163 [PATCH] uml: MODE_TT is bust
arch/um/sys-x86_64/ptrace.c:20:1: warning: "SC_SS" redefined
In file included from arch/um/include/sysdep/ptrace.h:18,
                 from include/asm/ptrace-generic.h:12,
                 from include/asm/ptrace.h:15,
                 from arch/um/sys-x86_64/ptrace.c:8:
arch/um/include/sysdep/sc.h:38:1: warning: this is the location of the previous definition
arch/um/sys-x86_64/ptrace.c: In function 'putreg':
arch/um/sys-x86_64/ptrace.c:63: warning: implicit declaration of function 'SC_FS_BASE'
arch/um/sys-x86_64/ptrace.c:63: error: invalid lvalue in unary '&'
arch/um/sys-x86_64/ptrace.c:63: warning: implicit declaration of function 'SC_GS_BASE'
arch/um/sys-x86_64/ptrace.c:63: error: invalid lvalue in unary '&'
arch/um/sys-x86_64/ptrace.c: In function 'getreg':
arch/um/sys-x86_64/ptrace.c:101: error: invalid lvalue in unary '&'
arch/um/sys-x86_64/ptrace.c:101: error: invalid lvalue in unary '&'

I'd have to say that the fix for this, for now, is this:

Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-20 10:26:35 -07:00
Ulrich Drepper 51018b0a31 [PATCH] make UML compile (FC6/x86-64)
I need this patch to get a UML kernel to compile.  This is with the
kernel headers in FC6 which are automatically generated from the kernel
tree.  Some headers are missing but those files don't need them.  At
least it appears so since the resuling kernel works fine.

Tested on x86-64.

Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-15 14:18:39 -07:00
Paolo 'Blaisorblade' Giarrusso c21be1c9c1 [PATCH] uml: allow finer tuning for host VMSPLIT setting
Now that various memory splits are enabled, add a config option allowing the
user to compile UML for its need - HOST_2G_2G allowed to choose either 3G/1G
or 2G/2G, and enabling it reduced the usable virtual memory.

Detecting this at run time should be implemented in the future, but we must
make the stop-gap measure work well enough (this is valid in _many_ cases).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:21 -07:00
Paolo 'Blaisorblade' Giarrusso ca316fcf64 [PATCH] uml: deprecate CONFIG_MODE_TT
Deprecate TT mode in Kconfig so that users won't select it, update the
MODE_SKAS description (it was largely obsolete and misleadin) and btw describe
advantages for high memory usage with CONFIG_STATIC_LINK.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:21 -07:00
Paolo 'Blaisorblade' Giarrusso f2d57151bd [PATCH] uml: remove duplicate export
The export is together with the definition, in arch/x86_64/lib/csum-partial.c,
which is compiled in by arch/um/sys-x86_64/Makefile.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso d27ecef7c6 [PATCH] uml: asm offsets duplication removal
Unify macros common to x86 and x86_64 kernel-offsets.h files.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso 2465b8580a [PATCH] uml: allow using again x86/x86_64 crypto code
Enable compilation of x86_64 crypto code;, and add the needed constant to make
the code compile again (that macro was added to i386 asm-offsets between
2.6.17 and 2.6.18, in 6c2bb98bc3).

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso 711553efa5 [PATCH] uml: declare in Kconfig our partial LOCKDEP support
Declare UML partial support for LOCKDEP - however IRQFLAGS tracing requires
some coding which nobody did yet, so we cannot run full lockdep on UML.  Grep
for CONFIG_TRACE_IRQFLAGS on i386 code to find their implementation.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso 69fada32d8 [PATCH] uml: fix uname under setarch i386
On a 64bit Uml, if run under "setarch i386" (which a user did), uname()
currently returns the obtained i686 as machine - fix that.  Btw, I'm quite
surprised that under setarch i386 a 64-bit binary can run.

Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso b5cdb5797d [PATCH] uml: make UML_SETJMP always safe
If enable is moved by GCC in a register its value may not be preserved after
coming back there with longjmp().  So, mark it as volatile to prevent this;
this is suggested (it seems) in info gcc, when it talks about -Wuninitialized.
 I re-read this and it seems to say something different, but I still believe
this may be needed.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso d875f9fd3f [PATCH] uml: make TT mode compile after setjmp-related changes
Make TT mode compile after the introduction of klibc's implementation of
setjmp.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso e27e80b3da [PATCH] uml: readd forgot prototype
This was forgot in a previous patch so UML does not compile with TT mode
enabled.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso 21c935e529 [PATCH] uml: correct removal of pte_mkexec
Correct commit 5906e4171a - this makes more
sense: we turn pte_mkexec + pte_wrprotect to pte_mkread.  However, due to a
bug in pte_mkread, it does the exact same thing as pte_mkwrite, so this patch
improves the code but does not change anything in practice.  The pte_mkread
bug is fixed separately, as it may have big impact.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:20 -07:00
Paolo 'Blaisorblade' Giarrusso 1875a48fed [PATCH] uml: revert wrong patch
Andi Kleen pointed out that -mcmodel=kernel does not make sense for userspace
code and would stop everything from working, and pointed out the correct fix
for the original bug (not easy to do for me).

Reverts part of commit 06837504de.

Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:19 -07:00
Al Viro 59bd598426 [PATCH] missed const in prototype
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-10 15:37:24 -07:00
David Howells 40220c1a19 IRQ: Use the new typedef for interrupt handler function pointers
Use the new typedef for interrupt handler function pointers rather than
actually spelling out the full thing each time.  This was scripted with the
following small shell script:

#!/bin/sh
egrep -nHrl -e 'irqreturn_t[ 	]*[(][*]' $* |
while read i
do
    echo $i
    perl -pi -e 's/irqreturn_t\s*[(]\s*[*]\s*([_a-zA-Z0-9]*)\s*[)]\s*[(]\s*int\s*,\s*void\s*[*]\s*[)]/irq_handler_t \1/g' $i || exit $?
done

Signed-Off-By: David Howells <dhowells@redhat.com>
2006-10-09 12:19:47 +01:00
Al Viro 7bea96fd22 [PATCH] uml pt_regs fixes
Real fix for UML pt_regs stuff.  Note set_irq_regs() logics in there...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-08 16:34:08 -07:00
Pekka Enberg 96e1a87392 [PATCH] um: irq changes break build
Fixup broken UML build due to 7d12e780e0
"IRQ: Maintain regs pointer globally rather than passing to IRQ handlers".

Cc: David Howells <dhowells@redhat.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo "Blaisorblade" Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-06 08:53:42 -07:00
Dave Jones 038b0a6d8d Remove all inclusions of <linux/config.h>
kbuild explicitly includes this at build time.

Signed-off-by: Dave Jones <davej@redhat.com>
2006-10-04 03:38:54 -04:00
Matt LaPlante 44c09201a4 more misc typo fixes
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-10-03 22:34:14 +02:00
Matt LaPlante 4b3f686d4a Attack of "the the"s in arch
The patch below corrects multiple occurances of "the the"
typos across several files, both in source comments and KConfig files.
There is no actual code changed, only text.  Note this only affects the /arch
directory, and I believe I could find many more elsewhere. :)

Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-10-03 22:21:02 +02:00
Arnd Bergmann 5f4c6bc1f3 [PATCH] Remove the use of _syscallX macros in UML
User mode linux uses _syscallX() to call into the host kernel.  The
recommended way to do this is to use the syscall() function from libc.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:23 -07:00
Arnd Bergmann 3db03b4afb [PATCH] rename the provided execve functions to kernel_execve
Some architectures provide an execve function that does not set errno, but
instead returns the result code directly.  Rename these to kernel_execve to
get the right semantics there.  Moreover, there is no reasone for any of these
architectures to still provide __KERNEL_SYSCALLS__ or _syscallN macros, so
remove these right away.

[akpm@osdl.org: build fix]
[bunk@stusta.de: build fix]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andi Kleen <ak@muc.de>
Acked-by: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:23 -07:00
Serge E. Hallyn 96b644bdec [PATCH] namespaces: utsname: use init_utsname when appropriate
In some places, particularly drivers and __init code, the init utsns is the
appropriate one to use.  This patch replaces those with a the init_utsname
helper.

Changes: Removed several uses of init_utsname().  Hope I picked all the
	right ones in net/ipv4/ipconfig.c.  These are now changed to
	utsname() (the per-process namespace utsname) in the previous
	patch (2/7)

[akpm@osdl.org: CIFS fix]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:21 -07:00
Serge E. Hallyn e9ff3990f0 [PATCH] namespaces: utsname: switch to using uts namespaces
Replace references to system_utsname to the per-process uts namespace
where appropriate.  This includes things like uname.

Changes: Per Eric Biederman's comments, use the per-process uts namespace
	for ELF_PLATFORM, sunrpc, and parts of net/ipv4/ipconfig.c

[jdike@addtoit.com: UML fix]
[clg@fr.ibm.com: cleanup]
[akpm@osdl.org: build fix]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:21 -07:00
Serge E. Hallyn 0437eb594e [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c
Move the init_nsproxy definition out of arch/ into kernel/nsproxy.c.  This
avoids all arches having to be updated.  Compiles and boots on s390.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:20 -07:00
Serge E. Hallyn ab516013ad [PATCH] namespaces: add nsproxy
This patch adds a nsproxy structure to the task struct.  Later patches will
move the fs namespace pointer into this structure, and introduce a new utsname
namespace into the nsproxy.

The vserver and openvz functionality, then, would be implemented in large part
by virtualizing/isolating more and more resources into namespaces, each
contained in the nsproxy.

[akpm@osdl.org: build fix]
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:20 -07:00
Jeff Dike b68e31d0eb [PATCH] const struct tty_operations
As part of an SMP cleanliness pass over UML, I consted a bunch of
structures in order to not have to document their locking.  One of these
structures was a struct tty_operations.  In order to const it in UML
without introducing compiler complaints, the declaration of
tty_set_operations needs to be changed, and then all of its callers need to
be fixed.

This patch declares all struct tty_operations in the tree as const.  In all
cases, they are static and used only as input to tty_set_operations.  As an
extra check, I ran an i386 allyesconfig build which produced no extra
warnings.

53 drivers are affected.  I checked the history of a bunch of them, and in
most cases, there have been only a handful of maintenance changes in the
last six months.  serial_core.c was the busiest one that I looked at.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:14 -07:00
Jens Axboe cdd6026217 [PATCH] Remove ->rq_status from struct request
After Christophs SCSI change, the only usage left is RQ_ACTIVE
and RQ_INACTIVE. The block layer sets RQ_INACTIVE right before freeing
the request, so any check for RQ_INACTIVE in a driver is a bug and
indicates use-after-free.

So kill/clean the remaining users, straight forward.

Signed-off-by: Jens Axboe <axboe@suse.de>
2006-09-30 20:29:23 +02:00
Ollie Wild d6c641026d [PATCH] uml build fix
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 15:58:21 -07:00
Atsushi Nemoto 3171a0305d [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)
Pass ticks to do_timer() and update_times(), and adjust x86_64 and s390
timer interrupt handler with this change.

Currently update_times() calculates ticks by "jiffies - wall_jiffies", but
callers of do_timer() should know how many ticks to update.  Passing ticks
get rid of this redundant calculation.  Also there are another redundancy
pointed out by Martin Schwidefsky.

This cleanup make a barrier added by
5aee405c66 needless.  So this patch removes
it.

As a bonus, this cleanup make wall_jiffies can be removed easily, since now
wall_jiffies is always synced with jiffies.  (This patch does not really
remove wall_jiffies.  It would be another cleanup patch)

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Acked-by: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Acked-by: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:15 -07:00
Sukadev Bhattiprolu f400e198b2 [PATCH] pidspace: is_init()
This is an updated version of Eric Biederman's is_init() patch.
(http://lkml.org/lkml/2006/2/6/280).  It applies cleanly to 2.6.18-rc3 and
replaces a few more instances of ->pid == 1 with is_init().

Further, is_init() checks pid and thus removes dependency on Eric's other
patches for now.

Eric's original description:

	There are a lot of places in the kernel where we test for init
	because we give it special properties.  Most  significantly init
	must not die.  This results in code all over the kernel test
	->pid == 1.

	Introduce is_init to capture this case.

	With multiple pid spaces for all of the cases affected we are
	looking for only the first process on the system, not some other
	process that has pid == 1.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: <lxc-devel@lists.sourceforge.net>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:12 -07:00
Jeff Dike 5906e4171a [PATCH] uml: remove pte_mkexec
Andi is making pte_mkexec go away, and UML had one of the last uses.

This removes the use and the definition.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike fade5d5461 [PATCH] uml: don't roll my own random MAC generator
Use the existing random_ether_addr() instead of cooking up my own
version.  Pointed out by Dave Hollis and Jason Lunz.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike 3b89af765c [PATCH] uml: remove unneeded file
Remove arch/um/kernel/skas/process_kern.c again.  The stack alignment
change which resulted in this file being here is safely in
arch/um/kernel/process.c.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike f92afe56a0 [PATCH] uml: stack consumption reduction
Fix some stack abuse in the sysrq t path.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike 80c1374914 [PATCH] uml: close file descriptor leaks
Close two file descriptor leaks, one in the ubd driver and one to
/proc/mounts.  The ubd driver bug also leaked some vmalloc space.  The
/proc/mounts leak was a descriptor that was just never closed.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike 730760e90a [PATCH] uml: locking documentation
Some locking documentation and a cleanup.  uml_exitcode is copied into a local
before sprintf sees it, in case sprintf does anything non-atomic with it.

The rest are comments about why certain globals don't need any kind of
locking.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike b10aeeef55 [PATCH] uml: mechanical tidying after random MACs change
Mechanical, hopefully non-functional changes stemming from
setup_etheraddr always succeeding now that it always assigns a MAC,
either from the command line or generated randomly:
   the test of the return of setup_etheraddr is removed, and code
dependent on it succeeding is now unconditional
   setup_etheraddr can now be made void
   struct uml_net.have_mac is now always 1, so tests of it can be
similarly removed, and uses of it can be replaced with 1
   struct uml_net.have_mac is no longer used, so it can be removed
   struct uml_net_private.have_mac is copied from struct uml_net, so
it is always 1
   tests of uml_net_private.have_mac can be removed
   uml_net_private.have_mac can now be removed
   the only call to dev_ip_addr was removed, so it can be deleted

It also turns out that setup_etheraddr is called only once, from the same
file, so it can be static and its declaration removed from net_kern.h.

Similarly, set_ether_mac is defined and called only from one file.

Finally, setup_etheraddr and set_ether_mac were moved to avoid needing forward
declarations.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike f3e7ed2b61 [PATCH] uml: assign random MACs to interfaces if necessary
Assign a random MAC to an ethernet interface if one was not provided on the
command line.  This became pressing when distros started bringing interfaces
up before assigning IPs to them.  The previous pattern of assigning an IP then
bringing it up allowed the MAC to be generated from the first IP assigned.
However, once the thing is up, it's probably a bad idea to change the MAC, so
the MAC stayed initialized to fe:fd:0:0:0:0.

Now, if there is no MAC from the command line, one is generated.  We use the
microseconds from gettimeofday (20 bits), plus the low 12 bits of the pid to
seed the random number generator.  random() is called twice, with 16 bits of
each result used.  I didn't want to have to try to fill in 32 bits optimally
given an arbitrary RAND_MAX, so I just assume that it is greater than 65536
and use 16 bits of each random() return.

There is also a bit of reformatting and whitespace cleanup here.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Al Viro a144ea4b7a [IPV4]: annotate struct in_ifaddr
ifa_local, ifa_address, ifa_mask, ifa_broadcast and ifa_anycast are
net-endian.  Annotated them and variables that are inferred to be
net-endian.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-09-28 18:00:55 -07:00
Jeff Dike 1183dc943c [PATCH] uml: fix allocation size
Fix an instance of ptr=alloc(sizeof(ptr)).  Grepping showed no more instances
of this pattern.

Also fixed the formatting in the area.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike c1b4098d48 [PATCH] uml: fix sleep length bug
um_timer shouldn't add local_offset to the host time since get_time already
did it.  This threw off sleep when a settimeofday or equivalent had happened.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike db9d988eaa [PATCH] uml: add an export
Some modules need strnlen_user_skas.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike 995473aec0 [PATCH] uml: file renaming
Move some foo_kern.c files to foo.c now that the old foo.c files are out
of the way.

Also cleaned up some whitespace and an emacs formatting comment.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike 3c91735099 [PATCH] uml: thread creation tidying
fork on UML has always somewhat subtle.  The underlying cause has been the
need to initialize a stack for the new process.  The only portable way to
initialize a new stack is to set it as the alternate signal stack and take a
signal.  The signal handler does whatever initialization is needed and jumps
back to the original stack, where the fork processing is finished.  The basic
context switching mechanism is a jmp_buf for each process.  You switch to a
new process by longjmping to its jmp_buf.

Now that UML has its own implementation of setjmp and longjmp, and I can poke
around inside a jmp_buf without fear that libc will change the structure, a
much simpler mechanism is possible.  The jmpbuf can simply be initialized by
hand.

This eliminates -
	the need to set up and remove the alternate signal stack
	sending and handling a signal
	the signal blocking needed around the stack switching, since
there is no stack switching
	setting up the jmp_buf needed to jump back to the original
stack after the new one is set up

In addition, since jmp_buf is now defined by UML, and not by libc, it can be
embedded in the thread struct.  This makes it unnecessary to have it exist on
the stack, where it used to be.  It also simplifies interfaces, since the
switch jmp_buf used to be a void * inside the thread struct, and functions
which took it as an argument needed to define a jmp_buf variable and assign it
from the void *.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike 0915ee38c7 [PATCH] uml: mark some tt-mode code
Mark a symbol and file as being tt-mode only.  This shrinks the binary
slightly when tt mode support is compiled out and makes it easier to identity
stuff when tt mode is removed.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike 53dd2b55c5 [PATCH] uml: use correct SIGBUS handler
BB noticed that we had the wrong bus error handler.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike 09b185a316 [PATCH] uml: fix gcov support
Make __bb_init_func weak in order to avoid a link failure with some libcs
and/or gccs.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike a8b4fc4d7c [PATCH] uml: fix missing x86_64 register definitions
The UML/x86_64 headers were missing ptrace support for some segment registers.
 The underlying problem was that the x86_64 kernel uses user_regs_struct
rather than the ptrace register definitions in ptrace.  This patch switches
UML/x86_64 to using user_regs_struct for its definitions of the host's
registers.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Jeff Dike 0715501bf1 [PATCH] uml: get rid of ZONE_DMA use
ZONE_DMA might become dependent on CONFIG_ZONE_DMA, which UML doesn't define
(we're still arguing about this) So, let's change ZONE_DMA to ZONE_NORMAL.

This is prompted by optional-zone_dma-in-the-vm.patch, but should be harmless
on its own.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Christoph Lameter <clameter@engr.sgi.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:15 -07:00
Jeff Dike 5e7672ec3f [PATCH] uml: const more data
Make lots of structures const in order to make it obvious that they need no
locking.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:15 -07:00
Paolo 'Blaisorblade' Giarrusso 48af05ed54 [PATCH] uml: fix proc-vs-interrupt context spinlock deadlock
This spinlock can be taken on interrupt too, so spin_lock_irq[save] must be
used.

However, Documentation/networking/netdevices.txt explains we are called with
rtnl_lock() held - so we don't need to care about other concurrent opens.
Verified also in LDD3 and by direct checking.  Also verified that the network
layer (through a state machine) guarantees us that nobody will close the
interface while it's being used.  Please correct me if I'm wrong.

Also, we must check we don't sleep with irqs disabled!!!  But anyway, this is
not news - we already can't sleep while holding a spinlock.  Who says this is
guaranted really by the present code?

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:15 -07:00
Paolo 'Blaisorblade' Giarrusso 06837504de [PATCH] uml: use -mcmodel=kernel for x86_64
We have never used this flag and recently one user experienced a complaining
warning about this (there was a symbol in the positive half of the address space
IIRC). So fix it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:15 -07:00
Linus Torvalds b278240839 Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (225 commits)
  [PATCH] Don't set calgary iommu as default y
  [PATCH] i386/x86-64: New Intel feature flags
  [PATCH] x86: Add a cumulative thermal throttle event counter.
  [PATCH] i386: Make the jiffies compares use the 64bit safe macros.
  [PATCH] x86: Refactor thermal throttle processing
  [PATCH] Add 64bit jiffies compares (for use with get_jiffies_64)
  [PATCH] Fix unwinder warning in traps.c
  [PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1
  [PATCH] x86: Move direct PCI scanning functions out of line
  [PATCH] i386/x86-64: Make all early PCI scans dependent on CONFIG_PCI
  [PATCH] Don't leak NT bit into next task
  [PATCH] i386/x86-64: Work around gcc bug with noreturn functions in unwinder
  [PATCH] Fix some broken white space in ia32_signal.c
  [PATCH] Initialize argument registers for 32bit signal handlers.
  [PATCH] Remove all traces of signal number conversion
  [PATCH] Don't synchronize time reading on single core AMD systems
  [PATCH] Remove outdated comment in x86-64 mmconfig code
  [PATCH] Use string instructions for Core2 copy/clear
  [PATCH] x86: - restore i8259A eoi status on resume
  [PATCH] i386: Split multi-line printk in oops output.
  ...
2006-09-26 13:07:55 -07:00
Alan Cox b1fc0b1f21 [PATCH] UML: tty locking
Ensure current->signal->tty doesn't get freed during log_exec().

Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:09 -07:00
Jeff Dike 75e29b18d9 [PATCH] uml: stack usage reduction
The KSTK_* macros used an inordinate amount of stack.  In order to overcome
an impedance mismatch between their interface, which just returns a single
register value, and the interface of get_thread_regs, which took a full
pt_regs, the implementation created an on-stack pt_regs, filled it in, and
returned one field.  do_task_stat calls KSTK_* twice, resulting in two
local pt_regs, blowing out the stack.

This patch changes the interface (and name) of get_thread_regs to just
return a single register from a jmp_buf.

The include of archsetjmp.h" in registers.h to get the definition of
jmp_buf exposed a bogus include of <setjmp.h> in start_up.c.  <setjmp.h>
shouldn't be used anywhere any more since UML uses the klibc
setjmp/longjmp.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:09 -07:00
Paolo 'Blaisorblade' Giarrusso bf61f50d63 [PATCH] uml: clean our set_ether_mac
Clean set_ether_mac usage.  Maybe could also be removed, but surely it can't
be a global function taking a void* argument.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:09 -07:00
Jeff Dike 602cc24181 [PATCH] uml: Remove unused variable
timer_irq_inited was useless, so it is removed.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:08 -07:00
Jeff Dike 537ae946e8 [PATCH] uml: timer cleanups
set_interval returns an error instead of panicing if setitimer fails.  Some of
its callers now check the return.

enable_timer is largely tt-mode-specific, so it is marked as such, and the
only skas-mode caller is made to call set-interval instead.

user_time_init was a no-value-added wrapper around set_interval, so it is
gone.

Since set_interval is now called from kernel code, callers no longer pass
ITIMER_* to it.  Instead, they pass a flag which is converted into ITIMER_REAL
or ITIMER_VIRTUAL.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:08 -07:00
Jeff Dike 4b84c69b5f [PATCH] uml: Move signal handlers to arch code
Have most signals go through an arch-provided handler which recovers the
sigcontext and then calls a generic handler.  This replaces the
ARCH_GET_SIGCONTEXT macro, which was somewhat fragile.  On x86_64, recovering
%rdx (which holds the sigcontext pointer) must be the first thing that
happens.  sig_handler duly invokes that first, but there is no guarantee that
I can see that instructions won't be reordered such that %rdx is used before
that.  Having the arch provide the handler seems much more robust.

Some signals in some parts of UML require their own handlers - these places
don't call set_handler any more.  They call sigaction or signal themselves.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:07 -07:00
Jeff Dike 19bdf0409f [PATCH] uml: SIGIO cleanups
- Various cleanups in the sigio code.

- Removed explicit zero-initializations of a few structures.

- Improved some error messages.

- An API change - there was an asymmetry between reactivate_fd calling
  maybe_sigio_broken, which goes through all the machinery of figuring out if
  a file descriptor supports SIGIO and applying the workaround to it if not,
  and deactivate_fd, which just turns off the descriptor.

  This is changed so that only activate_fd calls maybe_sigio_broken, when
  the descriptor is first seen.  reactivate_fd now calls add_sigio_fd, which
  is symmetric with ignore_sigio_fd.

  This removes a recursion which makes a critical section look more critical
  than it really was, obsoleting a big comment to that effect.  This requires
  keeping track of all descriptors which are getting the SIGIO treatment, not
  just the ones being polled at any given moment, so that reactivate_fd,
  through add_sigio_fd, doesn't try to tell the SIGIO thread about descriptors
  it doesn't care about.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:07 -07:00
Jeff Dike 6edf428ed1 [PATCH] uml: Improve SIGBUS diagnostics
UML can get a SIGBUS anywhere if the tmpfs mount being used for its memory
runs out of space.  This patch adds a printk before the panic to provide a
clue as to what likely went wrong.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:07 -07:00
Jeff Dike 6b7aaad9ba [PATCH] uml: Fix handling of failed execs of helpers
There were some bugs in handling failures to exec helper programs.  errno was
passed back from the child with the wrong sign.  It was also ignored.  In the
case where it mattered, the errno from the (successful) read in the parent was
used instead.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:06 -07:00
Jeff Dike 5e1f65a67d [PATCH] uml: Whitespace fixes
arch/um/kernel/tlb.c had some pretty serious whitespace problems.  I also
fixed some returns.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:06 -07:00
Jeff Dike 8f80e9466e [PATCH] uml: Fix stack alignment
Stack randomization needs to be conditional on the personality allowing it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:05 -07:00
Jeff Dike 91b165c059 [PATCH] uml: Use ARRAY_SIZE more assiduously
There were a bunch of missed ARRAY_SIZE opportunities.

Also, some formatting fixes in the affected areas of code.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:05 -07:00
Jeff Dike 13c06be399 [PATCH] uml: Use klibc setjmp/longjmp
This patch adds an implementation of setjmp and longjmp to UML, allowing
access to the inside of a jmpbuf without needing the access macros formerly
provided by libc.

The implementation is stolen from klibc.  I copy the relevant files into
arch/um.  I have another patch which avoids the copying, but requires klibc be
in the tree.

setjmp and longjmp users required some tweaking.  Includes of <setjmp.h> were
removed and includes of the UML longjmp.h were added where necessary.  There
are also replacements of siglongjmp with UML_LONGJMP which I somehow missed
earlier.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:05 -07:00
Dave McCracken 46a82b2d55 [PATCH] Standardize pxx_page macros
One of the changes necessary for shared page tables is to standardize the
pxx_page macros.  pte_page and pmd_page have always returned the struct
page associated with their entry, while pte_page_kernel and pmd_page_kernel
have returned the kernel virtual address.  pud_page and pgd_page, on the
other hand, return the kernel virtual address.

Shared page tables needs pud_page and pgd_page to return the actual page
structures.  There are very few actual users of these functions, so it is
simple to standardize their usage.

Since this is basic cleanup, I am submitting these changes as a standalone
patch.  Per Hugh Dickins' comments about it, I am also changing the
pxx_page_kernel macros to pxx_page_vaddr to clarify their meaning.

Signed-off-by: Dave McCracken <dmccr@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:48:51 -07:00
Christoph Lameter e53ef38d05 [PATCH] reduce MAX_NR_ZONES: make ZONE_HIGHMEM optional
Make ZONE_HIGHMEM optional

- ifdef out code and definitions related to CONFIG_HIGHMEM

- __GFP_HIGHMEM falls back to normal allocations if there is no
  ZONE_HIGHMEM

- GFP_ZONEMASK becomes 0x01 if there is no DMA32 and no HIGHMEM
  zone.

[jdike@addtoit.com: build fix]
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Christoph Lameter <clameter@engr.sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:48:46 -07:00
Christoph Lameter c1f60a5a41 [PATCH] reduce MAX_NR_ZONES: move HIGHMEM counters into highmem.c/.h
Move totalhigh_pages and nr_free_highpages() into highmem.c/.h

Move the totalhigh_pages definition into highmem.c/.h.  Move the
nr_free_highpages function into highmem.c

[yoichi_yuasa@tripeaks.co.jp: build fix]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:48:46 -07:00
Andi Kleen ecaf45ee5c [PATCH] i386: Redo semaphore and rwlock assembly helpers
- Move them to a pure assembly file. Previously they were in
a C file that only consisted of inline assembly. Doing it in pure
assembler is much nicer.
- Add a frame.i include with FRAME/ENDFRAME macros to easily
add frame pointers to assembly functions
- Add dwarf2 annotation to them so that the new dwarf2 unwinder
doesn't get stuck on them
- Random cleanups

Includes feedback from Jan Beulich and a UML build fix from Andrew
Morton.

Cc: jbeulich@novell.com
Cc: jdike@addtoit.com
Signed-off-by: Andi Kleen <ak@suse.de>
2006-09-26 10:52:29 +02:00
Roland McGrath 0b0bf7a3cc [PATCH] vDSO hash-style fix
The latest toolchains can produce a new ELF section in DSOs and
dynamically-linked executables.  The new section ".gnu.hash" replaces
".hash", and allows for more efficient runtime symbol lookups by the
dynamic linker.  The new ld option --hash-style={sysv|gnu|both} controls
whether to produce the old ".hash", the new ".gnu.hash", or both.  In some
new systems such as Fedora Core 6, gcc by default passes --hash-style=gnu
to the linker, so that a standard invocation of "gcc -shared" results in
producing a DSO with only ".gnu.hash".  The new ".gnu.hash" sections need
to be dealt with the same way as ".hash" sections in all respects; only the
dynamic linker cares about their contents.  To work with older dynamic
linkers (i.e.  preexisting releases of glibc), a binary must have the old
".hash" section.  The --hash-style=both option produces binaries that a new
dynamic linker can use more efficiently, but an old dynamic linker can
still handle.

The new section runs afoul of the custom linker scripts used to build vDSO
images for the kernel.  On ia64, the failure mode for this is a boot-time
panic because the vDSO's PT_IA_64_UNWIND segment winds up ill-formed.

This patch addresses the problem in two ways.

First, it mentions ".gnu.hash" in all the linker scripts alongside ".hash".
 This produces correct vDSO images with --hash-style=sysv (or old tools),
with --hash-style=gnu, or with --hash-style=both.

Second, it passes the --hash-style=sysv option when building the vDSO
images, so that ".gnu.hash" is not actually produced.  This is the most
conservative choice for compatibility with any old userland.  There is some
concern that some ancient glibc builds (though not any known old production
system) might choke on --hash-style=both binaries.  The optimizations
provided by the new style of hash section do not really matter for a DSO
with a tiny number of symbols, as the vDSO has.  If someone wants to use
=gnu or =both for their vDSO builds and worry less about that
compatibility, just change the option and the linker script changes will
make any choice work fine.

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-31 13:28:43 -07:00
Jeff Dike b5032a50ae [PATCH] UML - fix utsname build breakage
Some -mm-only material leaked into a patch destined for mainline, and I didn't
notice.

This was the replacement of system_utsname with utsname() that's required by
the uts namespace patch.  This patch reverts those changes (which are correct
in -mm) so that mainline UML builds again.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-15 14:42:24 -07:00
Jeff Dike 329c6e4257 [PATCH] uml: header formatting cleanups
Clean up whitespace and return syntax in os.h.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-14 21:53:52 -07:00
Jeff Dike b076bb02ee [PATCH] uml: tidy biarch gcc support
On top of the previous biarch changes for UML, this makes the preprocessor
changes a bit cleaner.  Specify the 64-bit build in CPPFLAGS on the x86_64
SUBARCH, rather than #undef'ing i386.  Compile-tested with i386 and x86_64
SUBARCHs.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-14 21:53:52 -07:00
Jeff Dike a5df0d1a2c [PATCH] uml: tidy longjmp macro
The UML_SETJMP macro was requiring its users to pass in a argument which it
could supply itself, since it wasn't used outside that invocation of the
macro.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-14 21:53:52 -07:00
Jeff Dike 2d77f6fcf8 [PATCH] uml: make mconsole version requests happen in a process
Handling a host mconsole version request must be done in a process context
rather than interrupt context now that utsname information can be
process-specific rather than global.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 03a3f824ea [PATCH] uml: remove unused variable
The dedevfsification of UML left an unused variable behind.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 9ead6feedd [PATCH] uml: add some EINTR protection
Add some more uses of the CATCH_EINTR wrapper.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 108ffa8cbf [PATCH] uml: formatting fixes
Fix a bunch of formatting problems.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 1d3468a664 [PATCH] uml: move _kern.c files
Move most *_kern.c files in arch/um/kernel to *.c.  This makes UML somewhat
more closely resemble the other arches.

[akpm@osdl.org: use the new INTF_* flags]
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 469226a431 [PATCH] uml: remove syscall debugging
Eliminate an unused debug option.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 29ac1c2142 [PATCH] uml: make some symbols static
A few sigio-related things can be made static.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 61232f2fe4 [PATCH] uml: fix exitcall ordering bug
This fixes an exitcall ordering bug - calls to ignore_sigio_fd can come from
exitcalls that come after the sigio thread has been killed.  This would cause
shutdown to hang or crash.

Fixed by having ignore_sigio_fd check that the thread is present before trying
to communicate with it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike 8e64d96aeb [PATCH] uml: remove os_isatty
os_isatty can be made to disappear by moving maybe_sigio_broken from kernel to
user code.  This also lets write_sigio_workaround become static.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:24 -07:00
Jeff Dike bfaafd7184 [PATCH] uml: remove spinlock wrapper functions
The irq_spinlock is not needed from user code any more, so the irq_lock and
irq_unlock wrappers can go away.  This also changes the name of the lock to
irq_lock.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike 8ae43ff8aa [PATCH] uml: mark forward_interrupts as being mode-specific
Mark forward_interrupts as being tt-mode only.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike bacf454918 [PATCH] uml: ifdef a mode-specific function
uml_idle_timer is tt-mode only, so ifdef it as such to make it easier to spot
when tt mode is killed.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike 872aaa65a6 [PATCH] uml: timer handler tidying
Get rid of a user of timer_irq_inited (and first_tick) by observing that
prev_ticks can be used to decide if this is the first call.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike e64bd13408 [PATCH] uml: signal initialization cleanup
It turns out that init_new_thread_signals is always called with altstack == 1,
so we can eliminate the parameter.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike 9914aee827 [PATCH] uml: remove useless declaration
wall_to_monotonic isn't used in this file, so we can remove the declaration.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike 23bbd586ed [PATCH] uml: fix static binary segfault
When UML is built as a static binary, it segfaults when run.  The reason is
that a memory hole that is present in dynamic binaries isn't there in static
binaries, and it contains essential stuff.

This fix removes the code which maps some anonymous memory into that hole and
cleans up some related code.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike 8633c2331e [PATCH] uml: remove some useless exports
Spotted by Al Viro - eliminate a couple useless exports.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Jeff Dike aceb343464 [PATCH] uml: timer initialization cleanup
This cleans up the mess that is the timer initialization.  There used to be
two timer handlers - one that basically ran during delay loop calibration and
one that handled the timer afterwards.  There were also two sets of timer
initialization code - one that starts in user code and calls into the kernel
side of the house, and one that starts in kernel code and calls user code.

This eliminates one timer handler and consolidates the two sets of
initialization code.

[akpm@osdl.org: use new INTF_ flags]
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Tyler 598d188af1 [PATCH] uml: clean up address space limits code
I was looking at the code of the UML and more precisely at the functions
set_task_sizes_tt and set_task_sizes_skas.  I noticed that these 2 functions
take a paramater (arg) which is not used : the function is always called with
the value 0.

I suppose that this value might change in the future (or even can be
configured), so I added a constant in mem_user.h file.

Also, I rounded CONFIG_HOST_TASk_SIZE to a 4M.

Signed-off-by: Tyler <tyler@agat.net>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-10 13:24:23 -07:00
Ingo Molnar 36c8b58689 [PATCH] sched: cleanup, remove task_t, convert to struct task_struct
cleanup: remove task_t and convert all the uses to struct task_struct. I
introduced it for the scheduler anno and it was a mistake.

Conversion was mostly scripted, the result was reviewed and all
secondary whitespace and style impact (if any) was fixed up by hand.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-03 15:27:11 -07:00
Theodore Tso c61a8416ed [PATCH] uml build fix
This is needed to fix UML compilation given that alternatives_smp_module_add
and alternatives_smp_module_del are null inline functions if !CONFIG_SMP.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-03 15:26:58 -07:00
Thomas Gleixner bd6aa6502e [PATCH] irq-flags: UM: Use the new IRQF_ constants
Use the new IRQF_ constants and remove the SA_INTERRUPT define

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-02 13:58:48 -07:00
Linus Torvalds b4bc7b53cc Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
  kbuild: documentation change on allowing checkers besides sparse
  kbuild: warn when a moduled uses a symbol marked UNUSED
  kbuild: fix segv in modpost
  kconfig: enhancing accessibility of lxdialog
  kbuild: fix ia64 breakage after introducing make -rR
2006-07-01 09:58:43 -07:00
Paolo 'Blaisorblade' Giarrusso eb28931e4a [PATCH] uml: rename and improve actually_do_remove()
Rename actually_do_remove() to remove_files_and_dir(), make it call
closedir(), make it ignore ENOENT (I see it frequently enough).

ENOENT is probably due to multiple threads calling the exitcall functions
together*, but fixing that is non-trivial; and ignoring it is perfectly ok
in any case.

* it can surely happen: last_ditch_exit() is installed as SIGTERM handler
  at boot, and it's not removed on thread creation.  So killall vmlinux
  (which I do) surely causes that.  I've seen also a crash which seems to
  do the same.

Installing the handler on only the main thread would make UML do no cleanup
when another thread exits, and we're not sure we want that.  And mutual
exclusion in that context is tricky - we can't use spinlock in code not on
a kernel stack (spinlock debugging uses "current" a lot).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-01 09:56:03 -07:00
Paolo 'Blaisorblade' Giarrusso 912ad92220 [PATCH] uml: fix not_dead_yet when directory is in bad state
The bug occurred to me when a UML left an empty ~/.uml/Sarge-norm folder -
when trying to reuse not_dead_yet() failed one of its check.  The comment
says that's ok and means that we can take the directory, but while normally
not_dead_yet() removes it and returns 0 (i.e.  go on, use this), on failure
it returns 0 but forgets to remove it.  The fix is to remove it anytime
we're going to return 0.

But since "not_dead_yet" didn't make the interface so clear, causing this
bug, and I couldn't find a convenient name for the mix of things it did, I
split it into two parts:

is_umdir_used()      -	returns a boolean, contains all checks of not_dead_yet()
umdir_take_if_dead   -	tries to remove the dir unless it's used - returns
			whether it removed it, that is we now own it.

With this changes the control flow is IMHO a bit clearer and needs less
comment for control flow.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-01 09:56:03 -07:00
Paolo 'Blaisorblade' Giarrusso 47e5243afe [PATCH] uml: make copy_*_user atomic
Make __copy_*_user_inatomic really atomic to avoid "Sleeping function called in
atomic context" warnings, especially from futex code.

This is made by adding another kmap_atomic slot and making copy_*_user_skas
use kmap_atomic; also copy_*_user() becomes atomic, but that's true and is not
a problem for i386 (and we can always add might_sleep there as done
elsewhere).  For TT mode kmap is not used, so there's no need for this.

I've had to use another slot since both KM_USER0 and KM_USER1 are used
elsewhere and could cause conflicts.  Till now we reused the kmap_atomic slot
list from the subarch, but that's not needed as that list must contain the
common ones (used by generic code) + the ones used in architecture specific
code (and Uml till now used none); so I've taken the i386 one after comparing
it with ones from other archs, and added KM_UML_USERCOPY.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-01 09:56:03 -07:00
Sam Ravnborg 5e8d780d74 kbuild: fix ia64 breakage after introducing make -rR
kbuild used $¤(*F to get filename of target without extension.
This was used in several places all over kbuild, but introducing
make -rR broke his for all cases where we specified full path to
target/prerequsite. It is assumed that make -rR disables old style
suffix-rules which is why is suddenly failed.

ia64 was impacted by this change because several div* routines in
arch/ia64/lib are build using explicit paths and then kbuild failed.

Thanks to David Mosberger-Tang <David.Mosberger@acm.org> for an explanation
what was the root-cause and for testing on ia64.

This patch also fixes two uses of $(*F) in arch/um

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-07-01 09:58:02 +02:00
Linus Torvalds 22a3e233ca Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial
* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial:
  Remove obsolete #include <linux/config.h>
  remove obsolete swsusp_encrypt
  arch/arm26/Kconfig typos
  Documentation/IPMI typos
  Kconfig: Typos in net/sched/Kconfig
  v9fs: do not include linux/version.h
  Documentation/DocBook/mtdnand.tmpl: typo fixes
  typo fixes: specfic -> specific
  typo fixes in Documentation/networking/pktgen.txt
  typo fixes: occuring -> occurring
  typo fixes: infomation -> information
  typo fixes: disadvantadge -> disadvantage
  typo fixes: aquire -> acquire
  typo fixes: mecanism -> mechanism
  typo fixes: bandwith -> bandwidth
  fix a typo in the RTC_CLASS help text
  smb is no longer maintained

Manually merged trivial conflict in arch/um/kernel/vmlinux.lds.S
2006-06-30 15:39:30 -07:00
Jeff Dike ff23db5373 [PATCH] uml: fix biarch gcc build on x86_64
I run an x86_64 kernel with i386 userspace (Ubuntu Dapper) and decided to try
out UML today.  I found that UML wasn't quite aware of biarch compilers (which
Ubuntu i386 ships).  A fix similar to what was done for x86_64 should probably
be committed (see
http://marc.theaimsgroup.com/?l=linux-kernel&m=113425940204010&w=2).  Without
the FLAGS changes, the build will fail at a number of places and without the
LINK change, the final link will fail.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:38 -07:00
Jeff Dike d115ec0f0f [PATCH] uml: remove stray file
Forgot to remove arch/um/kernel/time.c when it was mostly moved to
arch/um/os-Linux.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:38 -07:00
Jeff Dike 30df49191c [PATCH] uml: remove unneeded time definitions
Remove um_time() and um_stime() syscalls since they are identical to
system-wide ones.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:38 -07:00
Jeff Dike 572e614750 [PATCH] uml: add locking to xtime accesses
do_timer must be called with xtime_lock held.  I'm not sure boot_timer_handler
needs this, however I don't think it hurts: it simply disables irq and takes a
spinlock.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:37 -07:00
Jeff Dike 6edb08620f [PATCH] uml: unregister useless console when it's not needed
-mm in combination with an FC5 init started dying with 'stderr=1' because init
didn't like the lack of /dev/console and exited.  The problem was that the
stderr console, which is intended to dump printk output to the terminal before
the regular console is initialized, isn't a tty, and so can't make
/dev/console operational.

However, since it is registered first, the normal console, when it is
registered, doesn't become the preferred console, and isn't attached to
/dev/console.  Thus, /dev/console is never operational.

This patch makes the stderr console unregister itself in an initcall, which is
late enough that the normal console is registered.  When that happens, the
normal console will become the preferred console and will be able to run
/dev/console.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:37 -07:00
Jeff Dike 190f493922 [PATCH] uml: fix off-by-one bug in VM file creation
Fix an off-by-one bug in temp file creation.  Seeking to the desired length
and writing a byte resulted in the file being one byte longer than expected.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:37 -07:00
Jeff Dike c2b7a4bb30 [PATCH] uml: fix /proc/mounts parsing boundary condition
When parsing /proc/mounts looking for a tmpfs mount on /dev/shm, if a string
that we are looking for if split across reads, then it won't be recognized.

Fix this by refilling the buffer whenever we advance the cursor.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:37 -07:00
Christoph Lameter df849a1529 [PATCH] zoned vm counters: conversion of nr_pagetables to per zone counter
Conversion of nr_page_table_pages to a per zone counter

[akpm@osdl.org: bugfix]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:35 -07:00
Jörn Engel 6ab3d5624e Remove obsolete #include <linux/config.h>
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-30 19:25:36 +02:00
Linus Torvalds 602cada851 Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/devfs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/devfs-2.6: (22 commits)
  [PATCH] devfs: Remove it from the feature_removal.txt file
  [PATCH] devfs: Last little devfs cleanups throughout the kernel tree.
  [PATCH] devfs: Rename TTY_DRIVER_NO_DEVFS to TTY_DRIVER_DYNAMIC_DEV
  [PATCH] devfs: Remove the tty_driver devfs_name field as it's no longer needed
  [PATCH] devfs: Remove the line_driver devfs_name field as it's no longer needed
  [PATCH] devfs: Remove the videodevice devfs_name field as it's no longer needed
  [PATCH] devfs: Remove the gendisk devfs_name field as it's no longer needed
  [PATCH] devfs: Remove the miscdevice devfs_name field as it's no longer needed
  [PATCH] devfs: Remove the devfs_fs_kernel.h file from the tree
  [PATCH] devfs: Remove devfs_remove() function from the kernel tree
  [PATCH] devfs: Remove devfs_mk_cdev() function from the kernel tree
  [PATCH] devfs: Remove devfs_mk_bdev() function from the kernel tree
  [PATCH] devfs: Remove devfs_mk_symlink() function from the kernel tree
  [PATCH] devfs: Remove devfs_mk_dir() function from the kernel tree
  [PATCH] devfs: Remove devfs_*_tape() functions from the kernel tree
  [PATCH] devfs: Remove devfs support from the sound subsystem
  [PATCH] devfs: Remove devfs support from the ide subsystem.
  [PATCH] devfs: Remove devfs support from the serial subsystem
  [PATCH] devfs: Remove devfs from the init code
  [PATCH] devfs: Remove devfs from the partition code
  ...
2006-06-29 14:19:21 -07:00
Ingo Molnar d1bef4ed5f [PATCH] genirq: rename desc->handler to desc->chip
This patch-queue improves the generic IRQ layer to be truly generic, by adding
various abstractions and features to it, without impacting existing
functionality.

While the queue can be best described as "fix and improve everything in the
generic IRQ layer that we could think of", and thus it consists of many
smaller features and lots of cleanups, the one feature that stands out most is
the new 'irq chip' abstraction.

The irq-chip abstraction is about describing and coding and IRQ controller
driver by mapping its raw hardware capabilities [and quirks, if needed] in a
straightforward way, without having to think about "IRQ flow"
(level/edge/etc.) type of details.

This stands in contrast with the current 'irq-type' model of genirq
architectures, which 'mixes' raw hardware capabilities with 'flow' details.
The patchset supports both types of irq controller designs at once, and
converts i386 and x86_64 to the new irq-chip design.

As a bonus side-effect of the irq-chip approach, chained interrupt controllers
(master/slave PIC constructs, etc.) are now supported by design as well.

The end result of this patchset intends to be simpler architecture-level code
and more consolidation between architectures.

We reused many bits of code and many concepts from Russell King's ARM IRQ
layer, the merging of which was one of the motivations for this patchset.

This patch:

rename desc->handler to desc->chip.

Originally i did not want to do this, because it's a big patch.  But having
both "desc->handler", "desc->handle_irq" and "action->handler" caused a
large degree of confusion and made the code appear alot less clean than it
truly is.

I have also attempted a dual approach as well by introducing a
desc->chip alias - but that just wasnt robust enough and broke
frequently.

So lets get over with this quickly.  The conversion was done automatically
via scripts and converts all the code in the kernel.

This renaming patch is the first one amongst the patches, so that the
remaining patches can stay flexible and can be merged and split up
without having some big monolithic patch act as a merge barrier.

[akpm@osdl.org: build fix]
[akpm@osdl.org: another build fix]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-29 10:26:21 -07:00
Greg Kroah-Hartman 264f48646e [PATCH] devfs: Remove the line_driver devfs_name field as it's no longer needed
Also fixes all drivers that set this field.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26 12:25:09 -07:00
Greg Kroah-Hartman ce7b0f46bb [PATCH] devfs: Remove the gendisk devfs_name field as it's no longer needed
And remove the now unneeded number field.
Also fixes all drivers that set these fields.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26 12:25:08 -07:00
Greg Kroah-Hartman ff23eca3e8 [PATCH] devfs: Remove the devfs_fs_kernel.h file from the tree
Also fixes up all files that #include it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26 12:25:08 -07:00
Greg Kroah-Hartman 79021a625c [PATCH] devfs: Remove devfs_mk_symlink() function from the kernel tree
Removes the devfs_mk_symlink() function and all callers of it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26 12:25:06 -07:00
Greg Kroah-Hartman 95dc112a57 [PATCH] devfs: Remove devfs_mk_dir() function from the kernel tree
Removes the devfs_mk_dir() function and all callers of it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26 12:25:06 -07:00
Andreas Mohr d6e05edc59 spelling fixes
acquired (aquired)
contiguous (contigious)
successful (succesful, succesfull)
surprise (suprise)
whether (weather)
some other misspellings

Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-26 18:35:02 +02:00
Adrian Bunk 83cc5ed3c4 [PATCH] kernel/sys.c: cleanups
- proper prototypes for the following functions:
  - ctrl_alt_del()  (in include/linux/reboot.h)
  - getrusage()     (in include/linux/resource.h)
- make the following needlessly global functions static:
  - kernel_restart_prepare()
  - kernel_kexec()

[akpm@osdl.org: compile fix]
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-25 10:01:06 -07:00
Adrian Bunk 17660bdd5c [PATCH] uml: remove dead declaration
Became irrelevant when x86_64 unexported ia32_sys_call_table.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Andi Kleen <ak@muc.de>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-25 10:00:58 -07:00
Jean-Luc Leger c7a4357551 [PATCH] clean up default value of SYSCALL_DEBUG
Default values for boolean and tristate options can only be 'y', 'm' or 'n'.
This patch removes wrong default for SYSCALL_DEBUG.

Signed-off-by: Jean-Luc Leger <jean-luc.leger@dspnet.fr.eu.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 07:43:03 -07:00
Linus Torvalds 45c091bb2d Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (139 commits)
  [POWERPC] re-enable OProfile for iSeries, using timer interrupt
  [POWERPC] support ibm,extended-*-frequency properties
  [POWERPC] Extra sanity check in EEH code
  [POWERPC] Dont look for class-code in pci children
  [POWERPC] Fix mdelay badness on shared processor partitions
  [POWERPC] disable floating point exceptions for init
  [POWERPC] Unify ppc syscall tables
  [POWERPC] mpic: add support for serial mode interrupts
  [POWERPC] pseries: Print PCI slot location code on failure
  [POWERPC] spufs: one more fix for 64k pages
  [POWERPC] spufs: fail spu_create with invalid flags
  [POWERPC] spufs: clear class2 interrupt status before wakeup
  [POWERPC] spufs: fix Makefile for "make clean"
  [POWERPC] spufs: remove stop_code from struct spu
  [POWERPC] spufs: fix spu irq affinity setting
  [POWERPC] spufs: further abstract priv1 register access
  [POWERPC] spufs: split the Cell BE support into generic and platform dependant parts
  [POWERPC] spufs: dont try to access SPE channel 1 count
  [POWERPC] spufs: use kzalloc in create_spu
  [POWERPC] spufs: fix initial state of wbox file
  ...

Manually resolved conflicts in:
	drivers/net/phy/Makefile
	include/asm-powerpc/spu.h
2006-06-22 22:11:30 -07:00
Jeff Dike 7f98a44b9d [PATCH] UML: fix wall_to_monotonic initialization
Change a variable from unsigned to signed in order to get sign-extension
when the thing is negated.  Without this, uptime is horribly confused.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-22 15:05:55 -07:00
Linus Torvalds 2edc322d42 Merge git://git.infradead.org/~dwmw2/rbtree-2.6
* git://git.infradead.org/~dwmw2/rbtree-2.6:
  [RBTREE] Switch rb_colour() et al to en_US spelling of 'color' for consistency
  Update UML kernel/physmem.c to use rb_parent() accessor macro
  [RBTREE] Update hrtimers to use rb_parent() accessor macro.
  [RBTREE] Add explicit alignment to sizeof(long) for struct rb_node.
  [RBTREE] Merge colour and parent fields of struct rb_node.
  [RBTREE] Remove dead code in rb_erase()
  [RBTREE] Update JFFS2 to use rb_parent() accessor macro.
  [RBTREE] Update eventpoll.c to use rb_parent() accessor macro.
  [RBTREE] Update key.c to use rb_parent() accessor macro.
  [RBTREE] Update ext3 to use rb_parent() accessor macro.
  [RBTREE] Change rbtree off-tree marking in I/O schedulers.
  [RBTREE] Add accessor macros for colour and parent fields of rb_node
2006-06-20 14:51:22 -07:00
Anton Blanchard 227318bbde [POWERPC] Remove stale 64bit on 32bit kernel code
Remove some stale POWER3/POWER4/970 on 32bit kernel support.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-06-15 19:31:26 +10:00
Jeff Dike fec468b0c9 [PATCH] uml: add -ffreestanding to CFLAGS
From: Jeff Dike <jdike@addtoit.com>

This fixes the undefined reference to strcpy seen when building modules on
i386.  Tracked down by Al Viro.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:17 -07:00
Al Viro b8719c31a3 [PATCH] uml: more __user annotations
From: Al Viro <viro@zeniv.linux.org.uk>

uml __user annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:17 -07:00
Al Viro ca34fb1a87 [PATCH] uml: __user annotation in arch_prctl
From: Al Viro <viro@zeniv.linux.org.uk>

fix uml/amd64 prctl()

put_user() there should go to (long __user *)addr, not &addr

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:17 -07:00
Jeff Dike f218312582 [PATCH] uml: fix a typo in do_uml_initcalls
From: Jeff Dike <jdike@addtoit.com>

We had a spurious semicolon somehow.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:17 -07:00
Jeff Dike 5cb38bc47b [PATCH] uml: fix wall_to_monotonic initialization
From: Jeff Dike <jdike@addtoit.com>

Initialize wall_to_monotonic correctly.  This fixes a problem where sleeps
lasted about one secone less than they should.  This also called for a bit of
code restructuring, following a patch which Blaisorblade had been keeping.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-05 12:29:17 -07:00
Jeff Dike 6760da0197 [PATCH] uml: change timer initialization
inet_init, which schedules, is called before the UML timer_init, which sets
up the timer.  The result is the interval timers being manipulated before
the appropriate signal handlers are established, causing unhandled timers.

This is fixed by making timer_init be called earlier.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-03 20:05:40 -07:00
Linus Torvalds 532f57da40 Merge branch 'audit.b10' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current
* 'audit.b10' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
  [PATCH] Audit Filter Performance
  [PATCH] Rework of IPC auditing
  [PATCH] More user space subject labels
  [PATCH] Reworked patch for labels on user space messages
  [PATCH] change lspp ipc auditing
  [PATCH] audit inode patch
  [PATCH] support for context based audit filtering, part 2
  [PATCH] support for context based audit filtering
  [PATCH] no need to wank with task_lock() and pinning task down in audit_syscall_exit()
  [PATCH] drop task argument of audit_syscall_{entry,exit}
  [PATCH] drop gfp_mask in audit_log_exit()
  [PATCH] move call of audit_free() into do_exit()
  [PATCH] sockaddr patch
  [PATCH] deal with deadlocks in audit_free()
2006-05-01 21:43:05 -07:00
Jeff Dike a4b741e380 [PATCH] uml: uml-makefile-nicer uses SYMLINK incorrectly
Blaisorblade's uml-makefile-nicer makes a V=0 build say SYMLINK where
what's happening is really a LINK.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Acked-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:45 -07:00
Paolo 'Blaisorblade' Giarrusso cead61a671 [PATCH] uml: export symbols added by GCC hardened
GCC hardened introduces additional symbol refererences (for the canary and
friends), also in modules - add weak export_symbols for them.  We already
tested that the weak declaration creates no problem on both GCC's providing
the function definition and on GCC's which don't provide it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:45 -07:00
Paolo 'Blaisorblade' Giarrusso 7b12b91379 [PATCH] uml: cleanup unprofile expression and build infrastructure
*) Rather than duplicate in various buggy ways the application of
   CFLAGS_NO_HARDENING and UNPROFILE (which apply to the same files),
   centralize it in Makefile.rules.  UNPROFILE_OBJS mustn't be listed in
   USER_OBJS but are compiled as such.

I've also verified that unprofile didn't work in the current form, because we
set _c_flags directly (using CFLAGS and not USER_CFLAGS, which is wrong),
which is normally used by c_flags, but we also override c_flags for all
USER_OBJS, and there we don't call unprofile.

Instead it only worked for unmap.o, the only one which wasn't a USER_OBJ.

We need to set c_flags (which is not a public Kbuild API) to clear a lot of
compilation flags like -nostdinc which Kbuild forces on everything.

*) Rather than $(CFLAGS_$(notdir $@)), which expands to CFLAGS_anObj.s when
   building "anObj.s", use $(CFLAGS_$(*F).o) which always accesses
   CFLAGS_anObj.o, like done by Kbuild.

*) Make c_flags apply to all targets having the same basename, rather than
   listing .s, .i, .lst and .o, with the use (which I tested) of

	$(USER_OBJS:.o=.%): c_flags = ...

and of

 -      $(obj)/unmap.c: _c_flags = ...
 +      $(obj)/unmap.%: _c_flags = ...

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:45 -07:00
Paolo 'Blaisorblade' Giarrusso 275e6e1ee2 [PATCH] uml: fix compilation and execution with hardened GCC
To make some half-assembly stubs compile, disable various "hardened" GCC
features:

*) we can't make it build PIC code as we need %ebx to do syscalls and GCC
   wants it free for PIC

*) we can't leave stack protection as the stub is moved (not relocated!) in
   memory so the RIP-relative access to the canary tries reading from an
   unmapped address and causes a segfault, since we move the stub of various
   megabytes (the exact amount will be decided at runtime) away from the
   link-time address.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:45 -07:00
Paolo 'Blaisorblade' Giarrusso cb8aa3d29b [PATCH] uml: use Kbuild tracking for all files and fix compilation output
Move the build of user-offsets to arch/um/sys-$(SUBARCH), where it's located.
So we can also build it via Kbuild with its dependency tracking rather than by
hand.  While hacking here, fix also a lot of little cosmetic things.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:45 -07:00
Mattia Dongili cb98cdcd0d [PATCH] uml: search from uml_net in a more reasonable PATH
Append /usr/lib/uml to the existing PATH environment variable to let execvp()
search uml_net in FHS compliant locations.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:45 -07:00
Paolo 'Blaisorblade' Giarrusso b15fb6b157 [PATCH] uml: fix patch mismerge
I sent a patch, it was applied as cda402b283,
then it was applied again as 181ae4005d by
mistake.  But while the 1st time it modified (correctly) cow_header_v3, the
2nd it modified cow_header_v3_broken.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:44 -07:00
Jeff Dike 2ace87b950 [PATCH] uml: error handling fixes
Blairsorblade noticed some confusion between our use of a system
call's return value and errno.  This patch fixes a number of related
bugs -
	using errno instead of a return value
	using a return value instead of errno
	forgetting to negate a error return to get a positive error code

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:44 -07:00
Jeff Dike 347b3dc2fa [PATCH] uml: update defconfig
Bring defconfig up to date.

Also disable CONFIG_BLK_DEV_UBD_SYNC by default.  By performing synchronous
I/O to the host, it slows things down, only protects against host crashes, and
can make a UML appear to hang while it waits for the host's disk.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:44 -07:00
Jeff Dike e3104f50d8 [PATCH] uml: clean up after MADVISE_REMOVE
The MADVISE_REMOVE-checking code didn't clean up after itself.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:44 -07:00
Jesper Juhl 191ef966ac [PATCH] uml: remove NULL checks and add some CodingStyle
Remove redundant NULL checks before [kv]free + small CodingStyle cleanup for
arch/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:44 -07:00
Joris van Rantwijk 893bb96a29 [PATCH] uml: skas0 support for 2G/2G hosts
A quick hack to allow skas0 mode to run on 2G/2G hosts.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:43 -07:00
Victor V. Vengerov c39e50b4ba [PATCH] uml: fix iomem list traversal
We need to walk the region list properly.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-01 18:17:43 -07:00
Al Viro 5411be59db [PATCH] drop task argument of audit_syscall_{entry,exit}
... it's always current, and that's a good thing - allows simpler locking.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2006-05-01 06:06:18 -04:00
Andrew Morton aa783a8f31 Update UML kernel/physmem.c to use rb_parent() accessor macro
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-01 09:41:47 +01:00
Jeff Dike fb30d64568 [PATCH] uml: add missing __volatile__
We were missing __volatile__ on some bits of asm in the segfault handlers.
On x86_64, this was messing up the move from %rdx to uc because that was
moved to after the GET_FAULTINFO_FROM_SC, which changed %rdx.

Also changed the other bit of asm and the one in the i386 handler to
prevent any similar occurrences.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-19 09:13:51 -07:00
Rob Landley 966a082f80 [PATCH] uml: physical memory map file fixes
UML really wants shared memory semantics form its physical memory map file,
and the place for that is /dev/shm.  So move the default, and fix the error
messages to recognize that this value can be overridden.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-19 09:13:51 -07:00
Al Viro f983c45ebe [PATCH] uml: __user annotations
bits of uml __user annotations lost in merge

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-19 09:13:51 -07:00
Jeff Dike ad28e02978 [PATCH] uml: change sigjmp_buf to jmp_buf
Clean up the jmpbuf code.  Since softints, we no longer use sig_setjmp, so
the UML_SIGSETJMP wrapper now has a misleading name.  Also, I forgot to
change the buffers from sigjmp_buf to jmp_buf.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-19 09:13:51 -07:00
Jeff Dike b73781c866 [PATCH] uml: MADV_REMOVE fixes
MADV_REMOVE fixes - change the test mapping to be MAP_SHARED instead of
MAP_PRIVATE, as MADV_REMOVE on MAP_PRIVATE maps won't work.  Also, use
the kernel's definition of MADV_REMOVE instead of hardcoding it if there
isn't a libc definition.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-19 09:13:49 -07:00
Paolo 'Blaisorblade' Giarrusso 181ae4005d [PATCH] uml: make 64-bit COW files compatible with 32-bit ones
This is the minimal fix to make 64-bit UML binaries create 32-bit
compatible COW files and read them.

I've indeed tested that current code doesn't do this - the code gets
SIGFPE for a division by a value read at the wrong place, where 0 is
found.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-19 09:13:49 -07:00
Paolo 'Blaisorblade' Giarrusso 52c7378236 [PATCH] uml: avoid warnings for diffent names for an unsigned quadword
Since on some 64-bit systems __u64 is rightfully defined to unsigned long and
GCC recognizes anyway unsigned long and unsigned long long as different, fix
some types back to being unsigned long long to avoid warnings and errors (for
prototype mismatch) on those systems.

Thanks to the report by Wesley Emeneker wesleyemeneker (at) google (dot) com

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:37 -07:00
Paolo 'Blaisorblade' Giarrusso 40dbb8676e [PATCH] uml: fix parallel make early failure on clean tree
Parallel make failed once for me - fix this by adding the appropriate command
(mkdir before creating a link in that dir).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:37 -07:00
Paolo 'Blaisorblade' Giarrusso dbdb4c06b7 [PATCH] uml: local_irq_save, not local_save_flags
The call to local_save_flags seems bogus since it is followed by
local_irq_restore, and it's intended to lock the list from concurrent
mconsole_interrupt invocations.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:37 -07:00
Paolo 'Blaisorblade' Giarrusso 87276f721a [PATCH] uml: fix big stack user
Switch this proc from storing 4k of data (a whole path) on the stack to
keeping it on the heap.

Maybe it's not called in process context but only in early boot context (where
in UML you have a normal process stack on the host) but just to be safe, fix
it.

While at it some little readability simplifications.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:37 -07:00
Paolo 'Blaisorblade' Giarrusso d84a19ce52 [PATCH] uml: fix failure path after conversion
Little fix for error paths in this code.

- Some bug come from conversion to os-Linux (open() doesn't follow the
  kernel -errno return convention, while the old code called os_open_file()
  which followed it).  This caused the wrong return code to be printed.

- Then be more precise about what happened and do some whitespace fixes.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso b1c332c9e8 [PATCH] uml: fix hang on run_helper() failure on uml_net
Fix an hang on a pipe when run_helper() fails when called by change_tramp()
(i.e.  when calling uml_net) - reproduced the bug and verified this fixes it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso e6fb54abb8 [PATCH] uml: move outside spinlock call not needing it
Move a call to kfree on a local variable out of a spinlock - there's no need
to have it in.  Done on a just merged patch.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso ccea15f45e [PATCH] uml: support sparse for userspace files
Make sparse checker work for userspace files - it normally gets -nostdinc
separately, so avoid having it for userspace files.  Also, add -D$(SUBARCH)
for multiarch hosts (i.e.  AMD64 with compatibility headers).

It works, the only problem is a bit of bogus warnings for system headers, but
they're not too many.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso f53389d8af [PATCH] uml: fix critical typo for TT mode
Noticed this for a compilation-time warning, so I'm fixing it even for TT mode
- this is not put_user, but copy_to_user, so we need a pointer to sp, not sp
itself (we're trying to write the word pointed to by the "sp" var.).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso 5b0e94787f [PATCH] uml: fix "extern-vs-static" proto conflict in TLS code
Move the prototype from arch-generic to arch-specific includes because on
x86_64 these functions are two static inlines.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso 7c45ad16f0 [PATCH] uml: fix some double export warnings
Some functions are exported twice in current code - remove the excess export.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso 802e307795 [PATCH] uml: fix format errors
Now that GCC warns about format errors, fix them.  Nothing able to cause a
crash, however.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:36 -07:00
Paolo 'Blaisorblade' Giarrusso 9cf85b3af2 [PATCH] uml: request format warnings to GCC for appropriate functions
Add the format attribute to prototypes so GCC warns about improper usage.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:35 -07:00
Paolo 'Blaisorblade' Giarrusso 6dad2d3faa [PATCH] uml: fix 2 harmless cast warnings for 64-bit
Fix two harmless warnings in 64-bit compilation (the 2nd doesn't trigger for
now because of a missing __attribute((format)) for cow_printf, but next
patches fix that).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:35 -07:00
Paolo 'Blaisorblade' Giarrusso f2ea394082 [PATCH] uml: safe migration path to the correct V3 COW format
- Correct the layout of all header versions - make all them well-specified
  for any external event.  As we don't have 1-byte or 2-byte wide fields, the
  32-bit layout (historical one) has no extra padding, so we can safely add
  __attribute__((packed)).

- Add detection and reading of the broken 64-bit COW format which has been
  around for a while - to allow safe migration to the correct 32-bit format.
  Safe detection is possible, thanks to some luck with the existing format,
  and it works in practice.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:35 -07:00
Paolo 'Blaisorblade' Giarrusso cda402b283 [PATCH] uml: make 64-bit COW files compatible with 32-bit ones
This is the minimal fix to make 64-bit UML binaries create 32-bit compatible
COW files and read them.  I've indeed tested that current code doesn't do this
- the code gets SIGFPE for a division by a value read at the wrong place,
where 0 is found.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:35 -07:00
Jeff Dike 60baa15839 [PATCH] uml: memory hotplug cleanups
Change memory hotplug to use GFP_NOWAIT instead of GFP_ATOMIC, so that it
will grab memory without sleeping, but doesn't try to use the emergency
pools.

A small list initialization suggested by Daniel Phillips - don't initialize
lists which are just about to be list_add-ed.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:35 -07:00
Jeff Dike a5d2f46a97 [PATCH] UML: TLS fixlets
Two small TLS fixes -

arch/um/os-Linux/sys-i386/tls.c uses errno and -E* so it should include
    errno.h
__setup_host_supports_tls returns 1, but as an initcall, it should return 0

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-11 06:18:35 -07:00
Paolo 'Blaisorblade' Giarrusso 3feb88562d [PATCH] uml: check for differences in host support
If running on a host not supporting TLS (for instance 2.4) we should report
that cleanly to the user, instead of printing not comprehensible "error 5" for
that.

Additionally, i386 and x86_64 support different ranges for
user_desc->entry_number, and we must account for that; we couldn't pass
ourselves -1 because we need to override previously existing TLS descriptors
which glibc has possibly set, so test at startup the range to use.

x86 and x86_64 existing ranges are hardcoded.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:52 -08:00
Paolo 'Blaisorblade' Giarrusso 54d8d3b5a0 [PATCH] uml: add arch_switch_to for newly forked thread
Newly forked threads have no arch_switch_to_skas() called before their first
run, because when schedule() switches to them they're resumed in the body of
thread_wait() inside fork_handler() rather than in switch_threads() in
switch_to_skas().  Compensate this missing call.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:52 -08:00
Paolo 'Blaisorblade' Giarrusso dd77aec07a [PATCH] uml: tls support: hack to make it compile on any host
Copy the definition of struct user_desc (with another name) for use by
userspace sources (where we use the host headers, and we can't be sure about
their content) to make sure UML compiles.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:52 -08:00
Paolo 'Blaisorblade' Giarrusso aa6758d486 [PATCH] uml: implement {get,set}_thread_area for i386
Implement sys_[gs]et_thread_area and the corresponding ptrace operations for
UML.  This is the main chunk, additional parts follow.  This implementation is
now well tested and has run reliably for some time, and we've understood all
the previously existing problems.

Their implementation saves the new GDT content and then forwards the call to
the host when appropriate, i.e.  immediately when the target process is
running or on context switch otherwise (i.e.  on fork and on ptrace() calls).

In SKAS mode, we must switch registers on each context switch (because SKAS
does not switches tls_array together with current->mm).

Also, added get_cpu() locking; this has been done for SKAS mode, since TT does
not need it (it does not use smp_processor_id()).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:52 -08:00
Paolo 'Blaisorblade' Giarrusso 972410b023 [PATCH] uml: clean arch_switch usage
Call arch_switch also in switch_to_skas, even if it's, for now, a no-op for
that case (and mark this in the comment); this will change soon.

Also, arch_switch for TT mode is actually useless when the PT proxy (a
complicate debugging instrumentation for TT mode) is not enabled.  In fact, it
only calls update_debugregs, which checks debugregs_seq against seq (to check
if the registers are up-to-date - seq here means a "version number" of the
registers).

If the ptrace proxy is not enabled, debugregs_seq always stays 0 and
update_debugregs will be a no-op.  So, optimize this out (the compiler can't
do it).

Also, I've been disappointed by the fact that it would make a lot of sense if,
after calling a successful
update_debugregs(current->thread.arch.debugregs_seq),
current->thread.arch.debugregs_seq were updated with the new debugregs_seq.
But this is not done.  Is this a bug or a feature?  For all purposes, it seems
a bug (otherwise the whole mechanism does not make sense, which is also a
possibility to check), which causes some performance only problems (not
correctness), since we write_debugregs when not needed.

Also, as suggested by Jeff, remove a redundant enabling of SIGVTALRM,
comprised in the subsequent local_irq_enable().  I'm just a bit dubious if
ordering matters there...

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:52 -08:00
Paolo 'Blaisorblade' Giarrusso fbdf216155 [PATCH] uml: split ldt.h in arch-independent and arch-dependant code
ldt-{i386,x86_64}.h is made of two different parts - some code for parsing of
LDT descriptors, which is arch-dependant, and the code to handle uml_ldt_t (an
LDT block inside UML), which is mostly arch-independant (among x86 and x86_64,
at least).

Join the common part in a single file (ldt.h) and split the rest away
(host_ldt-{i386,x86_64}.h).

This is needed because processor.h, with next patches, will start including
the LDT descriptor parsing macros in host_ldt.h, but it can't include ldt.h
because it uses semaphores (and to define semaphores one must first include
processor.h!).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Paolo 'Blaisorblade' Giarrusso 12523bdce1 [PATCH] uml: idle thread needn't take access to init_mm
Comparing this code which is the actual body of the arch-independent
cpu_idle(), it is clear that it's unnecessary to set ->mm and ->active_mm;
beyond that, a kernel thread is not supposed to have ->mm != NULL, only
active_mm.

This showed up because I used the assumption (which is IMHO valid) that kernel
thread have their ->mm == NULL, and it failed for this thread.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro e11c0cdf4c [PATCH] uml: fix min usage
type-safe min() in arch/um/drivers/mconsole_kern.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro 43cecb3079 [PATCH] uml: remove unused make variables
Removed assignments to unused variables in arch/um/os-Linux/Makefile

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro 4d338e1acc [PATCH] uml: sparse cleanups
misc sparse annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro 694a464e19 [PATCH] uml: kconfigs
kconfig sanitized around drivers/net

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro cc70a40b5e [PATCH] uml: eliminate duplicate mrpropered files
no need to add the same file twice to MRPROPER_FILES

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro 7b99edc78d [PATCH] uml: clean up remapping code build magic
kills unmap magic

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:51 -08:00
Al Viro de2fe5e07d [PATCH] uml: eliminate symlinks to host arch
kills symlinks in arch/um/sys-*

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:50 -08:00
Jeff Dike f4c57a78e2 [PATCH] uml: fix initcall return values
A number of UML initcalls were improperly returning 1.  Also removed any
nearby emacs formatting comments.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:50 -08:00
Jeff Dike 9902abd7af [PATCH] uml: redeclare highmem
The earlier printf patch missed a corresponding change in the printed
variable.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:50 -08:00
Jeff Dike 02dea0875b [PATCH] UML: Hotplug memory, take 2
Changes since first version
	added check for MADV_REMOVE support on the host
	fixed error return botch
	shrunk sprintf array by one character

This adds hotplug memory support to UML.  The mconsole syntax is
 	config mem=[+-]n[KMG]
In other words, add or subtract some number of kilobytes, megabytes, or
gigabytes.

Unplugged pages are allocated and then madvise(MADV_TRUNCATE), which is a
currently experimental madvise extension.  These pages are tracked so they
can be plugged back in later if the admin decides to give them back.  The
first page to be unplugged is used to keep track of about 4M of other
pages.  A list_head is the first thing on this page.  The rest is filled
with addresses of other unplugged pages.  This first page is not madvised,
obviously.

When this page is filled, the next page is used in a similar way and linked
onto a list with the first page.  Etc.  This whole process reverses when
pages are plugged back in.  When a tracking page no longer tracks any
unplugged pages, then it is next in line for plugging, which is done by
freeing pages back to the kernel.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:50 -08:00
Oleg Nesterov 73b9ebfe12 [PATCH] pidhash: don't count idle threads
fork_idle() does unhash_process() just after copy_process().  Contrary,
boot_cpu's idle thread explicitely registers itself for each pid_type with nr
= 0.

copy_process() already checks p->pid != 0 before process_counts++, I think we
can just skip attach_pid() calls and job control inits for idle threads and
kill unhash_process().  We don't need to cleanup ->proc_dentry in fork_idle()
because with this patch idle threads are never hashed in
kernel/pid.c:pid_hash[].

We don't need to hash pid == 0 in pidmap_init().  free_pidmap() is never
called with pid == 0 arg, so it will never be reused.  So it is still possible
to use pid == 0 in any PIDTYPE_xxx namespace from kernel/pid.c's POV.

However with this patch we don't hash pid == 0 for PIDTYPE_PID case.  We still
have have PIDTYPE_PGID/PIDTYPE_SID entries with pid == 0: /sbin/init and
kernel threads which don't call daemonize().

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-28 18:36:41 -08:00
Alan Stern e041c68341 [PATCH] Notifier chain update: API changes
The kernel's implementation of notifier chains is unsafe.  There is no
protection against entries being added to or removed from a chain while the
chain is in use.  The issues were discussed in this thread:

    http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2

We noticed that notifier chains in the kernel fall into two basic usage
classes:

	"Blocking" chains are always called from a process context
	and the callout routines are allowed to sleep;

	"Atomic" chains can be called from an atomic context and
	the callout routines are not allowed to sleep.

We decided to codify this distinction and make it part of the API.  Therefore
this set of patches introduces three new, parallel APIs: one for blocking
notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
really just the old API under a new name).  New kinds of data structures are
used for the heads of the chains, and new routines are defined for
registration, unregistration, and calling a chain.  The three APIs are
explained in include/linux/notifier.h and their implementation is in
kernel/sys.c.

With atomic and blocking chains, the implementation guarantees that the chain
links will not be corrupted and that chain callers will not get messed up by
entries being added or removed.  For raw chains the implementation provides no
guarantees at all; users of this API must provide their own protections.  (The
idea was that situations may come up where the assumptions of the atomic and
blocking APIs are not appropriate, so it should be possible for users to
handle these things in their own way.)

There are some limitations, which should not be too hard to live with.  For
atomic/blocking chains, registration and unregistration must always be done in
a process context since the chain is protected by a mutex/rwsem.  Also, a
callout routine for a non-raw chain must not try to register or unregister
entries on its own chain.  (This did happen in a couple of places and the code
had to be changed to avoid it.)

Since atomic chains may be called from within an NMI handler, they cannot use
spinlocks for synchronization.  Instead we use RCU.  The overhead falls almost
entirely in the unregister routine, which is okay since unregistration is much
less frequent that calling a chain.

Here is the list of chains that we adjusted and their classifications.  None
of them use the raw API, so for the moment it is only a placeholder.

  ATOMIC CHAINS
  -------------
arch/i386/kernel/traps.c:		i386die_chain
arch/ia64/kernel/traps.c:		ia64die_chain
arch/powerpc/kernel/traps.c:		powerpc_die_chain
arch/sparc64/kernel/traps.c:		sparc64die_chain
arch/x86_64/kernel/traps.c:		die_chain
drivers/char/ipmi/ipmi_si_intf.c:	xaction_notifier_list
kernel/panic.c:				panic_notifier_list
kernel/profile.c:			task_free_notifier
net/bluetooth/hci_core.c:		hci_notifier
net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_chain
net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_expect_chain
net/ipv6/addrconf.c:			inet6addr_chain
net/netfilter/nf_conntrack_core.c:	nf_conntrack_chain
net/netfilter/nf_conntrack_core.c:	nf_conntrack_expect_chain
net/netlink/af_netlink.c:		netlink_chain

  BLOCKING CHAINS
  ---------------
arch/powerpc/platforms/pseries/reconfig.c:	pSeries_reconfig_chain
arch/s390/kernel/process.c:		idle_chain
arch/x86_64/kernel/process.c		idle_notifier
drivers/base/memory.c:			memory_chain
drivers/cpufreq/cpufreq.c		cpufreq_policy_notifier_list
drivers/cpufreq/cpufreq.c		cpufreq_transition_notifier_list
drivers/macintosh/adb.c:		adb_client_list
drivers/macintosh/via-pmu.c		sleep_notifier_list
drivers/macintosh/via-pmu68k.c		sleep_notifier_list
drivers/macintosh/windfarm_core.c	wf_client_list
drivers/usb/core/notify.c		usb_notifier_list
drivers/video/fbmem.c			fb_notifier_list
kernel/cpu.c				cpu_chain
kernel/module.c				module_notify_list
kernel/profile.c			munmap_notifier
kernel/profile.c			task_exit_notifier
kernel/sys.c				reboot_notifier_list
net/core/dev.c				netdev_chain
net/decnet/dn_dev.c:			dnaddr_chain
net/ipv4/devinet.c:			inetaddr_chain

It's possible that some of these classifications are wrong.  If they are,
please let us know or submit a patch to fix them.  Note that any chain that
gets called very frequently should be atomic, because the rwsem read-locking
used for blocking chains is very likely to incur cache misses on SMP systems.
(However, if the chain's callout routines may sleep then the chain cannot be
atomic.)

The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
material written by Keith Owens and suggestions from Paul McKenney and Andrew
Morton.

[jes@sgi.com: restructure the notifier chain initialization macros]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:50 -08:00
Dave Hansen 22a9835c35 [PATCH] unify PFN_* macros
Just about every architecture defines some macros to do operations on pfns.
 They're all virtually identical.  This patch consolidates all of them.

One minor glitch is that at least i386 uses them in a very skeletal header
file.  To keep away from #include dependency hell, I stuck the new
definitions in a new, isolated header.

Of all of the implementations, sh64 is the only one that varied by a bit.
It used some masks to ensure that any sign-extension got ripped away before
the arithmetic is done.  This has been posted to that sh64 maintainers and
the development list.

Compiles on x86, x86_64, ia64 and ppc64.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:48 -08:00
Jeff Dike 5f4e8fd08f [PATCH] uml: fix thread startup race
This fixes a race in the starting of write_sigio_thread.  Previously, some of
the data needed by the thread was initialized after the clone.  If the thread
ran immediately, it would see the uninitialized data, including an empty
pollfds, which would cause it to hang.

We move the data initialization to before the clone, and adjust the error
paths and cleanup accordingly.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike 1fbbd6844e [PATCH] uml: prevent umid theft
Behavior when booting two UMLs with the same umid was broken.  The second one
would steal the umid.  This fixes that, making the second UML take a random
umid instead.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike 98c18238f1 [PATCH] uml: fix segfault on signal delivery
This fixes a process segfault where a signal was being delivered such that a
new stack page needed to be allocated to hold the signal frame.  This was
tripping some logic in the page fault handler which wouldn't allocate the page
if the faulting address was more that 32 bytes lower than the current stack
pointer.  Since a signal frame is greater than 32 bytes, this exercised that
case.

It's fixed by updating the SP in the pt_regs before starting to copy the
signal frame.  Since those are the registers that will be copied on to the
stack, we have to be careful to put the original SP, not the new one which
points to the signal frame, on the stack.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike 6c29256c57 [PATCH] uml: allow ubd devices to be shared in a cluster
This adds a 'c' option to the ubd switch which turns off host file locking so
that the device can be shared, as with a cluster.  There's also some
whitespace cleanup while I was in this file.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike cf9165a50a [PATCH] uml: oS header cleanups
This rearranges the OS declarations by moving some declarations into os.h.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike c554f899b6 [PATCH] uml: move tty logging to os-Linux
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from tty_log.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Bodo Stroesser 81efcd3300 [PATCH] uml: more carefully test whether we are in a system call
For security reasons, UML in is_syscall() needs to have access to code in
vsyscall-page.  The current implementation grants this access by explicitly
allowing access to vsyscall in access_ok_skas().  With this change,
copy_from_user() may be used to read the code.  Ptrace access to vsyscall-page
for debugging already was implemented in get_user_pages() by mainline.  In
i386, copy_from_user can't access vsyscall-page, but returns EFAULT.

To make UML behave as i386 does, I changed is_syscall to use
access_process_vm(current) to read the code from vsyscall-page.  This doesn't
hurt security, but simplifies the code and prepares implementation of
stub-vmas.

Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike f206aabb03 [PATCH] uml: move sigio_user.c to os-Linux/sigio.c
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves sigio_user.c to os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike 8e367065ee [PATCH] uml: move SIGIO startup code to os-Linux/start_up.c
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all startup code from sigio_user.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:38 -08:00
Jeff Dike 9b4f018d92 [PATCH] uml: merge irq_user.c and irq.c
The serial UML OS-abstraction layer patch (um/kernel dir).

This joins irq_user.c and irq.c files.

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:37 -08:00
Jeff Dike 63ae2a94d9 [PATCH] uml: move libc-dependent irq code to os-Linux
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from irq_user.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:37 -08:00
Jeff Dike d9f8b62a6b [PATCH] uml: fix some printf formats
Some printf formats are incorrect for large memory sizes.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:37 -08:00
Jeff Dike c90e12b865 [PATCH] uml: fix declaration of exit()
This fixes a conflict between a header and what gcc "knows" the declaration'
to be.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:37 -08:00
Akinobu Mita f214ef3e19 [PATCH] um: fix undefined reference to hweight32
Build fix for user mode linux.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 08:57:09 -08:00
Linus Torvalds 2e1ca21d46 Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
* master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild: (46 commits)
  kbuild: remove obsoleted scripts/reference_* files
  kbuild: fix make help & make *pkg
  kconfig: fix time ordering of writes to .kconfig.d and include/linux/autoconf.h
  Kconfig: remove the CONFIG_CC_ALIGN_* options
  kbuild: add -fverbose-asm to i386 Makefile
  kbuild: clean-up genksyms
  kbuild: Lindent genksyms.c
  kbuild: fix genksyms build error
  kbuild: in makefile.txt note that Makefile is preferred name for kbuild files
  kbuild: replace PHONY with FORCE
  kbuild: Fix bug in crc symbol generating of kernel and modules
  kbuild: change kbuild to not rely on incorrect GNU make behavior
  kbuild: when warning symbols exported twice now tell user this is the problem
  kbuild: fix make dir/file.xx when asm symlink is missing
  kbuild: in the section mismatch check try harder to find symbols
  kbuild: fix section mismatch check for unwind on IA64
  kbuild: kill false positives from section mismatch warnings for powerpc
  kbuild: kill trailing whitespace in modpost & friends
  kbuild: small update of allnoconfig description
  kbuild: make namespace.pl CROSS_COMPILE happy
  ...

Trivial conflict in arch/ppc/boot/Makefile manually fixed up
2006-03-25 08:48:48 -08:00
Gerd Hoffmann 9a0b5817ad [PATCH] x86: SMP alternatives
Implement SMP alternatives, i.e.  switching at runtime between different
code versions for UP and SMP.  The code can patch both SMP->UP and UP->SMP.
The UP->SMP case is useful for CPU hotplug.

With CONFIG_CPU_HOTPLUG enabled the code switches to UP at boot time and
when the number of CPUs goes down to 1, and switches to SMP when the number
of CPUs goes up to 2.

Without CONFIG_CPU_HOTPLUG or on non-SMP-capable systems the code is
patched once at boot time (if needed) and the tables are released
afterwards.

The changes in detail:

  * The current alternatives bits are moved to a separate file,
    the SMP alternatives code is added there.

  * The patch adds some new elf sections to the kernel:
    .smp_altinstructions
	like .altinstructions, also contains a list
	of alt_instr structs.
    .smp_altinstr_replacement
	like .altinstr_replacement, but also has some space to
	save original instruction before replaving it.
    .smp_locks
	list of pointers to lock prefixes which can be nop'ed
	out on UP.
    The first two are used to replace more complex instruction
    sequences such as spinlocks and semaphores.  It would be possible
    to deal with the lock prefixes with that as well, but by handling
    them as special case the table sizes become much smaller.

 * The sections are page-aligned and padded up to page size, so they
   can be free if they are not needed.

 * Splitted the code to release init pages to a separate function and
   use it to release the elf sections if they are unused.

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-23 07:38:04 -08:00
Nick Piggin 7835e98b2e [PATCH] remove set_page_count() outside mm/
set_page_count usage outside mm/ is limited to setting the refcount to 1.
Remove set_page_count from outside mm/, and replace those users with
init_page_count() and set_page_refcounted().

This allows more debug checking, and tighter control on how code is allowed
to play around with page->_count.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-22 07:54:02 -08:00
Nick Piggin 70dc991d66 [PATCH] remove set_page_count(page, 0) users (outside mm)
A couple of places set_page_count(page, 1) that don't need to.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-22 07:54:01 -08:00
Paul Smith 4f1933620f kbuild: change kbuild to not rely on incorrect GNU make behavior
The kbuild system takes advantage of an incorrect behavior in GNU make.
Once this behavior is fixed, all files in the kernel rebuild every time,
even if nothing has changed.  This patch ensures kbuild works with both
the incorrect and correct behaviors of GNU make.

For more details on the incorrect behavior, see:

http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html

Changes in this patch:
  - Keep all targets that are to be marked .PHONY in a variable, PHONY.
  - Add .PHONY: $(PHONY) to mark them properly.
  - Remove any $(PHONY) files from the $? list when determining whether
    targets are up-to-date or not.

Signed-off-by: Paul Smith <psmith@gnu.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-03-06 00:09:51 +01:00
Paolo 'Blaisorblade' Giarrusso fe1db50c72 [PATCH] uml: tidying COW code
Improve (especially for coherence) some prototypes, and return code of
init_cow_file in error case - for a short write return -EINVAL, otherwise
return the error we got!

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-24 14:31:37 -08:00
Paolo 'Blaisorblade' Giarrusso f462e8f913 [PATCH] uml: better error reporting for read_output
Do precise error handling: print precise error messages, distinguishing short
reads and read errors.  This functions fails frequently enough for me so I
bothered doing this fix.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-24 14:31:37 -08:00
Paolo 'Blaisorblade' Giarrusso dc1561ac01 [PATCH] uml: os_connect_socket error path fixup
Fix an fd leak and a return of -1 instead of -errno in the error path - this
showed up in intensive testing of HPPFS, the os_connect_socket user.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-24 14:31:37 -08:00
Paolo 'Blaisorblade' Giarrusso 635dd50b7d [PATCH] uml: fix ((unused)) attribute
Use __attribute_used__ instead of __attribute__ ((unused)).  This will help
with GCC > 3.2.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-24 14:31:37 -08:00
Paolo 'Blaisorblade' Giarrusso 07f4e2c61c [PATCH] uml: fix usage of kernel_errno in place of errno
To avoid conflicts, in kernel files errno is expanded to kernel_errno, to
distinguish it from glibc errno.  In this case, the code wants to use the libc
errno but the kernel one is used; in the other usage, we return errno in place
of -errno in case of an error.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-24 14:31:37 -08:00
Paolo 'Blaisorblade' Giarrusso 31bc5a3334 [PATCH] uml: correct error messages in COW driver
Improve some error messages in the COW driver, and say V3, not V2, when
talking about V3 format.  Also resync with our userspace code utility a bit
more.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-24 14:31:36 -08:00
Jeff Dike 48b8c10056 [PATCH] uml: remove a dead file
A previous patch removed a file from the build without removing it from the
tree.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Jeff Dike e2216feb37 [PATCH] uml: initialize process FP registers properly
We weren't making sure that we initialized the FP registers of new processes
to sane values.

This patch also moves some defines in the affected area closer to where they
are used.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Jeff Dike 43b00fdbb1 [PATCH] uml: block SIGWINCH in ptrace tester child
The process that UML uses to probe the host's ptrace capabilities can (rarely)
receive a SIGWINCH, confusing the parent.  This fixes that by blocking
SIGWINCH.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Jeff Dike 14d9ead05e [PATCH] uml: balance list_add and list_del in the network driver
The network driver added an interface to the "opened" list when it was
configured, not when it was brought up, and removed it when it was taken down.
 A sequence of ifconfig up, ifconfig down, ...  caused it to be removed
multiple times from the list without being added in between, resulting in a
crash.  This patch moves the add to when the interface is brought up.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Jeff Dike 1d2ddcfb19 [PATCH] uml: close TUN/TAP file descriptors
When UML opens a TUN/TAP device, the file descriptor could be copied into
later, long-lived threads, holding the device open even after the interface is
taken down, preventing it from being brought up again.  This patch makes these
descriptors close-on-exec so that they disappear from helper processes, and
adds CLONE_FILES to a UML helper thread so that the descriptors are closed in
the thread when they are closed elsewhere in UML.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Jeff Dike fbd5577901 [PATCH] uml: add debug switch for skas mode
It doesn't do anything but emit a warning, but there's a user population
that's used to adding 'debug' to the UML command line in order to gdb it.
With skas0 mode, that's not necessary, but these users need some indication
that 'debug' doesn't do what they want.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Paolo 'Blaisorblade' Giarrusso 72e5525765 [PATCH] uml: avoid "CONFIG_NR_CPUS undeclared" bogus error messages
Olaf Hering <olh@suse.de>

Olaf reported UML doesn't build for him with a clear analisys of what happened
- we're using NR_CPUS in files linked against glibc headers.  Seems like it
defines CONFIG_SMP but not CONFIG_NR_CPUS, so we get CONFIG_NR_CPUS
undeclared.

The fix is to move the declaration away from that header file and move it in
asm-um headers, and to add that header where needed.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:23 -08:00
Paolo 'Blaisorblade' Giarrusso 42947cb98f [PATCH] uml: some harmless sparse warning fixes
Fix some simple sparse warnings - a lot more staticness and a misplaced
__user.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:23 -08:00
Paolo 'Blaisorblade' Giarrusso e5cf888631 [PATCH] uml: TT - SYSCALL_DEBUG - fix buglet introduced in cleanup
Fixes a bug introduced in commit e32dacb9f4 -
index is initialized based on syscall before syscall is calculated.

I'm bothering with this mainly because it gives a correct warning when the
config option is enabled, even if the code is for a almost unused debugging
option.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:22 -08:00
Paolo 'Blaisorblade' Giarrusso 3dfd95b378 [PATCH] uml: fix "apples/bananas" typo
Fix stupid typo.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:22 -08:00
Paolo 'Blaisorblade' Giarrusso 854e981cc6 [PATCH] uml: fix hugest stack users
The C99 initialization, with GCC's bad handling, for 6K wide structs (which
_aren't_ on the stack), is causing GCC to use 12K for these silly procs with 3
vars.  Workaround this.

Note that .name = { '\0' } translates to memset(->name, 0, '->name' size) - I verified
this with GCC's docs and a testprogram.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:22 -08:00
Paolo 'Blaisorblade' Giarrusso 98105d47d3 [PATCH] uml: comments about libc-conflict guards
While fixing myself the mktime conflict (which someone already merged), I also
improved a few comments.  Merge them up.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:22 -08:00
Jeff Dike db80581208 [PATCH] uml: fix some typos
Fix a couple of typos.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:22 -08:00
Jeff Dike c6b7a1edcb [PATCH] uml: add a build dependency
kern_constants.h now depends on arch/um/include to make sure it exists
before we try to create symlinks in it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:22 -08:00
Pekka Enberg e8730eabd4 [PATCH] uml: compilation fix when MODE_SKAS disabled
CC      arch/um/sys-i386/ldt.o
arch/um/sys-i386/ldt.c:19:21: proc_mm.h: No such file or directory
make[1]: *** [arch/um/sys-i386/ldt.o] Error 1

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-01 08:53:12 -08:00
Jeff Dike 36a7878a22 [PATCH] uml: use generic sys_rt_sigsuspend
Use the generic sys_rt_sigsuspend.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:30 -08:00
Jeff Dike 2fc10620e7 [PATCH] uml: add TIF_RESTORE_SIGMASK support
Add support for TIF_RESTORE_SIGMASK.  I copy the i386 handling of the flag.
sys_sigsuspend is also changed to follow i386.
Also a bit of cleanup -
   turn an if into a switch
   get rid of a couple more emacs formatting comments

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:30 -08:00
Paolo 'Blaisorblade' Giarrusso a374a48ffb [PATCH] uml ubd code: fix a bit of whitespace
Correct a bit of whitespace problems while working here.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso 4833aff757 [PATCH] uml: allow again to move backing file and to override saved location
When the user specifies both a COW file and its backing file, if the previous
backing file is not found, currently UML tries again to use it and fails.

This can be corrected by changing same_backing_files() return value in that
case, so that the caller will try to change the COW file to point to the new
location, as already done in other cases.

Additionally, given the change in the meaning of the func, change its name,
invert its return value, so all values are inverted except when
stat(from_cow,&buf2) fails.  And add some comments and two minor bugfixes -
remove a fd leak (return err rather than goto out) and a repeated check.

Tested well.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso ce2d2aedcc [PATCH] uml: arch Kconfig menu cleanups
*) mark as "EXPERIMENTAL" various items that either aren't very stable or
   that are actively crashing the setup of users which don't really need them
   (i.e.  HIGHMEM and 3-level pagetables on x86 - nobody needs either,
   everybody reports "I'm using it and getting trouble").

*) move net/Kconfig near to the rest of network configurations, and
   drivers/block/Kconfig near "Block layer" submenu.

*) it's useless and doesn't work well to force NETDEVICES on and to disable
   the prompt like it's done.  Better remove the attempt, and change that to a
   simple "default y if UML".

*) drop the warning about "report problems about HPPFS" - it's redundant
   anyway, as that's the usual procedure, and HPPFS users are especially
   technical (i.e.  they know reporting bugs is _good_).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso b63162939c [PATCH] uml: avoid malloc to sleep in atomic sections
Ugly trick to help make malloc not sleeping - we can't do anything else.  But
this is not yet optimal, since spinlock don't trigger in_atomic() when
preemption is disabled.

Also, even if ugly, this was already used in one place, and was even more
bogus.  Fix it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso b6a2b13778 [PATCH] uml: sigio code - reduce spinlock hold time
In a previous patch I shifted an allocation to being atomic.

In this patch, a better but more intrusive solution is implemented, i.e.  hold
the lock only when really needing it, especially not over pipe operations, nor
over the culprit allocation.

Additionally, while at it, add a missing kfree in the failure path, and make
sure that if we fail in forking, write_sigio_pid is -1 and not, say, -ENOMEM.

And fix whitespace, at least for things I was touching anyway.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso 71c8d4c3aa [PATCH] uml: fix spinlock recursion and sleep-inside-spinlock in error path
In this error path, when the interface has had a problem, we call dev_close(),
which is disallowed for two reasons:

*) takes again the UML internal spinlock, inside the ->stop method of this
   device
*) can be called in process context only, while we're in interrupt context.

I've also thought that calling dev_close() may be a wrong policy to follow,
but it's not up to me to decide that.

However, we may end up with multiple dev_close() queued on the same device.
But the initial test for (dev->flags & IFF_UP) makes this harmless, though -
and dev_close() is supposed to care about races with itself.  So there's no
harm in delaying the shutdown, IMHO.

Something to mark the interface as "going to shutdown" would be appreciated,
but dev_deactivate has the same problems as dev_close(), so we can't use it
either.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso e56a78855a [PATCH] uml: networking - clear transport-specific structure
Pre-clear transport-specific private structure before passing it down.

In fact, I just got a slab corruption and kernel panic on exit because kfree()
was called on a pointer which probably was never allocated, BUT hadn't been
set to NULL by the driver.

As the code is full of such errors, I've decided for now to go the safe way
(we're talking about drivers), and to do the simple thing.  I'm also starting
to fix drivers, and already sent a patch for the daemon transport.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso c42791b6ec [PATCH] uml: make daemon transport behave properly
Avoid uninitialized data in the daemon_data structure.  I used this transport
before doing proper setup before-hand, and I got some very nice SLAB
corruption due to freeing crap pointers.  So just make sure to clear
everything when appropriate.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:20 -08:00
Bodo Stroesser 097fdf06c6 [PATCH] uml: TT mode softint fixes
Some fixes to make softints work in tt mode.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:20 -08:00
Jeff Dike c83d4635ee [PATCH] uml: use setjmp/longjmp instead of sigsetjmp/siglongjmp
Now that we are doing soft interrupts, there's no point in using sigsetjmp and
siglongjmp.  Using setjmp and longjmp saves a sigprocmask on every jump.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:20 -08:00
Jeff Dike 1d7173baf2 [PATCH] uml: implement soft interrupts
This patch implements soft interrupts.  Interrupt enabling and disabling no
longer map to sigprocmask.  Rather, a flag is set indicating whether
interrupts may be handled.  If a signal comes in and interrupts are marked as
OK, then it is handled normally.  If interrupts are marked as off, then the
signal handler simply returns after noting that a signal needs handling.  When
interrupts are enabled later on, this pending signals flag is checked, and the
IRQ handlers are called at that point.

The point of this is to reduce the cost of local_irq_save et al, since they
are very much more common than the signals that they are enabling and
disabling.  Soft interrupts produce a speed-up of ~25% on a kernel build.

Subtleties -

    UML uses sigsetjmp/siglongjmp to switch contexts.  sigsetjmp has been
    wrapped in a save_flags-like macro which remembers the interrupt state at
    setjmp time, and restores it when it is longjmp-ed back to.

    The enable_signals function has to loop because the IRQ handler
    disables interrupts before returning.  enable_signals has to return with
    signals enabled, and signals may come in between the disabling and the
    return to enable_signals.  So, it loops for as long as there are pending
    signals, ensuring that signals are enabled when it finally returns, and
    that there are no pending signals that need to be dealt with.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:20 -08:00
Jeff Dike 09ee011eb3 [PATCH] uml: eliminate some globals
Stop using global variables to hold the file descriptor and offset used to map
the skas0 stubs.  Instead, calculate them using the page physical addresses.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:20 -08:00
Gennady Sharapov abaf69773d [PATCH] uml: move libc-dependent skas process handling
The serial UML OS-abstraction layer patch (um/kernel/skas dir).

This moves all systemcalls from skas/process.c file under os-Linux dir and
join skas/process.c and skas/process_kern.c files.

Signed-off-by: Gennady Sharapov <gennady.v.sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:19 -08:00
Gennady Sharapov f45d9fc9d8 [PATCH] uml: move libc-dependent skas memory mapping code
The serial UML OS-abstraction layer patch (um/kernel/skas dir).

This moves all systemcalls from skas/mem_user.c file under os-Linux dir and
join skas/mem_user.c and skas/mem.c files.

Signed-off-by: Gennady Sharapov <gennady.v.sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:19 -08:00
Gennady Sharapov 4abfbf4034 [PATCH] uml: move headers to arch/um/include
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves skas headers to arch/um/include.

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:19 -08:00
Bodo Stroesser 2c332a2513 [PATCH] uml: change interface to boot_timer_handler
Current implementation of boot_timer_handler isn't usable for s390.  So I
changed its name to do_boot_timer_handler, taking (struct sigcontext *)sc as
argument.  do_boot_timer_handler is called from new boot_timer_handler() in
arch/um/os-Linux/signal.c, which uses the same mechanisms as other signal
handler to find out sigcontext pointer.

Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:19 -08:00
Gennady Sharapov cff65c4f0e [PATCH] uml: move libc-dependent time code
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from time.c file under os-Linux dir and joins
time.c and tine_kernel.c files

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:19 -08:00
Gennady Sharapov 4fef0c10fa [PATCH] uml: move libc-dependent utility procedures
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from user_util.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:19 -08:00
Bodo Stroesser 12919aa6e0 [PATCH] uml: move LDT creation
s390 doesn't have a LDT.  So MM_COPY_SEGMENTS will not be supported on s390.

The only user of MM_COPY_SEGMENTS is new_mm(), but that's no longer useful, as
arch/sys-i386/ldt.c defines init_new_ldt(), which is called immediately after
new_mm().  So we should copy host's LDT in init_new_ldt(), if /proc/mm is
available, to have this subarch specific call in subarch code.

Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:18 -08:00
Linus Torvalds 3f02d072d4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2006-01-15 16:43:29 -08:00
Miklos Szeredi ee7be5de35 [PATCH] uml: fix symbol for mktime
LD      .tmp_vmlinux1
/usr/lib/gcc-lib/i486-linux/3.3.4/../../../libc.a(mktime.o): In function `timelocal':
: multiple definition of `mktime'
kernel/built-in.o:kernel/time.c:604: first defined here
/usr/bin/ld: Warning: size of symbol `mktime' changed from 134 in kernel/built-in.o to 44 in /usr/lib/gcc-lib/i486-linux/3.3.4/../../../libc.a(mktime.o)
collect2: ld returned 1 exit status

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-14 18:27:06 -08:00
Jesper Juhl 014c2544e6 return statement cleanup - kill pointless parentheses
This patch removes pointless parentheses from return statements.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-01-15 02:37:08 +01:00
Al Viro 579b3ea591 [PATCH] uml: task_stack_page()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-12 09:08:53 -08:00
Al Viro ca9bc0bb2d [PATCH] uml: task_thread_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-12 09:08:53 -08:00
Jeff Dike beb25c6e27 [PATCH] uml: kill an unused variable
The HDIO_GETGEO patch left an unused variable in the UML block driver.  This
gets rid of it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-11 18:42:10 -08:00
Jeff Dike 621009f4ba [PATCH] uml: fix debug output on x86_64
The debug-stub patch was broken on x86_64 because it thinks the frame size
there is 168 words.  In reality, it is 168 bytes, and using HOST_FRAME_SIZE,
which is expressed in consistent units across architectures, fixes this.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-11 18:42:10 -08:00
Jeff Dike a174b30e29 [PATCH] uml: eliminate doubled boot output
CON_PRINTBUFFER was a bad idea for the mconsole console.  It causes the boot
output to be printed twice.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-11 18:42:09 -08:00
Jeff Dike edc0e65956 [PATCH] uml: revert compile-time option checking
Undo the previous no-modes patch since Adrian Bunk sent in a kbuild way of
doing the same thing.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-11 18:42:09 -08:00
Jeff Dike 114d1ff4f5 [PATCH] uml: update Kconfig help
The MODE_TT help was a little outdated.  This updates it in light of the
existence of skas0 mode.  It's also turned off by default since it is mostly
obsoleted by skas0 mode.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-11 18:42:09 -08:00
Jeff Dike 4ee189a926 [PATCH] uml: fix missing KBUILD_BASENAME
2.6.15-mm1 caused kernel-offsets.c to stop compiling with a syntax error in a
header.  The problem was with KBUILD_BASENAME, which didn't get a definition
with the by-hand compilation in the main UML Makefile.

This was OK before since the expansion was syntactically the same as the
KBUILD_BASENAME token.  With -mm1, the expansion is now a quote-delimited
string, so there needs to be a definition of it.

Since kernel-offsets.c is basically the same as other arches' asm-offsets.c,
and those seem to build OK, this patch turns kernel-offsets.c into
asm-offsets.c.  kernel-offsets.c is in arch/um/sys-$(SUBARCH), i.e.  sys-i386
and sys-x86_64, while kbuild expects it to be in arch/um/kernel.
kernel-offsets.c is moved to
arch/um/include/sysdep-$(SUBARCH)/kernel-offsets.h, which is included by
arch/um/kernel/asm-offsets.c.  With that, include/asm-um/asm-offsets.h is
generated automatically.  kernel-offsets.h continues to exist because it needs
to be accessible to userspace UML code, and include/asm-um isn't.  So, a
symlink is made from arch/um/include/kernel-offsets.h to
include/asm-um/asm-offsets.h.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-11 18:42:09 -08:00
Alan Cox 33f0f88f1c [PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.

This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.

When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.

For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).

Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.

The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.

I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.

Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real.  That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.

Description:

tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification].  It
does now also return the number of chars inserted

There are also

tty_buffer_request_room(tty, len)

which asks for a buffer block of the length requested and returns the space
found.  This improves efficiency with hardware that knows how much to
transfer.

and tty_insert_flip_string_flags(tty, str, flags, len)

to insert a string of characters and flags

For a smart interface the usual code is

    len = tty_request_buffer_room(tty, amount_hardware_says);
    tty_insert_flip_string(tty, buffer_from_card, len);

More description!

At the moment tty buffers are attached directly to the tty.  This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)

I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers.  This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.

So far so good.  Lots of drivers reference tty->flip.*.  Several of them also
call directly and unsafely into function pointers it provides.  This will all
break.  Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.

At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say

 int tty_buffer_request_room(tty, size)

Try and ensure at least size bytes are available, returns actual room (may be
zero).  At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative.  (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space.  The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.

 int tty_insert_flip_char(tty, ch, flag)

As before insert a character if there is room.  Now returns 1 for success, 0
for failure.

 int tty_insert_flip_string(tty, str, len)

Insert a block of non error characters.  Returns the number inserted.

 int tty_prepare_flip_string(tty, strptr, len)

Adjust the buffer to allow len characters to be added.  Returns a buffer
pointer in strptr and the length available.  This allows for hardware that
needs to use functions like insl or mencpy_fromio.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-10 08:01:59 -08:00
Thomas Gleixner becf8b5d00 [PATCH] hrtimer: convert posix timers completely
- convert posix-timers.c to use hrtimers

- remove the now obsolete abslist code

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-10 08:01:39 -08:00
Matt Mackall e585e47031 [PATCH] tiny: Make *[ug]id16 support optional
Configurable 16-bit UID and friends support

This allows turning off the legacy 16 bit UID interfaces on embedded platforms.

   text    data     bss     dec     hex filename
3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3328268  529040  190556 4047864  3dc3f8 vmlinux

From: Adrian Bunk <bunk@stusta.de>

    UID16 was accidentially disabled for !EMBEDDED.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:14:11 -08:00
Eric W. Biederman 5e38291d80 [PATCH] Don't attempt to power off if power off is not implemented
The problem.  It is expected that /sbin/halt -p works exactly like
/sbin/halt, when the kernel does not implement power off functionality.

The kernel can do a lot of work in the reboot notifiers and in
device_shutdown before we even get to machine_power_off.  Some of that
shutdown is not safe if you are leaving the power on, and it definitely
gets in the way of using sysrq or pressing ctrl-alt-del.  Since the
shutdown happens in generic code there is no way to fix this in
architecture specific code :(

Some machines are kernel oopsing today because of this.

The simple solution is to turn LINUX_REBOOT_CMD_POWER_OFF into
LINUX_REBOOT_CMD_HALT if power_off functionality is not implemented.

This has the unfortunate side effect of disabling the power off
functionality on architectures that leave pm_power_off to null and still
implement something in machine_power_off.  And it will break the build on
some architectures that don't have a pm_power_off variable at all.

On both counts I say tough.

For architectures like alpha that don't implement the pm_power_off variable
pm_power_off is declared in linux/pm.h and it is a generic part of our
power management code, and all architectures should implement it.

For architectures like parisc that have a default power off method in
machine_power_off if pm_power_off is not implemented or fails.  It is easy
enough to set the pm_power_off variable.  And nothing bad happens there,
the machines just stop powering off.

The current semantics are impossible without a flag at the top level so we
can avoid the problem code if a power off is not implemented.  pm_power_off
is as good a flag as any with the bonus that it works without modification
on at least x86, x86_64, powerpc, and ppc today.

Andrew can you pick this up and put this in the mm tree.  Kernels that
don't compile or don't power off seem saner than kernels that oops or
panic.  Until we get the arch specific patches for the problem
architectures this probably isn't smart to push into the stable kernel.
Unfortunately I don't have the time at the moment to walk through every
architecture and make them work.  And even if I did I couldn't test it :(

From: Hirokazu Takata <takata@linux-m32r.org>

    Add pm_power_off() for build fix of arch/m32r/kernel/process.c.

From: Miklos Szeredi <miklos@szeredi.hu>

    UML build fix

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Hayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:14:00 -08:00
Christoph Hellwig a885c8c431 [PATCH] Add block_device_operations.getgeo block device method
HDIO_GETGEO is implemented in most block drivers, and all of them have to
duplicate the code to copy the structure to userspace, as well as getting
the start sector.  This patch moves that to common code [1] and adds a
->getgeo method to fill out the raw kernel hd_geometry structure.  For many
drivers this means ->ioctl can go away now.

[1] the s390 block drivers are odd in this respect.  xpram sets ->start
    to 4 always which seems more than odd, and the dasd driver shifts
    the start offset around, probably because of it's non-standard
    sector size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@suse.de>
Cc: <mike.miller@hp.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:54 -08:00
Adrian Bunk eafbaa9469 [PATCH] uml: prevent MODE_SKAS=n and MODE_TT=n
If MODE_TT=n, MODE_SKAS must be y.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:40 -08:00
Jeff Dike c0a689d05d [PATCH] uml: whitespace cleanup
This fixes some mangled whitespace added by the earlier trap_user.c patch.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:40 -08:00
Gennady Sharapov c66fdd5e32 [PATCH] uml: merge trap_user.c and trap_kern.c
The serial UML OS-abstraction layer patch (um/kernel dir).

This joins trap_user.c and trap_kernel.c files.

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:39 -08:00
Gennady Sharapov ea2ba7dc3d [PATCH] uml: move libc-dependent code from trap_user.c
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from trap_user.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:39 -08:00
Gennady Sharapov 0805d89c15 [PATCH] uml: move libc-dependent code from signal_user.c
The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from signal_user.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:39 -08:00
Jeff Dike 8d93c700a4 [PATCH] uml: free network IRQ correctly
Free the network IRQ when closing down the network devices at shutdown.
Delete the device from the opened devices list on close.

These prevent an -EBADF when later disabling SIGIO on all extant descriptors
and a complaint from free_irq about freeing the IRQ twice.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:48 -08:00
Jeff Dike 3a331a511a [PATCH] uml: fix whitespace in mconsole driver
Fix up some bogus spacing in the mconsole driver.  Also delete the
emacs formatting comment at the end.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:48 -08:00
Jeff Dike 4111b025dc [PATCH] uml: capture printk output for mconsole sysrq
Pass sysrq output back to the mconsole client using the mechanism
introduced for stack output.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:48 -08:00
Jeff Dike 6f517d3fc8 [PATCH] uml: capture printk output for mconsole stack
The stack command now sends the printk output back to the mconsole client.
This is done by registering a special console for the mconsole driver.  This
receives all printk output.  Normally, it is ignored, but when a stack command
is issued, any printk output will be sent back to the client.

This will capture any printk output, whether it is stack output or not, since
we can't tell the difference.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:48 -08:00
Jeff Dike 7b033e1fde [PATCH] uml: add mconsole_reply variant with length param
This is needed for the console output patch, since we have a possibly
non-NULL-terminated string there.  So, the new interface takes a string and a
length, and the old interface calls strlen on its string and calls the new
interface with the length.

There's also a bit of whitespace cleanup.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:47 -08:00
Jeff Dike 44700a4469 [PATCH] uml: better diagnostics for broken configs
Produce a compile-time error if both MODE_SKAS and MODE_TT are disabled.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:47 -08:00
Jeff Dike e464bf2bed [PATCH] uml: SIGWINCH handling cleanup
Code cleanup - unregister_winch and winch_cleanup had some duplicate code.
This is now abstracted out into free_winch.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:47 -08:00
Jeff Dike 7eebe8a9c5 [PATCH] uml: umid cleanup
This patch cleans up the umid code:

- The only_if_set argument to get_umid is gone.

- get_umid returns an empty string rather than NULL if there is no umid.

- umid_is_random is gone since its users went away.

- Some printfs were turned into printks because the code runs late enough
  that printk is working.

- Error paths were cleaned up.

- Some functions now return an error and let the caller print the error
  message rather than printing it themselves.  This eliminates the practice of
  passing a pointer to printf or printk in, depending on where in the boot
  process we are.

- Major tidying of not_dead_yet - mostly error path cleanup, plus a comment
  explaining why it doesn't react to errors the way you might expect.

- Calls to os_* interfaces that were moved under os are changed back to
  their native libc forms.

- snprintf, strlcpy, and their bounds-checking friends are used more often,
  replacing by-hand bounds checking in some places.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:47 -08:00
Jeff Dike 2264c475e4 [PATCH] uml: separate libc-dependent umid code
I reworked Gennady's umid OS abstraction patch because the code shouldn't
be moved entirely to os.  As it turns out, I moved most of it anyway.  This
patch is the minimal one needed to move the code and have it work.
It turns out that the concept of the umid is OS-independent, but
almost everything else about the implementation is OS-dependent.

This is code movement without cleanup - a follow-on patch tidies
everything up without shuffling code around.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:47 -08:00
Jeff Dike e4dcee8099 [PATCH] uml: Add throttling to console driver
This patch adds support for throttling and unthrottling input when the tty
driver can't handle it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike 9159c9dfff [PATCH] uml: Fix flip_buf full handling
When the tty flip_buf is full, it's a good idea to delay the input processing
for a jiffy, rather than just scheduling the tasklet immediately.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike 165dc59116 [PATCH] uml: Simplify console opening/closing and irq registration
This patch simplifies the opening and closing of host console devices and the
registration and deregistration of IRQs.  The intent is to make it obvious
that an IRQ can't exist without an open file descriptor.

chan_enable will now open the channel, and when both opening and IRQ
registration are desired, this should be used.  Opening only is done for the
initial console, so that interface still needs to exist.

The free_irqs_later interface is now gone.  It was intended to avoid freeing
an IRQ while it was being processed.  It did this, but it didn't eliminate the
possiblity of free_irq being called from an interrupt, which is bad.  In its
place is a list of irqs to be freed, which is processed by the signal handler
just before exiting.  close_one_chan now disables irqs.

When a host device disappears, it is just closed, and that disables IRQs.

The device id registered with the IRQ is now the chan structure, not the tty.
This is because the interrupt arrives on a descriptor associated with the
channel.  This caused equivalent changes in the arguments to line_timer_cb.
line_disable is gone since it is not used any more.

The count field in the line structure is gone.  tty->count is used instead.

The complicated logic in sigio_handler with freeing IRQs when necessary and
making sure its idea of the next irq is correct is now much simpler.  The irq
list can't be rearranged underneath it, so it is now a simple list walk.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike 1f80171e81 [PATCH] uml: move console configuration
This patch changes when console devices are configured in order to prepare the
ground for the next patch.

parse_chan_pair is now done earlier, when initcalls are run, rather than when
the device is opened.

When a host device disappears, the channel list is closed, but not freed.
This is required by the previous change.  line_config now takes the options
structure as an argument, and line_open doesn't.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike 418e55d49b [PATCH] uml: line_setup interface change
line_setup is changed to return the device which it set up, rather than just
success or failure.  This will be important in the line-config patch.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike 9010772cdf [PATCH] uml: Add static initializations and declarations
Some structure fields were being dynamically initialized when they could be
initialized at compile-time instead.  This also makes some declarations static
(in the C sense).

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike d571cd18f2 [PATCH] uml: Move mconsole support out of generic code
A bit of restructuring which eliminates the all_allowed argument (which is
mconsole-specific) to line_setup.  That logic is moved to the mconsole
callback.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Jeff Dike 88890b8874 [PATCH] uml: Remove unneeded structure field
This removes a structure field which turned out to be pointless, and
references to it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Jeff Dike 0834cc77af [PATCH] uml: use ARRAY_SIZE
This patch replaces instances of "sizeof(foo)/sizeof(foo[0])" with
ARRAY_SIZE(foo), which expands to the same thing.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Jeff Dike d50084a299 [PATCH] uml: Formatting changes
This patch makes a bunch of non-functional changes -
    return(foo); becomes return foo;
    some statements are broken across lines for readability
    some trailing whitespace is cleaned up
    open_one_chan took four arguments, three of which could be
       deduced from the first.  Accordingly, they were eliminated.
    some examples of "} else {" had a newline added
    some whitespace cleanup in the indentation
    lines_init got some control flow cleanup
    some long lines were broken
    removed another emacs-specific C formatting comment

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Jeff Dike 1b57e9c278 [PATCH] uml: non-void functions should return something
There are a few functions which are declared to return something, but don't.
These are actually infinite loops which are forced to be declared as non-void.
 This makes them all return 0.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Jeff Dike 970d6e3a34 [PATCH] uml: use kstrdup
There were a bunch of calls to uml_strdup dating from before kstrdup was
introduced.  This changes those calls.  It doesn't eliminate the definition
since there is still a couple of calls in userspace code (which should
probably call the libc strdup).

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Paolo 'Blaisorblade' Giarrusso 63b4444241 [PATCH] uml: fix compilation with CONFIG_MODE_TT disabled
Fix UML compilation when SKAS mode is disabled. Indeed, we were compiling
SKAS-only object files, which failed due to some SKAS-only headers being
excluded from the search path.

Thanks to the bug report from Pekka J Enberg.

Acked-by: Pekka J Enberg <penberg (at) cs ! helsinki ! fi>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-29 09:48:15 -08:00
Paolo 'Blaisorblade' Giarrusso 74433c0fe1 [PATCH] Hostfs: update for new glibc - add missing symbol exports
Today, when compiling UML, I got warnings for two used unexported symbols:
readdir64 and truncate64. Indeed, my glibc headers are aliasing readdir to
readdir64 and truncate to truncate64 (and so on).

I'm then adding additional exports. Since I've no idea if the symbols where
always provided in the supported glibc's, I've added weak definitions too.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-29 09:48:15 -08:00
Paolo 'Blaisorblade' Giarrusso 516949480d [PATCH] uml: fix random segfaults at bootup
Don't use printk() where "current_thread_info()" is crap.

Until when we switch to running on init_stack, current_thread_info() evaluates
to crap. Printk uses "current" at times (in detail, &current is evaluated with
CONFIG_DEBUG_SPINLOCK to check the spinlock owner task).

And this leads to random segmentation faults.

Exactly, what happens is that &current = *(current_thread_info()), i.e. round
down $esp and dereference the value. I.e. access the stack below $esp, which
causes SIGSEGV on a VM_GROWSDOWN vma (see arch/i386/mm/fault.c).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-29 09:48:15 -08:00
Jeff Dike 5b7b15afee [PATCH] uml skas0: stop gcc's insanity
With Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

UML skas0 stub has been miscompiling for many people (incidentally not
the authors), depending on the used GCC versions.

I think (and testing on some GCC versions shows) this patch avoids the
fundamental issue which is behind this, namely gcc using the stack when
we have just replaced it, behind gcc's back.  The remapping and storage
of the return value is hidden in a blob of asm, hopefully giving gcc no
room for creativity.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-18 11:19:44 -08:00
Paolo 'Blaisorblade' Giarrusso 76c842d8f8 [PATCH] uml - fix some funkiness in Kconfig
So you may have seen the miniconfig stuff wander by, which means that my
build script exits if there's a .config error, and we have this:

  fs/Kconfig:1749:warning: 'select' used by config symbol 'CIFS_UPCALL'
	refer to undefined symbol 'CONNECTOR'

This makes it shut up.

Signed-off-by: Rob Landley <rob@landley.net>
[ Verified it makes sense. ]
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-18 11:19:44 -08:00
Rob Landley 53c0b59dcd [PATCH] uml: fix dynamic linking on some 64-bit distros
With Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

The current UML build assumes that on x86-64 systems, /lib is a symlink
to /lib64, but in some distributions (like PLD and CentOS) they are
separate directories, so the 64 bit library loader isn't found.  This
patch inserts /lib64 at the start of the rpath on x86-64 UML builds.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-18 11:19:44 -08:00
Paolo 'Blaisorblade' Giarrusso 9ce7677cfd [PATCH] uml: arch/um/scripts/Makefile.rules - remove duplicated code
Duplicated code - the patch adding it was probably applied twice without
enough care.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-18 11:19:44 -08:00
Pekka J Enberg bf001b2679 [PATCH] uml: fix compile error for tt
arch/um/kernel/tt/uaccess.c: In function `copy_from_user_tt':
arch/um/kernel/tt/uaccess.c:11: error: `FIXADDR_USER_START' undeclared (first use in this function)
arch/um/kernel/tt/uaccess.c:11: error: (Each undeclared identifier is reported only once
arch/um/kernel/tt/uaccess.c:11: error: for each function it appears in.)

I get the compile error when I disable CONFIG_MODE_SKAS.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Paolo Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-12 08:57:43 -08:00
Jeff Dike aa1a64ee12 [PATCH] uml: eliminate use of libc PAGE_SIZE
On some systems, libc PAGE_SIZE calls getpagesize, which can't happen from a
stub.  So, I use UM_KERN_PAGE_SIZE, which is less variable in its definition,
instead.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-22 09:13:41 -08:00
Jeff Dike 17d469715c [PATCH] uml: properly invoke x86_64 system calls
This patch makes stub_segv use the stub_syscall macros.  This was needed
anyway, but the bug that prompted this was the discovery that gcc was storing
stuff in RCX, which is trashed across a system call.  This is exactly the sort
of problem that the new macros fix.

There is a stub_syscall0 for getpid.  stub_segv was changed to be a libc file,
and that caused some include changes.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-22 09:13:41 -08:00
Jeff Dike e23181deec [PATCH] uml: eliminate anonymous union and clean up symlink lossage
This gives a name to the anonymous union introduced in skas-hold-own-ldt,
allowing to build on a wider range of gccs.

It also removes ldt.h, which somehow became real, and replaces it with a
symlink, and creates ldt-x86_64.h as a copy of ldt-i386.h for now.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-22 09:13:41 -08:00
Jeff Dike 39d730ab87 [PATCH] uml: eliminate use of local in clone stub
We have a bug in the i386 stub_syscall6 which pushes ebp before the system
call and pops it afterwards.  Because we use syscall6 to remap the stack, the
old contents of the stack (and the former value of ebp) are no longer
available.  Some versions of gcc make from a real local, accessed through ebp,
despite my efforts to make it obvious that references to from are really
constants.  This patch attempts to make it even more obvious by eliminating
from and using a macro to access the stub's data explicitly with constants.

My original thinking on this was to replace syscall6 with a remap_stack
interface which saved ebp someplace and restored it afterwards.  The problem
is that there are no registers to put it in, except for esp.  That could work,
since we can store a constant in esp after the mmap because we just replaced
the stack.  However, this approach seems a tad cleaner.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-22 09:13:41 -08:00
Paolo 'Blaisorblade' Giarrusso ba260e23ef [PATCH] uml: fix daemon transport exit path bug
Fix some exit path bugs in the daemon driver.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:15 -08:00
Paolo 'Blaisorblade' Giarrusso 7a590611c0 [PATCH] uml: fix access_ok
The access_ok_tt() macro is bogus, in that a read access is unconditionally
considered valid.

I couldn't find in SCM logs the introduction of this check, but I went back to
2.4.20-1um and the definition was the same.

Possibly this was done to avoid problems with missing set_fs() calls, but
there can't be any I think because they would fail with SKAS mode.
TT-specific code is still to check.

Also, this patch joins common code together, and makes the "address range
wrapping" check happen for all cases, rather than for only some.

This may, possibly, be reoptimized at some time, but the current code doesn't
seem clever, just confused.

* Important: I've also had to change references to access_ok_{tt,skas} back to
  access_ok - the kernel wasn't that happy otherwise.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:15 -08:00
Paolo 'Blaisorblade' Giarrusso 55c033c1f6 [PATCH] uml console channels: fix the API of console_write
Since the 4th param is unused, remove it altogether.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:14 -08:00
Paolo 'Blaisorblade' Giarrusso fd9bc53b99 [PATCH] uml console channels: remove console_write wrappers
We were using a long series of (stupid) wrappers which all call
generic_console_write().  Since the wrappers only change the 4th param, which
is unused by the called proc, remove them and call generic_console_write()
directly.

If needed at any time in the future to reintroduce this stuff, the member
could be moved to a generic struct, to avoid this duplicated handling.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:14 -08:00
Paolo 'Blaisorblade' Giarrusso c50d2c4d66 [PATCH] uml: fix mcast network driver error handling
printk clears the host errno (I verified this in debugging and it's reasonable
enough, given that it ends via a write call on some fd, especially since
printk() goes on /dev/tty0 which is often the host stdout).  So save errno
earlier.  There's no reason to change the printk calls to use -err rather than
errno - the assignment can't clear errno.

And in the first failure path, we used to return 0 too (and this time more
clearly), which is totally wrong.  0 is a success fd, which is then registered
and gives a "registering fd twice" warning.

Finally, fix up some whitespace.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:14 -08:00
Paolo 'Blaisorblade' Giarrusso 85977376c7 [PATCH] uml: fixups for "reuse i386 cpu-specific tuning"
A few fixups - show the new submenu only for x86 subarchitecture (it does not
make sense to show it for x86_64 users) and remove X86_CMPXCHG, which is now a
duplicate of Kconfig.i386, even though Kconfig doesn't complain (we also miss
the dependency on !M386 CPU).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:14 -08:00
Paolo 'Blaisorblade' Giarrusso 3b8d108a6e [PATCH] uml: micro fixups to arch Kconfig
Remove a stone-age comment (UM *does* have a MMU, i.e.  the host), and fix a
dependency (introduced in commit 02edeb586a) to
do what was intended.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:14 -08:00
Paolo 'Blaisorblade' Giarrusso cbc24afa82 [PATCH] uml: remove bogus WARN_ON, triggerable harmlessly on a page fault race
The below warning was added in place of pte_mkyoung(); if (is_write)
pte_mkdirty();

In fact, if the PTE is not marked young/dirty, our dirty/accessed bit
emulation would cause the TLB permission not to be changed, and so we'd loop,
and given we don't support preemption yet, we'd busy-hang here.

However, I've seen this warning trigger without crashes during a loop of
concurrent kernel builds, at random times (i.e. like a race condition), and I
realized that two concurrent faults on the same page, one on read and one on
write, can trigger it. The read fault gets serviced and the PTE gets marked
writable but clean (it's possible on a shared-writable mapping), while the
generic code sees the PTE was already installed and returns without action. In
this case, we'll see another fault and service it normally.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-13 18:14:14 -08:00
Linus Torvalds 5643f000c1 Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel 2005-11-11 09:24:26 -08:00
Russell King 3ae5eaec1d [DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-09 22:32:44 +00:00
Christoph Hellwig 6d3874844f [PATCH] uml_net: use ethtool_ops
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-09 01:10:10 -05:00
Jesper Juhl b2325fe1b7 [PATCH] kfree cleanup: arch
This is the arch/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in arch/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:54:06 -08:00
Nishanth Aravamudan bc874d174b [PATCH] um: fix-up schedule_timeout() usage
Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:56 -08:00
Christoph Hellwig 481bed4542 [PATCH] consolidate sys_ptrace()
The sys_ptrace boilerplate code (everything outside the big switch
statement for the arch-specific requests) is shared by most architectures.
This patch moves it to kernel/ptrace.c and leaves the arch-specific code as
arch_ptrace.

Some architectures have a too different ptrace so we have to exclude them.
They continue to keep their implementations.  For sh64 I had to add a
sh64_ptrace wrapper because it does some initialization on the first call.
For um I removed an ifdefed SUBARCH_PTRACE_SPECIAL block, but
SUBARCH_PTRACE_SPECIAL isn't defined anywhere in the tree.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-By: David Howells <dhowells@redhat.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:42 -08:00
Paolo 'Blaisorblade' Giarrusso 26d89d1eef [PATCH] uml: build host-binaries with the native host arch again
This patch reverts back the changes to HOSTCFLAGS and HOSTLDFLAGS

When we were building complete binaries to get constants (such as ptrace
register layout on stack) from host userspace headers, we needed to make the
arch for building HOST binaries match our one: i.e.  on a 64bit system
compiling 32bit binaries, we compile 32-bit hostprogs and need, say, 32-bit
ncurses.  Now we can revert that - that avoids problem with, say, menuconfig
and ncurses, on a system which can't compile well 32-bit programs.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:32 -08:00
Paolo 'Blaisorblade' Giarrusso 353f8d1cd5 [PATCH] uml: fix hardcoded ZONE_* constants in zone setup
Remove usage of hardcoded constants in paging_init().

By chance I spotted a bug in zones_setup involving a change to ZONE_*
constants, due to the ZONE_DMA32 patch from Andi Kleen (which is in -mm).
So, possibly, instead of zones_size[2] you will find zones_size[3] in the
code, but that change is wrong and this patch is still correct.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:32 -08:00