Index: sys/i386/isa/clock.c =================================================================== --- sys/i386/isa/clock.c (revision 212725) +++ sys/i386/isa/clock.c (working copy) @@ -455,7 +455,16 @@ i8254_timecounter.tc_frequency = freq; mtx_lock_spin(&clock_lock); i8254_freq = freq; - if (using_lapic_timer != LAPIC_CLOCK_NONE) + + /* + * The lapic timer could not be available at very early boot stages. + * As long as i8254 is used for calibrating other timers (the most + * notably being TSC) in very early boot stages, avoid missing a + * counter rollover by forcing full 16 bits. + * If the lapic timer will not be available in the end, subsequent + * calls to set_i8254_freq() will recalibrate the count. + */ + if (cold != 0 || using_lapic_timer != LAPIC_CLOCK_NONE) new_i8254_real_max_count = 0x10000; else new_i8254_real_max_count = TIMER_DIV(intr_freq); Index: sys/amd64/isa/clock.c =================================================================== --- sys/amd64/isa/clock.c (revision 212725) +++ sys/amd64/isa/clock.c (working copy) @@ -426,7 +426,16 @@ i8254_timecounter.tc_frequency = freq; mtx_lock_spin(&clock_lock); i8254_freq = freq; - if (using_lapic_timer != LAPIC_CLOCK_NONE) + + /* + * The lapic timer could not be available at very early boot stages. + * As long as i8254 is used for calibrating other timers (the most + * notably being TSC) in very early boot stages, avoid missing a + * counter rollover by forcing full 16 bits. + * If the lapic timer will not be available in the end, subsequent + * calls to set_i8254_freq() will recalibrate the count. + */ + if (cold != 0 || using_lapic_timer != LAPIC_CLOCK_NONE) new_i8254_real_max_count = 0x10000; else new_i8254_real_max_count = TIMER_DIV(intr_freq);