From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753758Ab1BJIuG (ORCPT ); Thu, 10 Feb 2011 03:50:06 -0500 Received: from vpn.id2.novell.com ([195.33.99.129]:35557 "EHLO vpn.id2.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757Ab1BJIuE convert rfc822-to-8bit (ORCPT ); Thu, 10 Feb 2011 03:50:04 -0500 Message-Id: <4D53B4F10200007800031323@vpn.id2.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Thu, 10 Feb 2011 08:50:41 +0000 From: "Jan Beulich" To: , "Linus Torvalds" Cc: "Tim Deegan" , "Jeremy Fitzhardinge" , , "Jiri Slaby" , Subject: [PATCH] fix jiffy calculations in calibrate_delay_direct to handle overflow Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tim Deegan 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 [jbeulich@novell.com: !time_after() -> time_before_eq() as suggested by Jiri Slaby] Signed-off-by: Jan Beulich Cc: Jiri Slaby Cc: Jeremy Fitzhardinge 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); }