diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-10-25 17:08:38 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-11-01 12:56:16 +0000 |
commit | a2ca269b38105a250cb1273290ccc6a4b200388d (patch) | |
tree | ca3e51ed334f04e6542eb966359815700c53f5e0 | |
parent | 9910716d014acc8477f1508bc0a1395d823c1a6f (diff) | |
download | src-a2ca269b38105a250cb1273290ccc6a4b200388d.tar.gz src-a2ca269b38105a250cb1273290ccc6a4b200388d.zip |
hyperv: Register hyperv_timecounter later during boot
Previously the MSR-based timecounter was registered during
SI_SUB_HYPERVISOR, i.e., very early during boot, and before SI_SUB_LOCK.
After commit 621fd9dcb2d8 this triggers a panic since the timecounter
list lock is not yet initialized.
The hyperv timecounter does not need to be registered so early, so defer
that to SI_SUB_DRIVERS, at the same time the hyperv TSC timecounter is
registered.
Reported by: whu
Approved by: whu
Fixes: 621fd9dcb2d8 ("timecounter: Lock the timecounter list")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9ef7df022a467776aa616b92fe5783e4261e84c6)
-rw-r--r-- | sys/dev/hyperv/vmbus/hyperv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c index 5bb38fde8241..2c413664cd07 100644 --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -247,6 +247,13 @@ hyperv_init(void *dummy __unused) /* 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 */ tc_init(&hyperv_timecounter); @@ -258,8 +265,7 @@ hyperv_init(void *dummy __unused) hyperv_tc64 = hyperv_tc64_rdmsr; } } -SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, - NULL); +SYSINIT(hyperv_tc_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, hyperv_tc_init, NULL); static void hypercall_memfree(void) |