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