All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Jan Beulich <JBeulich@novell.com>
Cc: akpm@linux-foundation.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Tim Deegan <Tim.Deegan@citrix.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix jiffy calculations in calibrate_delay_direct to	 handle overflow
Date: Wed, 09 Feb 2011 10:21:44 +0100	[thread overview]
Message-ID: <4D525CA8.60604@suse.cz> (raw)
In-Reply-To: <4D525EF00200007800030F0F@vpn.id2.novell.com>

On 02/09/2011 09:31 AM, Jan Beulich wrote:
> Fixes a hang when booting as dom0 under Xen, when jiffies can be
> quite large by the time the kernel init gets this far.

As I wrote this might happen if the boot till this point takes ~ 5
minutes because we start at -5 minutes.

That said, is this a candidate for stable? (If so, please CC stable.)

> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
> 
> !time_after() -> time_before_eq() as per suggestion from Jiri Slaby.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: Jiri Slaby <jslaby@suse.cz>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> 
> ---
>  init/calibrate.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> --- 2.6.38-rc4/init/calibrate.c
> +++ 2.6.38-rc4-calibrate-jiffy-overflow/init/calibrate.c
> @@ -66,7 +66,7 @@ static unsigned long __cpuinit calibrate
>  		pre_start = 0;
>  		read_current_timer(&start);
>  		start_jiffies = jiffies;
> -		while (jiffies <= (start_jiffies + 1)) {
> +		while (time_before_eq(jiffies, start_jiffies + 1)) {
>  			pre_start = start;
>  			read_current_timer(&start);
>  		}
> @@ -74,8 +74,8 @@ static unsigned long __cpuinit calibrate
>  
>  		pre_end = 0;
>  		end = post_start;
> -		while (jiffies <=
> -		       (start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) {
> +		while (time_before_eq(jiffies, start_jiffies + 1 +
> +					       DELAY_CALIBRATION_TICKS)) {
>  			pre_end = end;
>  			read_current_timer(&end);
>  		}

thanks,
-- 
js
suse labs

  reply	other threads:[~2011-02-09  9:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09  8:31 [PATCH] fix jiffy calculations in calibrate_delay_direct to handle overflow Jan Beulich
2011-02-09  9:21 ` Jiri Slaby [this message]
2011-02-09  9:44   ` Jan Beulich
2011-02-09  9:53     ` Jiri Slaby
2011-02-09 13:18       ` Jan Beulich
2011-02-09 18:48         ` Jeremy Fitzhardinge
2011-02-09 20:54 ` Linus Torvalds
2011-02-10  8:48   ` Jan Beulich
2011-02-10  8:50 Jan Beulich

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=4D525CA8.60604@suse.cz \
    --to=jslaby@suse.cz \
    --cc=JBeulich@novell.com \
    --cc=Tim.Deegan@citrix.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.