From ae3d035140a4c07f28531d5049f22755dad0d55d Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 29 Oct 2017 20:50:03 +0000 Subject: [PATCH] Improve the performance of the hpet timer in bhyve guests by making the timer frequency a power of two. This changes the frequency from 10 to 16.7 MHz (2 ^ 24 HZ). Using a power of two avoids roundoff errors when doing arithmetic in sbintime_t units. Testing shows this can fix erratic ntpd behavior in guests using the hpet timer (which is the default for multicore guests). Reported by: bsam@ --- sys/amd64/vmm/io/vhpet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/vmm/io/vhpet.c b/sys/amd64/vmm/io/vhpet.c index 6d9b0fe0a087..b11095f72c4a 100644 --- a/sys/amd64/vmm/io/vhpet.c +++ b/sys/amd64/vmm/io/vhpet.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_VHPET, "vhpet", "bhyve virtual hpet"); -#define HPET_FREQ 10000000 /* 10.0 Mhz */ +#define HPET_FREQ 16777216 /* 16.7 (2^24) Mhz */ #define FS_PER_S 1000000000000000ul /* Timer N Configuration and Capabilities Register */