Skip to content

Commit 08007f3

Browse files
Tim DeeganKali-
Tim Deegan
authored andcommitted
fix jiffy calculations in calibrate_delay_direct to handle overflow
commit 70a062286b9dfcbd24d2e11601aecfead5cf709a upstream. 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 <[email protected]> Signed-off-by: Andi Kleen <[email protected]> [[email protected]: !time_after() -> time_before_eq() as suggested by Jiri Slaby] Signed-off-by: Jan Beulich <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Jeremy Fitzhardinge <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5b3d222 commit 08007f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

init/calibrate.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ static unsigned long __cpuinit calibrate_delay_direct(void)
6666
pre_start = 0;
6767
read_current_timer(&start);
6868
start_jiffies = jiffies;
69-
while (jiffies <= (start_jiffies + 1)) {
69+
while (time_before_eq(jiffies, start_jiffies + 1)) {
7070
pre_start = start;
7171
read_current_timer(&start);
7272
}
7373
read_current_timer(&post_start);
7474

7575
pre_end = 0;
7676
end = post_start;
77-
while (jiffies <=
78-
(start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) {
77+
while (time_before_eq(jiffies, start_jiffies + 1 +
78+
DELAY_CALIBRATION_TICKS)) {
7979
pre_end = end;
8080
read_current_timer(&end);
8181
}

0 commit comments

Comments
 (0)