Page MenuHomeFreeBSD

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

Authored by jhb on Jan 15 2019, 6:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 2:11 PM
Unknown Object (File)
Dec 24 2023, 10:02 PM
Unknown Object (File)
Dec 20 2023, 5:50 AM
Unknown Object (File)
Dec 11 2023, 12:58 AM
Unknown Object (File)
Nov 15 2023, 5:11 AM
Unknown Object (File)
Oct 14 2023, 8:27 AM
Unknown Object (File)
Oct 14 2023, 8:27 AM
Unknown Object (File)
Oct 12 2023, 1:51 PM

Details

Reviewers
tychon
pmooney_pfmooney.com
rgrimes
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 - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

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].

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?

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.

jhb edited reviewers, added: rgrimes; removed: jhb.