Despite all but one patch being KVM cleanup, that one outlier is the true catalyst for this series. The outlier, patch 3/11, removes an optimization tweak from the __noclone macro that was added by commit 95272c29378e ("compiler-gcc: disable -ftracer for __noclone functions") to workaround a compiler error in KVM's esoteric VMX assembly code. Unbeknownst at the time, using the __optimize__ attribute causes GCC to reset to -O2 optimization defaults, which has several unintended side effects including dropping -fno-omit-frame-pointer and preventing GCC from properly inlining function calls due to the functions having incompatible optimization attributes. Patches 1/11 and 2/11 fix the offending KVM code and eliminate its usage of __noclone, allowing patch 3/11 to remove "no-tracer" from the __noclone macro. Patches 4/11 and beyond are a mix of cleanup, fixes and optimizations for a variety of low hanging fruit that were (unsurprisingly) revealed when revisiting KVM's inline assembly blob. FYI, I cc'd everyone involved for all patches up until the -ftracer revert, after that I limited the cc/to list to KVM folks. Sean Christopherson (11): KVM: VMX: Explicitly reference RCX as the vmx_vcpu pointer in asm blobs KVM: VMX: Move VM-Enter + VM-Exit handling to non-inline sub-routines Revert "compiler-gcc: disable -ftracer for __noclone functions" KVM: VMX: Modify only RSP when creating a placeholder for guest's RCX KVM: VMX: Save RSI to an unused output in vmx_vcpu_run() asm blob KVM: VMX: Manually load RDX in vmx_vcpu_run() asm blob KVM: VMX: Let the compiler save/load RDX around VM-Enter KVM: nVMX: Cache host_rsp on a per-VMCS basis KVM: nVMX: Add eVMCS support to nested_vmx_check_vmentry_hw() KVM: VMX: Add macros to handle HOST_RSP updates at VM-Enter KVM: nVMX: Remove a rogue "rax" clobber from nested_vmx_check_vmentry_hw() arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/vmx/nested.c | 57 ++++--------- arch/x86/kvm/vmx/vmcs.h | 1 + arch/x86/kvm/vmx/vmenter.S | 57 +++++++++++++ arch/x86/kvm/vmx/vmx.c | 127 +++++++++++++--------------- arch/x86/kvm/vmx/vmx.h | 30 ++++++- include/linux/compiler_attributes.h | 8 +- 7 files changed, 164 insertions(+), 118 deletions(-) create mode 100644 arch/x86/kvm/vmx/vmenter.S -- 2.19.2