Feature #13825


consolidate vm-related headers for bhyve

Added by Dan Cross about 1 month ago. Updated 19 days ago.

Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


When bhyve was ported to illumos, care was taken to maintain compatibility headers in order to minimize source changes from upstream. As work has continued on the in-kernel portions of bhyve, minimization of that delta is no longer a concern, and we've been cleaning things up to bring them closer in line with the expectations of illumos style and organization.

It would be good to do the same with the VM-related headers as those are particularly messy. Doing so will leave us in a better position to implement new features like live migration.

Actions #1

Updated by Patrick Mooney about 1 month ago

  • Subject changed from Bhyve memory-related data structures need to be refactored to support live migration. to consolidate vm-related headers for bhyve
Actions #2

Updated by Patrick Mooney about 1 month ago

  • Description updated (diff)
Actions #3

Updated by Electric Monk about 1 month ago

  • Gerrit CR set to 1510
Actions #4

Updated by Dan Cross 24 days ago

TESTING: I built against HEAD with and without this change and used `wsdiff`; the only changes were either trivial code location moves, but identical code (a lot of code shifted by 16 bytes), and the simplified `if` in `vmm_mmap_memseg`: a "can't happen" scenario was pulled out of the code: the symbol `KERN_RESOURCE_SHORTAGE` was `#define`'d to `ENOMEM`; however, that symbol was never used anywhere other than the conditional in `vmm_mmap_memseg`, which compared it to the `error` value returned `vm_map_wire` in the non-zero case. However, inspection of `vm_map_wire` shows that it can only ever return 0 (success) or `FC_NOMAP`, which is a fault code for when a mapping doesn't exist: it never returns `ENOMEM`, let alone `KERN_RESOURCE_SHORTAGE` (which has been entirely removed, anyway). Thus, in the failure case in this code stanza, we should only ever return `EFAULT`; the condition for `ENOMEM` was superfluous.

The only other differences were hardcoded strings: either the `git` commit ID, or date/time in `motd`.

Actions #5

Updated by Patrick Mooney 23 days ago

I took this for a spin on both AMD and Intel hardware using the typical variety of guests. It appeared to function as normal.

Actions #6

Updated by Electric Monk 19 days ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit cf409e3f26ef8db450f46ba9760eb9734f603ae0

commit  cf409e3f26ef8db450f46ba9760eb9734f603ae0
Author: Dan Cross <>
Date:   2021-06-01T02:20:34.000Z

    13825 consolidate vm-related headers for bhyve
    Reviewed by: Patrick Mooney <>
    Reviewed by: Yuri Pankov <>
    Reviewed by: Andy Fiddaman <>
    Approved by: Robert Mustacchi <>


Also available in: Atom PDF