[uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
Protection against the host's time going backwards - keep track of the time at the last tick and if it's greater than the current time, keep time stopped until the host catches up. Cc: Nix <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/os-Linux/time.c |7 +++ 1 file changed, 7 insertions(+) Index: linux-2.6-git/arch/um/os-Linux/time.c === --- linux-2.6-git.orig/arch/um/os-Linux/time.c 2008-05-14 10:44:02.0 -0400 +++ linux-2.6-git/arch/um/os-Linux/time.c 2008-06-02 15:43:53.0 -0400 @@ -106,6 +106,10 @@ static void deliver_alarm(void) unsigned long long this_tick = os_nsecs(); int one_tick = UM_NSEC_PER_SEC / UM_HZ; + /* Protection against the host's time going backwards */ + if ((last_tick != 0) && (this_tick < last_tick)) + this_tick = last_tick; + if (last_tick == 0) last_tick = this_tick - one_tick; @@ -148,6 +152,9 @@ static int after_sleep_interval(struct t start_usecs = usec; start_usecs -= skew / UM_NSEC_PER_USEC; + if (start_usecs < 0) + start_usecs = 0; + tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, .tv_usec = start_usecs % UM_USEC_PER_SEC }); interval = ((struct itimerval) { { 0, usec }, tv }); - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
[uml-devel] [PATCH 2/6] UML - Remove a duplicate include
From: Huang Weiyi <[EMAIL PROTECTED]> Removed duplicated include file "kern_util.h" in arch/um/drivers/ubd_kern.c. Signed-off-by: Huang Weiyi <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/drivers/ubd_kern.c |1 - 1 file changed, 1 deletion(-) Index: linux-2.6.22/arch/um/drivers/ubd_kern.c === --- linux-2.6.22.orig/arch/um/drivers/ubd_kern.c2008-04-24 13:22:04.0 -0400 +++ linux-2.6.22/arch/um/drivers/ubd_kern.c 2008-05-09 11:12:09.0 -0400 @@ -49,7 +49,6 @@ #include "irq_user.h" #include "irq_kern.h" #include "ubd_user.h" -#include "kern_util.h" #include "os.h" #include "mem.h" #include "mem_kern.h" - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
[uml-devel] [PATCH 3/6] UML - Deal with inaccessible address space start
From: Tom Spink <[EMAIL PROTECTED]> This patch makes os_get_task_size locate the bottom of the address space, as well as the top. This is for systems which put a lower limit on mmap addresses. It works by manually scanning pages from zero onwards until a valid page is found. Because the bottom of the address space may not be zero, it's not sufficient to assume the top of the address space is the size of the address space. The size is the difference between the top address and bottom address. [ [EMAIL PROTECTED] - Changed the name to reflect that this function is supposed to return the top of the process address space, not its size and changed the return value to reflect that. Also some minor formatting changes ] Signed-off-by: Tom Spink <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/include/os.h|2 - arch/um/kernel/um_arch.c|2 - arch/um/os-Linux/sys-i386/task_size.c | 36 arch/um/os-Linux/sys-x86_64/task_size.c |2 - 4 files changed, 31 insertions(+), 11 deletions(-) Index: linux-2.6-git/arch/um/include/os.h === --- linux-2.6-git.orig/arch/um/include/os.h 2008-05-14 10:44:02.0 -0400 +++ linux-2.6-git/arch/um/include/os.h 2008-06-02 15:44:47.0 -0400 @@ -299,6 +299,6 @@ extern int os_arch_prctl(int pid, int co extern int get_pty(void); /* sys-$ARCH/task_size.c */ -extern unsigned long os_get_task_size(void); +extern unsigned long os_get_top_address(void); #endif Index: linux-2.6-git/arch/um/kernel/um_arch.c === --- linux-2.6-git.orig/arch/um/kernel/um_arch.c 2008-05-14 10:44:02.0 -0400 +++ linux-2.6-git/arch/um/kernel/um_arch.c 2008-06-02 15:44:47.0 -0400 @@ -274,7 +274,7 @@ int __init linux_main(int argc, char **a if (have_root == 0) add_arg(DEFAULT_COMMAND_LINE); - host_task_size = os_get_task_size(); + host_task_size = os_get_top_address(); /* * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps * out Index: linux-2.6-git/arch/um/os-Linux/sys-i386/task_size.c === --- linux-2.6-git.orig/arch/um/os-Linux/sys-i386/task_size.c2008-05-14 10:44:02.0 -0400 +++ linux-2.6-git/arch/um/os-Linux/sys-i386/task_size.c 2008-06-02 15:48:10.0 -0400 @@ -63,7 +63,7 @@ static int page_ok(unsigned long page) return ok; } -unsigned long os_get_task_size(void) +unsigned long os_get_top_address(void) { struct sigaction sa, old; unsigned long bottom = 0; @@ -76,9 +76,9 @@ unsigned long os_get_task_size(void) * hosts, but shouldn't hurt otherwise. */ unsigned long top = 0xd000 >> UM_KERN_PAGE_SHIFT; - unsigned long test; + unsigned long test, original; - printf("Locating the top of the address space ... "); + printf("Locating the bottom of the address space ... "); fflush(stdout); /* @@ -89,16 +89,31 @@ unsigned long os_get_task_size(void) sigemptyset(&sa.sa_mask); sa.sa_flags = SA_NODEFER; if (sigaction(SIGSEGV, &sa, &old)) { - perror("os_get_task_size"); + perror("os_get_top_address"); exit(1); } - if (!page_ok(bottom)) { - fprintf(stderr, "Address 0x%x no good?\n", - bottom << UM_KERN_PAGE_SHIFT); + /* Manually scan the address space, bottom-up, until we find +* the first valid page (or run out of them). +*/ + for (bottom = 0; bottom < top; bottom++) { + if (page_ok(bottom)) + break; + } + + /* If we've got this far, we ran out of pages. */ + if (bottom == top) { + fprintf(stderr, "Unable to determine bottom of address " + "space.\n"); exit(1); } + printf("0x%x\n", bottom << UM_KERN_PAGE_SHIFT); + printf("Locating the top of the address space ... "); + fflush(stdout); + + original = bottom; + /* This could happen with a 4G/4G split */ if (page_ok(top)) goto out; @@ -114,7 +129,7 @@ unsigned long os_get_task_size(void) out: /* Restore the old SIGSEGV handling */ if (sigaction(SIGSEGV, &old, NULL)) { - perror("os_get_task_size"); + perror("os_get_top_address"); exit(1); } top <<= UM_KERN_PAGE_SHIFT; Index: linux-2.6-git/arch/um/os-Linux/sys-x86_64/task_size.c === --- linux-2.6-git.orig/arch/um/os-Linux/sys-x86_64/task_size.c 2008-04-28 13:05:21.0 -0400 +++ linux-2.6-git/arch/um/os-Linux/sys-x86_64/task_size
[uml-devel] [PATCH 6/6] UML - PATH_MAX needs limits.h
From: Ingo Molnar <[EMAIL PROTECTED]> Include limits.h to get a definition of PATH_MAX. Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/os-Linux/helper.c |1 + 1 file changed, 1 insertion(+) Index: linux-2.6-git/arch/um/os-Linux/helper.c === --- linux-2.6-git.orig/arch/um/os-Linux/helper.c2008-05-14 10:44:02.0 -0400 +++ linux-2.6-git/arch/um/os-Linux/helper.c 2008-06-02 15:50:10.0 -0400 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include "kern_constants.h" - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
[uml-devel] [PATCH 4/6] UML - memcpy export needs to follow host declaration
x86_64 defines either memcpy or __memcpy depending on the gcc version, and it looks like UML needs to follow that in its exporting. Cc: Gabriel C <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/sys-x86_64/ksyms.c |4 1 file changed, 4 insertions(+) Index: linux-2.6-git/arch/um/sys-x86_64/ksyms.c === --- linux-2.6-git.orig/arch/um/sys-x86_64/ksyms.c 2008-05-28 12:32:34.0 -0400 +++ linux-2.6-git/arch/um/sys-x86_64/ksyms.c2008-06-02 15:49:43.0 -0400 @@ -3,5 +3,9 @@ #include /*XXX: we need them because they would be exported by x86_64 */ +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 +EXPORT_SYMBOL(memcpy); +#else EXPORT_SYMBOL(__memcpy); +#endif EXPORT_SYMBOL(csum_partial); - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
[uml-devel] [PATCH 5/6] UML - stub needs to tolerate SIGWINCH
We lost the marking of SIGWINCH as being OK to receive during stub execution, causing a panic should that happen. Cc: Benedict Verheyen <[EMAIL PROTECTED]> Signed-off-by: Jeff Dike <[EMAIL PROTECTED]> --- arch/um/os-Linux/skas/process.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.22/arch/um/os-Linux/skas/process.c === --- linux-2.6.22.orig/arch/um/os-Linux/skas/process.c 2008-04-14 10:44:33.0 -0400 +++ linux-2.6.22/arch/um/os-Linux/skas/process.c2008-05-13 11:37:35.0 -0400 @@ -55,7 +55,7 @@ static int ptrace_dump_regs(int pid) * Signals that are OK to receive in the stub - we'll just continue it. * SIGWINCH will happen when UML is inside a detached screen. */ -#define STUB_SIG_MASK (1 << SIGVTALRM) +#define STUB_SIG_MASK ((1 << SIGVTALRM) | (1 << SIGWINCH)) /* Signals that the stub will finish with - anything else is an error */ #define STUB_DONE_MASK (1 << SIGTRAP) - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
[uml-devel] [PATCH 0/6] UML - A batch for 2.6.26
These are either important bug fixes, or non-risky cleanups, and should go to 2.6.26. Jeff -- Work email - jdike at linux dot intel dot com - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tue, 3 Jun 2008 15:02:35 -0400 Jeff Dike <[EMAIL PROTECTED]> wrote: > Protection against the host's time going backwards - keep track of the > time at the last tick and if it's greater than the current time, keep > time stopped until the host catches up. Strange. What would cause the host's time (or at least UML's perception of it) to go backwards? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On 3 Jun 2008, Daniel Hazelton said: > On Tuesday 03 June 2008 03:32:11 pm Andrew Morton wrote: >> On Tue, 3 Jun 2008 15:02:35 -0400 >> >> Jeff Dike <[EMAIL PROTECTED]> wrote: >> > Protection against the host's time going backwards - keep track of the >> > time at the last tick and if it's greater than the current time, keep >> > time stopped until the host catches up. >> >> Strange. What would cause the host's time (or at least UML's perception >> of it) to go backwards? > > A wild guess would be that the UML process is running "fast" at some point > and > its expectation of the host's time is skewed forward because of that. Quite so. Simply running ntp on the host (in slew-only mode, no less!) can cause this. > Another possibility is that the hosts clock got reset between the times UML > has checked it and the correction was a negative one. That too. -- `If you are having a "ua luea luea le ua le" kind of day, I can only assume that you are doing no work due [to] incapacitating nausea caused by numerous lazy demons.' --- Frossie - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
>> Protection against the host's time going backwards - keep track of the >> time at the last tick and if it's greater than the current time, keep >> time stopped until the host catches up. > >Strange. What would cause the host's time (or at least UML's perception >of it) to go backwards? mhh - what about admin`s/user`s stupidity ? e.g. 0 * * * * root /usr/sbin/ntpdate some.time.server >/dev/null 2>&1 in root`s crontab. if the hosts`s clock is running faster than clock on some.time.server, this would set host`s clock back in time every hour or so common malpractice regarding time-syncronization - have seen that more than once. (and have to admit that i used that some years ago before i wasn`t aware that ntpd does handle that more intelligent) ___ EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/[EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tue, 03 Jun 2008 20:52:18 +0100 Nix <[EMAIL PROTECTED]> wrote: > On 3 Jun 2008, Daniel Hazelton said: > > > On Tuesday 03 June 2008 03:32:11 pm Andrew Morton wrote: > >> On Tue, 3 Jun 2008 15:02:35 -0400 > >> > >> Jeff Dike <[EMAIL PROTECTED]> wrote: > >> > Protection against the host's time going backwards - keep track of the > >> > time at the last tick and if it's greater than the current time, keep > >> > time stopped until the host catches up. > >> > >> Strange. What would cause the host's time (or at least UML's perception > >> of it) to go backwards? > > > > A wild guess would be that the UML process is running "fast" at some point > > and > > its expectation of the host's time is skewed forward because of that. > > Quite so. Simply running ntp on the host (in slew-only mode, no less!) > can cause this. > > > Another possibility is that the hosts clock got reset between the times UML > > has checked it and the correction was a negative one. > > That too. > So if I change the host's time by an hour, the time will not advance at all on the guest for the next hour? Sounds suboptimal :) I suppose the guest should be running an ntp client synced to something sane anyway? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tue, Jun 03, 2008 at 01:07:09PM -0700, Andrew Morton wrote: > So if I change the host's time by an hour, the time will not advance at all > on the guest for the next hour? Sounds suboptimal :) It is, but if the host is whacked, the guest just has to do the best that it can... Jeff -- Work email - jdike at linux dot intel dot com - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tuesday 03 June 2008 03:32:11 pm Andrew Morton wrote: > On Tue, 3 Jun 2008 15:02:35 -0400 > > Jeff Dike <[EMAIL PROTECTED]> wrote: > > Protection against the host's time going backwards - keep track of the > > time at the last tick and if it's greater than the current time, keep > > time stopped until the host catches up. > > Strange. What would cause the host's time (or at least UML's perception > of it) to go backwards? A wild guess would be that the UML process is running "fast" at some point and its expectation of the host's time is skewed forward because of that. Another possibility is that the hosts clock got reset between the times UML has checked it and the correction was a negative one. DRH -- Dialup is like pissing through a pipette. Slow and excruciatingly painful. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tuesday 03 June 2008 04:07:09 pm Andrew Morton wrote: > On Tue, 03 Jun 2008 20:52:18 +0100 > > Nix <[EMAIL PROTECTED]> wrote: > > On 3 Jun 2008, Daniel Hazelton said: > > > On Tuesday 03 June 2008 03:32:11 pm Andrew Morton wrote: > > >> On Tue, 3 Jun 2008 15:02:35 -0400 > > >> > > >> Jeff Dike <[EMAIL PROTECTED]> wrote: > > >> > Protection against the host's time going backwards - keep track of > > >> > the time at the last tick and if it's greater than the current time, > > >> > keep time stopped until the host catches up. > > >> > > >> Strange. What would cause the host's time (or at least UML's > > >> perception of it) to go backwards? > > > > > > A wild guess would be that the UML process is running "fast" at some > > > point and its expectation of the host's time is skewed forward because > > > of that. > > > > Quite so. Simply running ntp on the host (in slew-only mode, no less!) > > can cause this. > > > > > Another possibility is that the hosts clock got reset between the times > > > UML has checked it and the correction was a negative one. > > > > That too. > > So if I change the host's time by an hour, the time will not advance at all > on the guest for the next hour? Sounds suboptimal :) I agree. But like I said originally - it's a wild guess. I don't even know how accurate it is. > I suppose the guest should be running an ntp client synced to something > sane anyway? That might be helpful :) DRH -- Dialup is like pissing through a pipette. Slow and excruciatingly painful. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tue, Jun 03, 2008 at 06:50:49PM -0700, Eric W. Biederman wrote: > Could using a CLOCK_MONOTONIC time source fix this? Those timers do not > change when we change the time on the host. Hmmm, maybe. The man page looks promising... Jeff -- Work email - jdike at linux dot intel dot com - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
Jeff Dike <[EMAIL PROTECTED]> writes: > On Tue, Jun 03, 2008 at 01:07:09PM -0700, Andrew Morton wrote: >> So if I change the host's time by an hour, the time will not advance at all >> on the guest for the next hour? Sounds suboptimal :) > > It is, but if the host is whacked, the guest just has to do the best that > it can... Could using a CLOCK_MONOTONIC time source fix this? Those timers do not change when we change the time on the host. Eric - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards
On Tuesday 03 June 2008 09:50:49 pm Eric W. Biederman wrote: > Jeff Dike <[EMAIL PROTECTED]> writes: > > On Tue, Jun 03, 2008 at 01:07:09PM -0700, Andrew Morton wrote: > >> So if I change the host's time by an hour, the time will not advance at > >> all on the guest for the next hour? Sounds suboptimal :) > > > > It is, but if the host is whacked, the guest just has to do the best that > > it can... > > Could using a CLOCK_MONOTONIC time source fix this? Those timers do not > change when we change the time on the host. > > Eric I'm not all that familiar with the specifics of the code - my original statements about possible causes were barely more than wild guesses - but this does sound like it would work. DRH -- Dialup is like pissing through a pipette. Slow and excruciatingly painful. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel