Project

General

Profile

Bug #13064

bhyve should not waste extra page for VMCS

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

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

100%

Estimated time:
Difficulty:
Medium
Tags:
bhyve
Gerrit CR:

Description

When bhyve was ported to illumos, the allocation for the VMCS was expanded for an extra page (per vCPU!) in order to store some extra state (the physical address of the VMCS) which was hard to access in certain contexts:

struct vmcs {
        uint32_t        identifier;
        uint32_t        abort_code;
        char            _impl_specific[PAGE_SIZE - sizeof(uint32_t) * 2];
#ifndef __FreeBSD__
        /*
         * Keep the physical address of the VMCS cached adjacent for the
         * structure so it can be referenced in contexts which are too delicate
         * for a call into the HAT.  For the moment it means wasting a whole
         * page on padding for the PA value to maintain alignment, but it
         * allows the consumers of 'struct vmcs *' to easily access the value
         * without a significant change to the interface.
         */
        uint64_t        vmcs_pa;
        char            _pa_pad[PAGE_SIZE - sizeof (vm_paddr_t)];
#endif
};

As we're cleaning up the VMCS interfaces in #13063, it would be nice to fix this as well.


Related issues

Related to illumos gate - Bug #13063: clarify VMCS interfaces in bhyveClosedPatrick Mooney

Actions

Also available in: Atom PDF