Project

General

Profile

Actions

Bug #14569

closed

bhyve should consolidate on hrtime

Added by Patrick Mooney 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
bhyve
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The in-kernel emulation in bhyve largely uses two types from FreeBSD, struct bintime and sbintime_t, for representing time. In order to better integrate with the rest of the system, and to make it easier for developers to reason about time (without having to reference the FreeBSD docs and our compatibility shims), it would be nice if all of the time logic was updated to use hrtime_t instead.


Related issues

Related to illumos gate - Bug #14486: bhyve needs instruction emul testsClosedPatrick Mooney

Actions
Actions #1

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 2073
Actions #2

Updated by Patrick Mooney 5 months ago

To test, I booted and ran the normal battery of guests on both Intel and AMD hardware. After the update, CentOS guests in particular had much better calibrations for the TSC (went from ~750ppm error to ~20-50ppm in chrony), likely due to the vpmtmr math which was fixed by the patch.

The newly added tests also passed on both AMD and Intel:

root@carbide:~# /opt/bhyve-tests/bin/bhyvetest
Test: /opt/bhyve-tests/tests/mevent/vnode_zvol (run as root)      [00:02] [PASS]
Test: /opt/bhyve-tests/tests/kdev/vatpit_freq (run as root)       [00:00] [PASS]
Test: /opt/bhyve-tests/tests/kdev/vhpet_freq (run as root)        [00:00] [PASS]
Test: /opt/bhyve-tests/tests/kdev/vlapic_freq (run as root)       [00:00] [PASS]
Test: /opt/bhyve-tests/tests/kdev/vlapic_freq_periodic (run as root) [00:00] [PASS]
Test: /opt/bhyve-tests/tests/kdev/vpmtmr_freq (run as root)       [00:00] [PASS]
Test: /opt/bhyve-tests/tests/mevent/lists_delete (run as root)    [00:00] [PASS]
Test: /opt/bhyve-tests/tests/mevent/read_disable (run as root)    [00:00] [PASS]
Test: /opt/bhyve-tests/tests/mevent/read_pause (run as root)      [00:00] [PASS]
Test: /opt/bhyve-tests/tests/mevent/read_requeue (run as root)    [00:00] [PASS]
Test: /opt/bhyve-tests/tests/mevent/vnode_file (run as root)      [00:09] [PASS]
Test: /opt/bhyve-tests/tests/vmm/fpu_getset (run as root)         [00:00] [PASS]
Test: /opt/bhyve-tests/tests/vmm/mem_devmem (run as root)         [00:00] [PASS]
Test: /opt/bhyve-tests/tests/vmm/mem_partial (run as root)        [00:00] [PASS]
Test: /opt/bhyve-tests/tests/vmm/mem_seg_map (run as root)        [00:00] [PASS]

Results Summary
PASS      15

Running Time:   00:00:13
Percent passed: 100.0%

Actions #3

Updated by Patrick Mooney 5 months ago

  • Related to Bug #14486: bhyve needs instruction emul tests added
Actions #4

Updated by Electric Monk 5 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 5103e761e384621c5728a6d1f4b0bfdc1be233a4

commit  5103e761e384621c5728a6d1f4b0bfdc1be233a4
Author: Patrick Mooney <pmooney@pfmooney.com>
Date:   2022-03-30T15:50:42.000Z

    14569 bhyve should consolidate on hrtime
    14486 bhyve needs instruction emul tests
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: Luqman Aden <luqman@oxide.computer>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF