mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: <akpm@linux-foundation.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Cc: "Tim Deegan" <Tim.Deegan@citrix.com>,
	"Jeremy Fitzhardinge" <jeremy@goop.org>, <stable@kernel.org>,
	"Jiri Slaby" <jslaby@suse.cz>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix jiffy calculations in calibrate_delay_direct to handle overflow
Date: Thu, 10 Feb 2011 08:50:41 +0000	[thread overview]
Message-ID: <4D53B4F10200007800031323@vpn.id2.novell.com> (raw)

From: Tim Deegan <Tim.Deegan@citrix.com>

Fixes a hang when booting as dom0 under Xen, when jiffies can be
quite large by the time the kernel init gets this far.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
[jbeulich@novell.com: !time_after() -> time_before_eq() as suggested by Jiri Slaby]
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: stable@kernel.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);
 		}




             reply	other threads:[~2011-02-10  8:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10  8:50 Jan Beulich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-02-09  8:31 Jan Beulich
2011-02-09  9:21 ` Jiri Slaby
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

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=4D53B4F10200007800031323@vpn.id2.novell.com \
    --to=jbeulich@novell.com \
    --cc=Tim.Deegan@citrix.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeremy@goop.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®