Index: sys/dev/hyperv/vmbus/hyperv.c =================================================================== --- sys/dev/hyperv/vmbus/hyperv.c +++ sys/dev/hyperv/vmbus/hyperv.c @@ -247,15 +247,12 @@ /* Set guest id */ wrmsr(MSR_HV_GUEST_OS_ID, MSR_HV_GUESTID_FREEBSD); -} -SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, - NULL); - -static void -hyperv_tc_init(void *arg __unused) -{ if (hyperv_features & CPUID_HV_MSR_TIME_REFCNT) { - /* Register Hyper-V timecounter */ + /* + * Register Hyper-V timecounter. This should be done as early + * as possible to let DELAY() work, since the 8254 PIT is not + * reliably emulated or even available. + */ tc_init(&hyperv_timecounter); /* @@ -265,7 +262,8 @@ hyperv_tc64 = hyperv_tc64_rdmsr; } } -SYSINIT(hyperv_tc_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, hyperv_tc_init, NULL); +SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, + NULL); static void hypercall_memfree(void) Index: sys/kern/kern_tc.c =================================================================== --- sys/kern/kern_tc.c +++ sys/kern/kern_tc.c @@ -99,7 +99,6 @@ /* Mutex to protect the timecounter list. */ static struct mtx tc_lock; -MTX_SYSINIT(tc_lock, &tc_lock, "tc", MTX_DEF); int tc_min_ticktock_freq = 1; @@ -1989,6 +1988,8 @@ TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable, sizeof(tc_from_tunable)); + + mtx_init(&tc_lock, "tc", NULL, MTX_DEF); } SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);