1. 02 8月, 2021 14 次提交
  2. 25 6月, 2021 2 次提交
  3. 24 6月, 2021 2 次提交
  4. 22 6月, 2021 1 次提交
    • J
      KVM: VMX: Skip #PF(RSVD) intercepts when emulating smaller maxphyaddr · 5140bc7d
      Jim Mattson 提交于
      As part of smaller maxphyaddr emulation, kvm needs to intercept
      present page faults to see if it needs to add the RSVD flag (bit 3) to
      the error code. However, there is no need to intercept page faults
      that already have the RSVD flag set. When setting up the page fault
      intercept, add the RSVD flag into the #PF error code mask field (but
      not the #PF error code match field) to skip the intercept when the
      RSVD flag is already set.
      Signed-off-by: NJim Mattson <jmattson@google.com>
      Message-Id: <20210618235941.1041604-1-jmattson@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5140bc7d
  5. 18 6月, 2021 11 次提交
  6. 10 6月, 2021 1 次提交
  7. 29 5月, 2021 1 次提交
  8. 27 5月, 2021 1 次提交
    • M
      KVM: VMX: update vcpu posted-interrupt descriptor when assigning device · a2486020
      Marcelo Tosatti 提交于
      For VMX, when a vcpu enters HLT emulation, pi_post_block will:
      
      1) Add vcpu to per-cpu list of blocked vcpus.
      
      2) Program the posted-interrupt descriptor "notification vector"
      to POSTED_INTR_WAKEUP_VECTOR
      
      With interrupt remapping, an interrupt will set the PIR bit for the
      vector programmed for the device on the CPU, test-and-set the
      ON bit on the posted interrupt descriptor, and if the ON bit is clear
      generate an interrupt for the notification vector.
      
      This way, the target CPU wakes upon a device interrupt and wakes up
      the target vcpu.
      
      Problem is that pi_post_block only programs the notification vector
      if kvm_arch_has_assigned_device() is true. Its possible for the
      following to happen:
      
      1) vcpu V HLTs on pcpu P, kvm_arch_has_assigned_device is false,
      notification vector is not programmed
      2) device is assigned to VM
      3) device interrupts vcpu V, sets ON bit
      (notification vector not programmed, so pcpu P remains in idle)
      4) vcpu 0 IPIs vcpu V (in guest), but since pi descriptor ON bit is set,
      kvm_vcpu_kick is skipped
      5) vcpu 0 busy spins on vcpu V's response for several seconds, until
      RCU watchdog NMIs all vCPUs.
      
      To fix this, use the start_assignment kvm_x86_ops callback to kick
      vcpus out of the halt loop, so the notification vector is
      properly reprogrammed to the wakeup vector.
      Reported-by: NPei Zhang <pezhang@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Message-Id: <20210526172014.GA29007@fuller.cnet>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a2486020
  9. 07 5月, 2021 7 次提交
    • P
      KVM: X86: Expose bus lock debug exception to guest · 76ea438b
      Paolo Bonzini 提交于
      Bus lock debug exception is an ability to notify the kernel by an #DB
      trap after the instruction acquires a bus lock and is executed when
      CPL>0. This allows the kernel to enforce user application throttling or
      mitigations.
      
      Existence of bus lock debug exception is enumerated via
      CPUID.(EAX=7,ECX=0).ECX[24]. Software can enable these exceptions by
      setting bit 2 of the MSR_IA32_DEBUGCTL. Expose the CPUID to guest and
      emulate the MSR handling when guest enables it.
      
      Support for this feature was originally developed by Xiaoyao Li and
      Chenyi Qiang, but code has since changed enough that this patch has
      nothing in common with theirs, except for this commit message.
      Co-developed-by: NXiaoyao Li <xiaoyao.li@intel.com>
      Signed-off-by: NXiaoyao Li <xiaoyao.li@intel.com>
      Signed-off-by: NChenyi Qiang <chenyi.qiang@intel.com>
      Message-Id: <20210202090433.13441-4-chenyi.qiang@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      76ea438b
    • S
      KVM: x86: Tie Intel and AMD behavior for MSR_TSC_AUX to guest CPU model · 61a05d44
      Sean Christopherson 提交于
      Squish the Intel and AMD emulation of MSR_TSC_AUX together and tie it to
      the guest CPU model instead of the host CPU behavior.  While not strictly
      necessary to avoid guest breakage, emulating cross-vendor "architecture"
      will provide consistent behavior for the guest, e.g. WRMSR fault behavior
      won't change if the vCPU is migrated to a host with divergent behavior.
      
      Note, the "new" kvm_is_supported_user_return_msr() checks do not add new
      functionality on either SVM or VMX.  On SVM, the equivalent was
      "tsc_aux_uret_slot < 0", and on VMX the check was buried in the
      vmx_find_uret_msr() call at the find_uret_msr label.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210504171734.1434054-15-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      61a05d44
    • S
      KVM: x86: Move uret MSR slot management to common x86 · e5fda4bb
      Sean Christopherson 提交于
      Now that SVM and VMX both probe MSRs before "defining" user return slots
      for them, consolidate the code for probe+define into common x86 and
      eliminate the odd behavior of having the vendor code define the slot for
      a given MSR.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210504171734.1434054-14-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e5fda4bb
    • S
      KVM: VMX: Disable loading of TSX_CTRL MSR the more conventional way · 5e17c624
      Sean Christopherson 提交于
      Tag TSX_CTRL as not needing to be loaded when RTM isn't supported in the
      host.  Crushing the write mask to '0' has the same effect, but requires
      more mental gymnastics to understand.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210504171734.1434054-12-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5e17c624
    • S
      KVM: VMX: Use common x86's uret MSR list as the one true list · 8ea8b8d6
      Sean Christopherson 提交于
      Drop VMX's global list of user return MSRs now that VMX doesn't resort said
      list to isolate "active" MSRs, i.e. now that VMX's list and x86's list have
      the same MSRs in the same order.
      
      In addition to eliminating the redundant list, this will also allow moving
      more of the list management into common x86.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210504171734.1434054-11-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8ea8b8d6
    • S
      KVM: VMX: Use flag to indicate "active" uret MSRs instead of sorting list · ee9d22e0
      Sean Christopherson 提交于
      Explicitly flag a uret MSR as needing to be loaded into hardware instead of
      resorting the list of "active" MSRs and tracking how many MSRs in total
      need to be loaded.  The only benefit to sorting the list is that the loop
      to load MSRs during vmx_prepare_switch_to_guest() doesn't need to iterate
      over all supported uret MRS, only those that are active.  But that is a
      pointless optimization, as the most common case, running a 64-bit guest,
      will load the vast majority of MSRs.  Not to mention that a single WRMSR is
      far more expensive than iterating over the list.
      
      Providing a stable list order obviates the need to track a given MSR's
      "slot" in the per-CPU list of user return MSRs; all lists simply use the
      same ordering.  Future patches will take advantage of the stable order to
      further simplify the related code.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210504171734.1434054-10-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ee9d22e0
    • S
      KVM: VMX: Configure list of user return MSRs at module init · b6194b94
      Sean Christopherson 提交于
      Configure the list of user return MSRs that are actually supported at
      module init instead of reprobing the list of possible MSRs every time a
      vCPU is created.  Curating the list on a per-vCPU basis is pointless; KVM
      is completely hosed if the set of supported MSRs changes after module init,
      or if the set of MSRs differs per physical PCU.
      
      The per-vCPU lists also increase complexity (see __vmx_find_uret_msr()) and
      creates corner cases that _should_ be impossible, but theoretically exist
      in KVM, e.g. advertising RDTSCP to userspace without actually being able to
      virtualize RDTSCP if probing MSR_TSC_AUX fails.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210504171734.1434054-9-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b6194b94