Page MenuHomeFreeBSD

Move amd apic page and intel guest_msrs pages into seperate data structures
Needs ReviewPublic

Authored by rgrimes on Jan 15 2019, 6:25 PM.

Details

Reviewers
jhb
tychon
pmooney_pfmooney.com
Group Reviewers
bhyve
Summary

Currently the amd apic page and intel guest_msrs pages are stored as 2 dimension arrays inside a parent datastructure, one of these indexes is vCPU, by moving these to there own 1 dimension structure with the vCPU index left in the parent it facilitates future changes to malloc these data structures at run time.

Test Plan

Recompile vmm.ko and load guest with 16 vCPUs on both amd and intel hosts.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

rgrimes created this revision.Jan 15 2019, 6:25 PM
jhb added inline comments.Feb 21 2019, 5:53 PM
sys/amd64/vmm/intel/vmx_msr.c
327

My only thought would be to maybe change this to a 'struct vmx_msrs *' and then you would have:

struct vmx_msrs *guest_msrs;

guest_msrs = &vmx->guest_msrs[vcpuid];

and then guest_msrs[XXX] just becomes guest_msrs.reg[XXX].

rgrimes added inline comments.Feb 21 2019, 8:56 PM
sys/amd64/vmm/intel/vmx_msr.c
327

I started on this, but that blows the patch up as every guest_msrs[] has to be changed in each function. The way I have it now it just touches the local pointer setup and leaves the other code lines alone.

Do we really want to do this?

jhb added inline comments.Feb 21 2019, 9:05 PM
sys/amd64/vmm/intel/vmx_msr.c
327

As Patrick noted, it lets the compiler and static analyzers safely check the bounds on guest_msrs[] (which doesn't happen today, so that would be a bonus to do). While the patch is larger I do think it is clearer.

araujo removed a reviewer: araujo.Feb 22 2019, 1:20 AM