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
F102711693: D18846.id52861.diff
Sat, Nov 16, 5:17 AM
Unknown Object (File)
Sun, Oct 20, 3:44 PM
Unknown Object (File)
Oct 12 2024, 2:35 PM
Unknown Object (File)
Oct 2 2024, 11:14 PM
Unknown Object (File)
Oct 2 2024, 9:03 PM
Unknown Object (File)
Oct 2 2024, 6:11 PM
Unknown Object (File)
Oct 1 2024, 1:20 PM
Unknown Object (File)
Oct 1 2024, 1:09 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.