linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: Nix <nix@esperi.org.uk>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] actually useful backtrace from a CPU-chewing hang
Date: Fri, 2 May 2008 12:30:20 -0400	[thread overview]
Message-ID: <20080502163020.GB7843@c2.user-mode-linux.org> (raw)
In-Reply-To: <87prs57g4h.fsf@hades.wkstn.nix>

On Fri, May 02, 2008 at 12:34:54AM +0100, Nix wrote:
> loki:/tmp# /usr/bin/ntpdate -bv hades
> 30 Apr 22:45:52 ntpdate[8833]: ntpdate 4.2.4p4@1.1520-o Fri Feb 22 18:37:11 UTC 2008 (1)
> 30 Apr 22:45:52 ntpdate[8833]: step time server 192.168.14.18 offset -5.728539 sec
> 
> so in effect yes :)
> 
> Hm. A five-second skip forwards via date --set works fine. A five-second
> skip *backwards*, and instant boom.

I tried both directions for the hell of it.

With your config, I'm seeing a hang until the system time catches up
to what UML thought it should have been in the first place.  But it's
only a few seconds, not forever.

However, stracing it did reveal a bogus interval trying to be set,
which the patch below fixes.  It doesn't cause any behavior change
here, so YMMV.

This includes the previous patch, which I think is a good idea anyway,
so back that out and drop this in its place.

			Jeff

Index: linux-2.6.22/arch/um/os-Linux/time.c
===================================================================
--- linux-2.6.22.orig/arch/um/os-Linux/time.c	2008-04-24 13:21:28.000000000 -0400
+++ linux-2.6.22/arch/um/os-Linux/time.c	2008-05-02 12:21:01.000000000 -0400
@@ -107,6 +107,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;
 
@@ -149,6 +153,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 });

-- 
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  reply	other threads:[~2008-05-02 16:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 19:59 [uml-devel] actually useful backtrace from a CPU-chewing hang Nix
2008-04-25 22:06 ` Nix
2008-04-26 18:31   ` Nix
2008-04-27 14:02     ` Nix
2008-04-28 16:44     ` Jeff Dike
2008-04-30 21:49       ` Nix
2008-05-01 15:13         ` Jeff Dike
2008-05-01 23:34           ` Nix
2008-05-02 16:30             ` Jeff Dike [this message]
2008-05-02 18:55               ` Nix
2008-05-02 19:57                 ` Jeff Dike
2008-05-02 23:21                   ` Nix
2008-05-03  0:56                     ` Jeff Dike
2008-05-03 10:08                       ` Nix
2008-05-09 15:16                         ` Jeff Dike
2008-05-09 17:13                           ` vincent-perrier
2008-05-09 20:32                             ` Nix
2008-05-14 17:23                             ` Jeff Dike
2008-05-14 18:03                               ` vincent-perrier
2008-05-14 18:18                               ` vincent-perrier
2008-05-14 18:29                               ` vincent-perrier
2008-05-14 19:39                                 ` Jeff Dike
2008-05-14 20:12                                   ` Nix
2008-05-14 20:31                                     ` Nix
2008-05-14 20:43                                     ` Jeff Dike
2008-05-14 22:02                                       ` Nix
2008-05-19 18:54                                 ` [uml-devel] plug_and_play_clownix_network vincent-perrier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080502163020.GB7843@c2.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=nix@esperi.org.uk \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).