1. 14 5月, 2020 2 次提交
    • S
      KVM: nVMX: Open a window for pending nested VMX preemption timer · d2060bd4
      Sean Christopherson 提交于
      Add a kvm_x86_ops hook to detect a nested pending "hypervisor timer" and
      use it to effectively open a window for servicing the expired timer.
      Like pending SMIs on VMX, opening a window simply means requesting an
      immediate exit.
      
      This fixes a bug where an expired VMX preemption timer (for L2) will be
      delayed and/or lost if a pending exception is injected into L2.  The
      pending exception is rightly prioritized by vmx_check_nested_events()
      and injected into L2, with the preemption timer left pending.  Because
      no window opened, L2 is free to run uninterrupted.
      
      Fixes: f4124500 ("KVM: nVMX: Fully emulate preemption timer")
      Reported-by: NJim Mattson <jmattson@google.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Peter Shier <pshier@google.com>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20200423022550.15113-3-sean.j.christopherson@intel.com>
      [Check it in kvm_vcpu_has_events too, to ensure that the preemption
       timer is serviced promptly even if the vCPU is halted and L1 is not
       intercepting HLT. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d2060bd4
    • S
      KVM: nVMX: Preserve exception priority irrespective of exiting behavior · 6ce347af
      Sean Christopherson 提交于
      Short circuit vmx_check_nested_events() if an exception is pending and
      needs to be injected into L2, priority between coincident events is not
      dependent on exiting behavior.  This fixes a bug where a single-step #DB
      that is not intercepted by L1 is incorrectly dropped due to servicing a
      VMX Preemption Timer VM-Exit.
      
      Injected exceptions also need to be blocked if nested VM-Enter is
      pending or an exception was already injected, otherwise injecting the
      exception could overwrite an existing event injection from L1.
      Technically, this scenario should be impossible, i.e. KVM shouldn't
      inject its own exception during nested VM-Enter.  This will be addressed
      in a future patch.
      
      Note, event priority between SMI, NMI and INTR is incorrect for L2, e.g.
      SMI should take priority over VM-Exit on NMI/INTR, and NMI that is
      injected into L2 should take priority over VM-Exit INTR.  This will also
      be addressed in a future patch.
      
      Fixes: b6b8a145 ("KVM: nVMX: Rework interception of IRQs and NMIs")
      Reported-by: NJim Mattson <jmattson@google.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Peter Shier <pshier@google.com>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20200423022550.15113-2-sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6ce347af
  2. 04 5月, 2020 1 次提交
  3. 25 4月, 2020 1 次提交
  4. 24 4月, 2020 1 次提交
  5. 23 4月, 2020 1 次提交
    • P
      KVM: x86: move nested-related kvm_x86_ops to a separate struct · 33b22172
      Paolo Bonzini 提交于
      Clean up some of the patching of kvm_x86_ops, by moving kvm_x86_ops related to
      nested virtualization into a separate struct.
      
      As a result, these ops will always be non-NULL on VMX.  This is not a problem:
      
      * check_nested_events is only called if is_guest_mode(vcpu) returns true
      
      * get_nested_state treats VMXOFF state the same as nested being disabled
      
      * set_nested_state fails if you attempt to set nested state while
        nesting is disabled
      
      * nested_enable_evmcs could already be called on a CPU without VMX enabled
        in CPUID.
      
      * nested_get_evmcs_version was fixed in the previous patch
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      33b22172
  6. 21 4月, 2020 27 次提交
  7. 16 4月, 2020 5 次提交
  8. 07 4月, 2020 1 次提交
  9. 31 3月, 2020 1 次提交