Skip to content

Commit 643d83f

Browse files
committed
x86/hpet: Undo the early counter is counting check
Rui reported that on a Pentium D machine which has HPET forced enabled because it is not advertised by ACPI, the early counter is counting check leads to a silent boot hang. The reason is that the ordering of checking the counter first and then reconfiguring the HPET fails to work on that machine. As the HPET is not advertised and presumably not initialized by the BIOS the early enable and the following reconfiguration seems to bring it into a broken state. Adding clocksource=jiffies to the command line results in the following clocksource watchdog warning: clocksource: timekeeping watchdog on CPU1: Marking clocksource 'tsc-early' as unstable because the skew is too large: clocksource: 'hpet' wd_now: 33 wd_last: 33 mask: ffffffff That clearly shows that the HPET is not counting after it got reconfigured and reenabled. If the counter is not working then the HPET timer is not expiring either, which explains the boot hang. Move the counter is counting check after the full configuration again to unbreak these systems. Reported-by: Rui Salvaterra <[email protected]> Fixes: 3222daf ("x86/hpet: Separate counter check out of clocksource register code") Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Rui Salvaterra <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent b8f7095 commit 643d83f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

arch/x86/kernel/hpet.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,6 @@ int __init hpet_enable(void)
827827
if (!hpet_cfg_working())
828828
goto out_nohpet;
829829

830-
/* Validate that the counter is counting */
831-
if (!hpet_counting())
832-
goto out_nohpet;
833-
834830
/*
835831
* Read the period and check for a sane value:
836832
*/
@@ -896,6 +892,14 @@ int __init hpet_enable(void)
896892
}
897893
hpet_print_config();
898894

895+
/*
896+
* Validate that the counter is counting. This needs to be done
897+
* after sanitizing the config registers to properly deal with
898+
* force enabled HPETs.
899+
*/
900+
if (!hpet_counting())
901+
goto out_nohpet;
902+
899903
clocksource_register_hz(&clocksource_hpet, (u32)hpet_freq);
900904

901905
if (id & HPET_ID_LEGSUP) {

0 commit comments

Comments
 (0)