aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um (follow)
AgeCommit message (Collapse)AuthorFilesLines
2007-12-23uml: user of helper_wait() got missed when it got extra argumentsAl Viro1-2/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-12-17uml: stop gdb from deleting breakpoints when running UMLStanislaw Gruszka12-56/+50
Sometimes when UML is debugged gdb miss breakpoints. When process traced by gdb do fork, debugger remove breakpoints from child address space. There is possibility to trace more than one fork, but this not work with UML, I guess (only guess) there is a deadlock - gdb waits for UML and UML waits for gdb. When clone() is called with SIGCHLD and CLONE_VM flags, gdb see this as PTRACE_EVENT_FORK not as PTRACE_EVENT_CLONE and remove breakpoints from child and at the same time from traced process, because either have the same address space. Maybe it is possible to do fix in gdb, but I'm not sure if there is easy way to find out if traced and child processes share memory. So I do fix for UML, it simply do not call clone() with both SIGCHLD and CLONE_VM flags together. Additionally __WALL flag is used for waitpid() to assure not miss clone and normal process events. [ jdike - checkpatch fixes ] Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-12-11[UM]: Fix use of skb after netif_rxJulia Lawall1-1/+1
Recently, Wang Chen submitted a patch (d30f53aeb31d453a5230f526bea592af07944564) to move a call to netif_rx(skb) after a subsequent reference to skb, because netif_rx may call kfree_skb on its argument. The same problem occurs in some other drivers as well. This was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ expression skb, e,e1; @@ ( netif_rx(skb); | netif_rx_ni(skb); ) ... when != skb = e ( skb = e1 | * skb ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: David S. Miller <davem@davemloft.net>
2007-12-05no need to mess with KBUILD_CFLAGS on uml-i386 anymoreAl Viro1-5/+0
Now that X86_32 is provided on Kconfig level for uml-i386, there's no need to play with it explicitly on Makefile level anymore. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-12-03uml: work around host tcsetattr bugJeff Dike1-1/+10
Under the conditions that UML uses it, tcgetattr is guaranteed to return -EINTR when the console is attached to /dev/ptmx, making generic_console_write hang because it loops, calling tcgetattr until it succeeds. This is a host bug - see http://marc.info/?l=linux-kernel&m=119618990807182&w=2 for the details. This patch works around it by blocking SIGIO while the terminal attributes are being fiddled. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-12-03uml: after_sleep_interval should return somethingJeff Dike1-0/+1
I forgot to have an int-returning function actually return something. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-12-03uml: keep UML Kconfig in sync with x86Jeff Dike1-0/+7
Fix a UML build breakage introduced by commit 1032c0ba9da5c5b53173ad2dcf8b2a2da78f8b17 - it introduces X86_32, with many things which UML needs depending on it. This patch adds definitions of X86_32 and RWSEM_XCHGADD_ALGORITHM to the UML/i386 Kconfig. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-29leak in do_ubd_requestMiklos Szeredi1-0/+1
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-29uml: fix !NO_HZ busy-loopJeff Dike1-3/+51
With NO_HZ disabled, the UML idle loop effectively becomes a busy loop, as it will sleep for no time. The cause was forgetting to restart the tick after waking up from sleep. It was disabled before sleeping, and the remaining time used as the interval to sleep. So, the tick needs to be restarted when nanosleep finishes. This is done by introducing after_sleep_interval, which is empty in the NO_HZ case, but which sets the tick starting in the !NO_HZ case. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-29UML: build fixWANG Cong1-1/+1
include/asm-um/arch points to the non-existed include/asm-i386 directory. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Cc: Jeff Dike <jdike@karaya.com> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14uml: fix build for !CONFIG_PRINTKJeff Dike1-1/+12
Handle the case of CONFIG_PRINTK being disabled. This requires a do-nothing stub to be present in arch/um/include/user.h so that we don't get references to printk from libc code. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14uml: fix build for !CONFIG_TCPJeff Dike1-2/+12
Make UML build in the absence of CONFIG_INET by making the inetaddr_notifier registration depend on it. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14uml: remove last include of libc asm/page.hJeff Dike1-1/+0
asm/page.h is disappearing from the libc headers and we don't need it anyway. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14uml: fix spurious IRQ testingJeff Dike1-6/+7
The spurious IRQ testing in request_irq is mishandled in um_request_irq, which sets the incoming file descriptors non-blocking only after request_irq succeeds. This results in the spurious irq calling read on a blocking descriptor, and a hang. Fixed by reversing the O_NONBLOCK setting and the request_irq call. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14uml: fix recvmsg return value checkingJeff Dike1-2/+1
Stupid bug - we need to compare the return value of recvmsg to the value of iov_len, not its size. This caused port_helper processes not to be killed on shutdown on x86_64 because the pids weren't being passed out properly. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14uml: fix symlink loopsJeff Dike1-3/+3
symlinks to directories in the non-O= case were lacking -n, which meant that, when the link already existed, a new link pointing at itself was created in the target directory. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-06UML: fix defconfig build againJeff Dike1-2/+2
Reported by Al Viro. This fixes it: [AC]FLAGS -> KBUILD_[AC]FLAGS conversion in Makefile-i386. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Al Viro <viro@ftp.linux.org.uk> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-05uml: correctly strip kernel defines from userspace CFLAGSJeff Dike1-2/+5
KERNEL_DEFINES needs whitespace trimmed, otherwise the whitespace crunching done by make fools the patsubst which is used to remove KERNEL_DEFINES from USER_CFLAGS. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-05uml: fix incompatible types warning in previous SG fixWANG Cong1-1/+1
Fix an incompatible-pointer warning. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-29misc uml annotation and section fixesAl Viro3-7/+7
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-29more x86 merge fallout (uml, again)Al Viro2-2/+2
arch/i386/{Kconfig,Makefile}.cpu got moved Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-29x86 merge fallout: umlAl Viro2-6/+2
Don't undef __i386__/__x86_64__ in uml anymore, make sure that (few) places that required adjusting the ifdefs got those. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-24arch/um/drivers/ubd_kern.c: fix a building errorWANG Cong1-0/+2
Fix this uml building error: arch/um/drivers/ubd_kern.c: In function 'do_ubd_request': arch/um/drivers/ubd_kern.c:1118: error: implicit declaration of function 'sg_page' arch/um/drivers/ubd_kern.c:1118: warning: passing argument 6 of 'prepare_request' makes pointer from integer without a cast make[1]: *** [arch/um/drivers/ubd_kern.o] Error 1 make: *** [arch/um/drivers] Error 2 Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Add sg_init_table() call as well. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe1-1/+1
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-20typo fixesMatt LaPlante1-1/+1
Most of these fixes were already submitted for old kernel versions, and were approved, but for some reason they never made it into the releases. Because this is a consolidation of a couple old missed patches, it touches both Kconfigs and documentation texts. Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2007-10-20spelling fixes: arch/um/Simon Arlott9-10/+10
Spelling fixes in arch/um/. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2007-10-19Combine instrumentation menus in kernel/Kconfig.instrumentationMathieu Desnoyers1-0/+2
Quoting Randy: "It seems sad that this patch sources Kconfig.marker, a 7-line file, 20-something times. Yes, you (we) don't want to put those 7 lines into 20-something different files, so sourcing is the right thing. However, what you did for avr32 seems more on the right track to me: make _one_ Instrumentation support menu that includes PROFILING, OPROFILE, KPROBES, and MARKERS and then use (source) that in all of the arches." Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19Use helpers to obtain task pid in printks (arch code)Alexey Dobriyan1-2/+2
One of the easiest things to isolate is the pid printed in kernel log. There was a patch, that made this for arch-independent code, this one makes so for arch/xxx files. It took some time to cross-compile it, but hopefully these are all the printks in arch code. Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19pid namespaces: define is_global_init() and is_container_init()Serge E. Hallyn1-1/+1
is_init() is an ambiguous name for the pid==1 check. Split it into is_global_init() and is_container_init(). A cgroup init has it's tsk->pid == 1. A global init also has it's tsk->pid == 1 and it's active pid namespace is the init_pid_ns. But rather than check the active pid namespace, compare the task structure with 'init_pid_ns.child_reaper', which is initialized during boot to the /sbin/init process and never changes. Changelog: 2.6.22-rc4-mm2-pidns1: - Use 'init_pid_ns.child_reaper' to determine if a given task is the global init (/sbin/init) process. This would improve performance and remove dependence on the task_pid(). 2.6.21-mm2-pidns2: - [Sukadev Bhattiprolu] Changed is_container_init() calls in {powerpc, ppc,avr32}/traps.c for the _exception() call to is_global_init(). This way, we kill only the cgroup if the cgroup's init has a bug rather than force a kernel panic. [akpm@linux-foundation.org: fix comment] [sukadev@us.ibm.com: Use is_global_init() in arch/m32r/mm/fault.c] [bunk@stusta.de: kernel/pid.c: remove unused exports] [sukadev@us.ibm.com: Fix capability.c to work with threaded init] Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Acked-by: Pavel Emelianov <xemul@openvz.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Cedric Le Goater <clg@fr.ibm.com> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Herbert Poetzel <herbert@13thfloor.at> Cc: Kirill Korotaev <dev@sw.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-17[UMP]: header_ops conversion needed for non-ethernet driversJeff Dike2-6/+2
UML's two non-ethernet drivers need some header_ops conversion. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-17remove include/asm-*/ipc.hAdrian Bunk1-1/+1
All asm/ipc.h files do only #include <asm-generic/ipc.h>. This patch therefore removes all include/asm-*/ipc.h files and moves the contents of include/asm-generic/ipc.h to include/linux/ipc.h. Signed-off-by: Adrian Bunk <bunk@kernel.org> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuildLinus Torvalds6-17/+17
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (40 commits) kbuild: introduce ccflags-y, asflags-y and ldflags-y kbuild: enable 'make CPPFLAGS=...' to add additional options to CPP kbuild: enable use of AFLAGS and CFLAGS on commandline kbuild: enable 'make AFLAGS=...' to add additional options to AS kbuild: fix AFLAGS use in h8300 and m68knommu kbuild: check for wrong use of CFLAGS kbuild: enable 'make CFLAGS=...' to add additional options to CC kbuild: fix up CFLAGS usage kbuild: make modpost detect unterminated device id lists kbuild: call export_report from the Makefile kbuild: move Kai Germaschewski to CREDITS kconfig/menuconfig: distinguish between selected-by-another options and comments kconfig: tristate choices with mixed tristate and boolean values include/linux/Kbuild: remove duplicate entries kbuild: kill backward compatibility checks kbuild: kill EXTRA_ARFLAGS kbuild: fix documentation in makefiles.txt kbuild: call make once for all targets when O=.. is used kbuild: pass -g to assembler under CONFIG_DEBUG_INFO kbuild: update _shipped files for kconfig syntax cleanup ... Fix up conflicts in arch/um/sys-{x86_64,i386}/Makefile manually.
2007-10-16uml: definitively kill subprocesses on panicLepton Wu2-1/+39
In a stock 2.6.22.6 kernel, poweroff a user mode linux guest (2.6.22.6 running in skas0 mode) will halt the host linux. I think the reason is the kernel thread abort because of a bug. Then the sys_reboot in process of user mode linux guest is not trapped by the user mode linux kernel and is executed by host. I think it is better to make sure all of our children process to quit when user mode linux kernel abort. [ jdike - the kernel process needs to ignore SIGTERM, plus the waitpid/kill loop is needed to make sure that all of our children are dead before the kernel exits ] Signed-off-by: Lepton Wu <ytht.net@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: arch/um/drivers formattingJeff Dike9-253/+244
Style fixes for the rest of the drivers. arch/um/drivers should be pretty CodingStyle-compliant now. Except for the ubd driver, which will have to be treated separately. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: fix stub address calculationsJeff Dike18-77/+81
The calculation of CONFIG_STUB_CODE and CONFIG_STUB_DATA didn't take into account anything but 3G/1G and 2G/2G, leaving the other vmsplits out in the cold. I'd rather not duplicate the four known host vmsplit cases for each of these symbols. I'd also like to calculate them based on the highest userspace address. The Kconfig language seems not to allow calculation of hex constants, so I moved this to as-layout.h. CONFIG_STUB_CODE, CONFIG_STUB_DATA, and CONFIG_STUB_START are now gone. In their place are STUB_CODE, STUB_DATA, and STUB_START in as-layout.h. i386 and x86_64 seem to differ as to whether an unadorned constant is an int or a long, so I cast them to unsigned long so they can be printed consistently. However, they are also used in stub.S, where C types don't work so well. So, there are ASM_ versions of these constants for use in stub.S. I also ifdef-ed the non-asm-friendly portion of as-layout.h. With this in place, most of the rest of this patch is changing CONFIG_STUB_* to STUB_*, except in stub.S, where they are changed to ASM_STUB_*. defconfig has the old symbols deleted. I also print these addresses out in case there is any problem mapping them on the host. The two stub.S files had some trailing whitespace, so that is cleaned up here. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: correctly handle skb allocation failuresJeff Dike1-0/+47
Handle memory allocation failures when reading packets. We have to read something from the host, even if we can't allocate any memory. If we don't, the host side of the device may fill up and stop delivering interrupts because no new packets can be queued. A single sk_buff is allocated whenever an MTU is seen which is larger than any seen earlier. This is used to read packets if there is a memory allocation failure. The large MTU check is done from eth_configure, which is called when a interface is added to the system. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: network driver MTU cleanupsJeff Dike19-188/+80
A bunch of MTU-related cleanups in the network code. First, there is the addition of the notion of a maximally-sized packet, which is the MTU plus headers. This is used to size the skb that will receive a packet. This allows ether_adjust_skb to go away, as it was used to resize the skb after it was allocated. Since the skb passed into the low-level read routine is no longer resized, and possibly reallocated, there, they (and the write routines) don't need to get an sk_buff **. They just need the sk_buff * now. The callers of ether_adjust_skb still need to do the skb_put, so that's now inlined. The MAX_PACKET definitions in most of the drivers are gone. The set_mtu methods were all the same and did nothing, so they can be removed. The ethertap driver had a typo which doubled the size of the packet rather than adding two bytes to it. It also wasn't defining its setup_size, causing a zero-byte kmalloc and crash when the invalid pointer returned from kmalloc was dereferenced. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: network formattingJeff Dike22-616/+602
Style and other non-functional changes in the UML networking code, including include tidying style violations copyright updates printks getting severities userspace code calling libc directly rather than using the os_* wrappers There's also a exit path cleanup in the pcap driver. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: use *SEC_PER_*SEC constantsJeff Dike5-17/+22
There are various uses of powers of 1000, plus the odd BILLION constant in the time code. However, there are perfectly good definitions of *SEC_PER_*SEC in linux/time.h which can be used instaed. These are replaced directly in kernel code. Userspace code imports those constants as UM_*SEC_PER_*SEC and uses these. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: eliminate SIGALRMJeff Dike7-35/+17
Now that ITIMER_REAL is no longer used, there is no need for any use of SIGALRM whatsoever. This patch removes all mention of it. In addition, real_alarm_handler took a signal argument which is now always SIGVTALRM. So, that is gone. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: time build fixJeff Dike2-5/+21
Put back an implementation of timeval_to_ns in arch/um/os-Linux/time.c. tglx pointed out in his review of tickless support that there was a perfectly good implementation of it in linux/time.h. The problem is that this is userspace code which can't pull in kernel headers and there doesn't seem to be a libc version. So, I'm copying the version from linux/time.h rather than resurrecting my version. This causes some declaration changes as it now returns a signed value rather than an unsigned value. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: eliminate interrupts in the idle loopJeff Dike4-52/+17
Now, the idle loop now longer needs SIGALRM firing - it can just sleep for the requisite amount of time and fake a timer interrupt when it finishes. Any use of ITIMER_REAL now goes away. disable_timer only turns off ITIMER_VIRTUAL. switch_timers is no longer needed, so it, and all calls, goes away. disable_timer now returns the amount of time remaining on the timer. default_idle uses this to tell idle_sleep how long to sleep. idle_sleep will call alarm_handler if nanosleep returns 0, which is the case if it didn't return early due to an interrupt. Otherwise, it just returns. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: tickless supportJeff Dike7-55/+55
Enable tickless support. CONFIG_TICK_ONESHOT and CONFIG_NO_HZ are enabled. itimer_clockevent gets CLOCK_EVT_FEAT_ONESHOT and an implementation of .set_next_event. CONFIG_UML_REAL_TIME_CLOCK goes away because it only makes sense when there is a clock ticking away all the time. timer_handler now just calls do_IRQ once without trying to figure out how many ticks to emulate. The idle loop now needs to turn ticking on and off. Userspace ticks keep happening as usual. However, the userspace loop keep track of when the next wakeup should happen and suppresses process ticks until that happens. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: clocksource supportJeff Dike1-0/+20
Add clocksource support. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: GENERIC_CLOCKEVENTS supportJeff Dike4-57/+55
Enable CONFIG_GENERIC_CLOCKEVENTS. timer_irq gets its name changed to timer_handler, and becomes the recipient of timer signals. The clock_event_device is set up to imitate the current ticking clock, i.e. CLOCK_EVT_FEAT_ONESHOT is not enabled yet. disable_timer now doesn't ignore SIGALRM and SIGVTALRM because that breaks delay calibration. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: GENERIC_TIME supportJeff Dike3-43/+5
Enable CONFIG_GENERIC_TIME. As a side-effect of this, the UML implementations of do_gettimeofday and do_settimeofday go away, as these are provided by generic code. set_time also goes away since it was only used by do_settimeofday. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: separate timer initializationJeff Dike4-4/+13
Move timer signal initialization from init_irq_signals to a new function, timer_init. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: simplify interval settingJeff Dike4-6/+5
set_interval took a timer type as an argument, but it always specified a virtual timer. So, it is not needed, and it is gone, and set_interval is simplified appropriately. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: fix timer switchingJeff Dike4-21/+26
Fix up the switching between virtual and real timers. The idle loop sleeps, so the timer at that point must be real time. At all other times, the timer must be virtual. Even when userspace is running, and the kernel is asleep, the virtual timer is correct because the process timer will be running and the process timer will be firing. The timer switch used to be in the context switch and timer handler code. This is moved to the idle loop and the signal handler, making it much more clear why it is happening. switch_timers now returns the old timer type so that it may be restored. The signal handler uses this in order to restore the previous timer type when it returns. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16uml: eliminate hz()Jeff Dike5-12/+8
Eliminate hz() since its only purpose was to provide a kernel-space constant to userspace code. This can be done instead by providing the constant directly through kernel_constants.h. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>