git: 200d47320207 - stable/13 - hyperv: Register the MSR-based timecounter during SI_SUB_HYPERVISOR
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Nov 2021 13:46:24 UTC
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=200d4732020742eb17f51b6e1c553cfac878a559 commit 200d4732020742eb17f51b6e1c553cfac878a559 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-11-19 22:30:05 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-11-22 13:45:34 +0000 hyperv: Register the MSR-based timecounter during SI_SUB_HYPERVISOR This reverts commit 9ef7df022a46 ("hyperv: Register hyperv_timecounter later during boot") and adds a comment explaining why the timecounter needs to be registered as early as it is. PR: 259878 Fixes: 9ef7df022a46 ("hyperv: Register hyperv_timecounter later during boot") Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit ed6a9452be01c1b7805d0a7311211b8cf381a9dd) --- sys/dev/hyperv/vmbus/hyperv.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c index 2c413664cd07..01e0ad9610d9 100644 --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -247,15 +247,12 @@ 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 */ + /* + * 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_tc_init(void *arg __unused) 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)