Message ID | 20181203215318.15545-1-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
Headers | show |
Series | KVM: VMX: Add "vmx" dir and shatter vmx.c | expand |
On Mon, Dec 3, 2018 at 1:53 PM Sean Christopherson <sean.j.christopherson@intel.com> wrote: > > The ultimate goal of this series is to break vmx.c's monopoly on all > things VMX so that it's size goes from utterly ludicrous to merely > ridiculous. For the most part the patches are simply moving code > around. There are a few actual code changes sprinkled in, primarily > to allow moving the nested code out of vmx.c without having to expose > variables unnecessarily. Would this be a good time to think about breaking kvm's monopoly on all things vmx? That is, move the hardware VMX state management into an independent layer, so that other hypervisors could also make use of it? I'm thinking of things like global VPID allocation, tracking of which VMCS is current on each logical processor (and which VMCSs are active on each logical processor), etc.
2018-12-04 10:19-0800, Jim Mattson: > On Mon, Dec 3, 2018 at 1:53 PM Sean Christopherson > <sean.j.christopherson@intel.com> wrote: > > > > The ultimate goal of this series is to break vmx.c's monopoly on all > > things VMX so that it's size goes from utterly ludicrous to merely > > ridiculous. For the most part the patches are simply moving code > > around. There are a few actual code changes sprinkled in, primarily > > to allow moving the nested code out of vmx.c without having to expose > > variables unnecessarily. > > Would this be a good time to think about breaking kvm's monopoly on > all things vmx? That is, move the hardware VMX state management into > an independent layer, so that other hypervisors could also make use of > it? I'm thinking of things like global VPID allocation, tracking of > which VMCS is current on each logical processor (and which VMCSs are > active on each logical processor), etc. The KVM code is quite ready to be abstracted and the resulting overhead should be very low, so my only concern is that it would bit rot without a second user, just like vmm_exclusive did. Now that we're finally splitting vmx.c, I think we could start by separating the code that could be in a separate layer into a separate file(s) in x86/kvm/vmx. This code should be pretty easy to promote later (after ample bikeshedding) and we won't be exporting a potentially broken interface until there is a user for it.
2018-12-03 13:52-0800, Sean Christopherson: > The ultimate goal of this series is to break vmx.c's monopoly on all > things VMX so that it's size goes from utterly ludicrous to merely > ridiculous. For the most part the patches are simply moving code > around. There are a few actual code changes sprinkled in, primarily > to allow moving the nested code out of vmx.c without having to expose > variables unnecessarily. The split looks reasonable, quick review didn't reveal any regressions, and, honestly, anything that compiles is more than welcome at this point, even if it complicates all in-flight patches. Acked-by: Radim Krčmář <rkrcmar@redhat.com> It's going to be easier to dissect the abominations now, thanks!
On 03/12/18 22:52, Sean Christopherson wrote: > The ultimate goal of this series is to break vmx.c's monopoly on all > things VMX so that it's size goes from utterly ludicrous to merely > ridiculous. For the most part the patches are simply moving code > around. There are a few actual code changes sprinkled in, primarily > to allow moving the nested code out of vmx.c without having to expose > variables unnecessarily. > > Sean Christopherson (28): > KVM: nVMX: Free the VMREAD/VMWRITE bitmaps if alloc_kvm_area() fails > KVM: nVMX: Allocate and configure VM{READ,WRITE} bitmaps iff > enable_shadow_vmcs > KVM: VMX: Alphabetize the includes in vmx.c > KVM: x86: Add requisite includes to kvm_cache_regs.h > KVM: x86: Add requisite includes to hyperv.h > KVM: VMX: Move VMX specific files to a "vmx" subdirectory > KVM: VMX: rename vmx_shadow_fields.h to vmcs_shadow_fields.h > KVM: VMX: Drop the "vmx" prefix from vmx_evmcs.h > KVM: VMX: Move caching of MSR_IA32_XSS to hardware_setup() > KVM: VMX: Properly handle dynamic VM Entry/Exit controls > KVM: VMX: Pass vmx_capability struct to setup_vmcs_config() > KVM: VMX: Move capabilities structs and helpers to dedicated file > KVM: VMX: Expose various module param vars via capabilities.h > KVM: VMX: Move VMCS definitions to dedicated file > KVM: nVMX: Move vmcs12 code to dedicated files > KVM: VMX: Move eVMCS code dedicated files > KVM: VMX: Move VMX instruction wrappers to a dedicated header file > KVM: VMX: Add vmx.h to hold VMX definitions and inline functions > KVM: VMX: Move nested hardware/vcpu {un}setup to helper functions > KVM: x86: nVMX: Allow nested_enable_evmcs to be NULL > KVM: VMX: Move the hardware {un}setup functions to the bottom > KVM: nVMX: Set callbacks for nested functions during hardware setup > KVM: nVMX: Call nested_vmx_setup_ctls_msrs() iff @nested is true > KVM: nVMX: Move "vmcs12 to shadow/evmcs sync" to helper function > KVM: VMX: Expose misc variables needed for nested VMX > KVM: VMX: Expose various getters and setters to nested VMX > KVM: VMX: Expose nested_vmx_allowed() to nested VMX as a non-inline > KVM: nVMX: Move nested code to dedicated files > > arch/x86/kvm/Makefile | 2 +- > arch/x86/kvm/hyperv.h | 2 + > arch/x86/kvm/kvm_cache_regs.h | 2 + > arch/x86/kvm/vmx.c | 15290 ---------------- > arch/x86/kvm/vmx/capabilities.h | 328 + > arch/x86/kvm/{vmx_evmcs.h => vmx/evmcs.c} | 47 +- > arch/x86/kvm/vmx/evmcs.h | 198 + > arch/x86/kvm/vmx/nested.c | 5703 ++++++ > arch/x86/kvm/vmx/nested.h | 282 + > arch/x86/kvm/vmx/ops.h | 285 + > arch/x86/kvm/{ => vmx}/pmu_intel.c | 0 > arch/x86/kvm/vmx/vmcs.h | 136 + > arch/x86/kvm/vmx/vmcs12.c | 157 + > arch/x86/kvm/vmx/vmcs12.h | 462 + > .../vmcs_shadow_fields.h} | 0 > arch/x86/kvm/vmx/vmx.c | 7392 ++++++++ > arch/x86/kvm/vmx/vmx.h | 602 + > arch/x86/kvm/x86.c | 2 + > 18 files changed, 15570 insertions(+), 15320 deletions(-) > delete mode 100644 arch/x86/kvm/vmx.c > create mode 100644 arch/x86/kvm/vmx/capabilities.h > rename arch/x86/kvm/{vmx_evmcs.h => vmx/evmcs.c} (94%) > create mode 100644 arch/x86/kvm/vmx/evmcs.h > create mode 100644 arch/x86/kvm/vmx/nested.c > create mode 100644 arch/x86/kvm/vmx/nested.h > create mode 100644 arch/x86/kvm/vmx/ops.h > rename arch/x86/kvm/{ => vmx}/pmu_intel.c (100%) > create mode 100644 arch/x86/kvm/vmx/vmcs.h > create mode 100644 arch/x86/kvm/vmx/vmcs12.c > create mode 100644 arch/x86/kvm/vmx/vmcs12.h > rename arch/x86/kvm/{vmx_shadow_fields.h => vmx/vmcs_shadow_fields.h} (100%) > create mode 100644 arch/x86/kvm/vmx/vmx.c > create mode 100644 arch/x86/kvm/vmx/vmx.h > Queued; better do that early. I'll take care of splitting the other pending patches. Paolo