Page MenuHomeFreeBSD

bhyve could be more precise with vPIT
ClosedPublic

Authored by pmooney_pfmooney.com on May 21 2019, 5:37 PM.
Tags
Referenced Files
Unknown Object (File)
Apr 5 2024, 5:24 PM
Unknown Object (File)
Mar 29 2024, 11:08 PM
Unknown Object (File)
Mar 28 2024, 4:51 PM
Unknown Object (File)
Feb 21 2024, 8:36 PM
Unknown Object (File)
Dec 12 2023, 9:48 PM
Unknown Object (File)
Oct 31 2023, 10:10 AM
Unknown Object (File)
Oct 11 2023, 8:33 PM
Unknown Object (File)
Sep 10 2023, 2:17 PM

Details

Summary

As part of an investigation into NTP time synchronization issues under bhyve, we found that use of sbintime_t over struct bintime for the vPIT emulation resulted in an unnecessary loss of precision that negatively impacted consumers' ability to use it as an accurate time reference. Ignoring timer/callout implementation details, the lack of precision itself was causing a 59ppm error, a not-so-insignificant fraction of the 500ppm divergence budget which some NTP implementations possess.

The full write-up can be found in OS-6923

Test Plan

During development of the change, APIC timer debugging information from a Linux guest (compare against the expected 838860 ticks) was used to judge performance of the emulated PIT.

Stock:

838753 - 107    (128 ppm)
838776 - 84     (100 ppm)
838774 - 86     (103 ppm)
838706 - 154    (184 ppm)
838768 - 92     (110 ppm)
838769 - 91     (108 ppm)

Patched:

838922 - 62     (74 ppm)
838903 - 43     (51 ppm)
838908 - 48     (57 ppm)
838906 - 46     (55 ppm)
838905 - 45     (54 ppm)
838907 - 47     (56 ppm)

This change has been in SmartOS bhyve for almost a year.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Any more little gold mines like this sitting around?

sys/amd64/vmm/io/vatpit.c
187 ↗(On Diff #57640)

These 2 declarations should migrate up to the start of this function, as they are not const so the exception used in prior changes do not apply here, though we should probably go fix style(9) and not this. Final call is jhb@'s if this needs fixed.

This revision is now accepted and ready to land.Jul 17 2019, 8:49 PM
This revision was automatically updated to reflect the committed changes.