1. 12 6月, 2020 1 次提交
  2. 01 6月, 2020 1 次提交
    • V
      KVM: rename kvm_arch_can_inject_async_page_present() to kvm_arch_can_dequeue_async_page_present() · 7c0ade6c
      Vitaly Kuznetsov 提交于
      An innocent reader of the following x86 KVM code:
      
      bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu)
      {
              if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED))
                      return true;
      ...
      
      may get very confused: if APF mechanism is not enabled, why do we report
      that we 'can inject async page present'? In reality, upon injection
      kvm_arch_async_page_present() will check the same condition again and,
      in case APF is disabled, will just drop the item. This is fine as the
      guest which deliberately disabled APF doesn't expect to get any APF
      notifications.
      
      Rename kvm_arch_can_inject_async_page_present() to
      kvm_arch_can_dequeue_async_page_present() to make it clear what we are
      checking: if the item can be dequeued (meaning either injected or just
      dropped).
      
      On s390 kvm_arch_can_inject_async_page_present() always returns 'true' so
      the rename doesn't matter much.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20200525144125.143875-4-vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7c0ade6c
  3. 16 5月, 2020 1 次提交
    • D
      kvm: add halt-polling cpu usage stats · cb953129
      David Matlack 提交于
      Two new stats for exposing halt-polling cpu usage:
      halt_poll_success_ns
      halt_poll_fail_ns
      
      Thus sum of these 2 stats is the total cpu time spent polling. "success"
      means the VCPU polled until a virtual interrupt was delivered. "fail"
      means the VCPU had to schedule out (either because the maximum poll time
      was reached or it needed to yield the CPU).
      
      To avoid touching every arch's kvm_vcpu_stat struct, only update and
      export halt-polling cpu usage stats if we're on x86.
      
      Exporting cpu usage as a u64 and in nanoseconds means we will overflow at
      ~500 years, which seems reasonably large.
      Signed-off-by: NDavid Matlack <dmatlack@google.com>
      Signed-off-by: NJon Cargille <jcargill@google.com>
      Reviewed-by: NJim Mattson <jmattson@google.com>
      
      Message-Id: <20200508182240.68440-1-jcargill@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cb953129
  4. 07 5月, 2020 1 次提交
    • P
      KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly · b9b2782c
      Peter Xu 提交于
      KVM_CAP_SET_GUEST_DEBUG should be supported for x86 however it's not declared
      as supported.  My wild guess is that userspaces like QEMU are using "#ifdef
      KVM_CAP_SET_GUEST_DEBUG" to check for the capability instead, but that could be
      wrong because the compilation host may not be the runtime host.
      
      The userspace might still want to keep the old "#ifdef" though to not break the
      guest debug on old kernels.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <20200505154750.126300-1-peterx@redhat.com>
      [Do the same for PPC and s390. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b9b2782c
  5. 06 5月, 2020 1 次提交
    • P
      KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly · 495907ec
      Peter Xu 提交于
      KVM_CAP_SET_GUEST_DEBUG should be supported for x86 however it's not declared
      as supported.  My wild guess is that userspaces like QEMU are using "#ifdef
      KVM_CAP_SET_GUEST_DEBUG" to check for the capability instead, but that could be
      wrong because the compilation host may not be the runtime host.
      
      The userspace might still want to keep the old "#ifdef" though to not break the
      guest debug on old kernels.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <20200505154750.126300-1-peterx@redhat.com>
      [Do the same for PPC and s390. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      495907ec
  6. 21 4月, 2020 2 次提交
  7. 14 4月, 2020 1 次提交
  8. 31 3月, 2020 1 次提交
  9. 26 3月, 2020 1 次提交
  10. 24 3月, 2020 1 次提交
  11. 17 3月, 2020 4 次提交
    • S
      KVM: Ensure validity of memslot with respect to kvm_get_dirty_log() · 2a49f61d
      Sean Christopherson 提交于
      Rework kvm_get_dirty_log() so that it "returns" the associated memslot
      on success.  A future patch will rework memslot handling such that
      id_to_memslot() can return NULL, returning the memslot makes it more
      obvious that the validity of the memslot has been verified, i.e.
      precludes the need to add validity checks in the arch code that are
      technically unnecessary.
      
      To maintain ordering in s390, move the call to kvm_arch_sync_dirty_log()
      from s390's kvm_vm_ioctl_get_dirty_log() to the new kvm_get_dirty_log().
      This is a nop for PPC, the only other arch that doesn't select
      KVM_GENERIC_DIRTYLOG_READ_PROTECT, as its sync_dirty_log() is empty.
      
      Ideally, moving the sync_dirty_log() call would be done in a separate
      patch, but it can't be done in a follow-on patch because that would
      temporarily break s390's ordering.  Making the move in a preparatory
      patch would be functionally correct, but would create an odd scenario
      where the moved sync_dirty_log() would operate on a "different" memslot
      due to consuming the result of a different id_to_memslot().  The
      memslot couldn't actually be different as slots_lock is held, but the
      code is confusing enough as it is, i.e. moving sync_dirty_log() in this
      patch is the lesser of all evils.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2a49f61d
    • S
      KVM: Provide common implementation for generic dirty log functions · 0dff0846
      Sean Christopherson 提交于
      Move the implementations of KVM_GET_DIRTY_LOG and KVM_CLEAR_DIRTY_LOG
      for CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT into common KVM code.
      The arch specific implemenations are extremely similar, differing
      only in whether the dirty log needs to be sync'd from hardware (x86)
      and how the TLBs are flushed.  Add new arch hooks to handle sync
      and TLB flush; the sync will also be used for non-generic dirty log
      support in a future patch (s390).
      
      The ulterior motive for providing a common implementation is to
      eliminate the dependency between arch and common code with respect to
      the memslot referenced by the dirty log, i.e. to make it obvious in the
      code that the validity of the memslot is guaranteed, as a future patch
      will rework memslot handling such that id_to_memslot() can return NULL.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0dff0846
    • S
      KVM: Drop "const" attribute from old memslot in commit_memory_region() · 9d4c197c
      Sean Christopherson 提交于
      Drop the "const" attribute from @old in kvm_arch_commit_memory_region()
      to allow arch specific code to free arch specific resources in the old
      memslot without having to cast away the attribute.  Freeing resources in
      kvm_arch_commit_memory_region() paves the way for simplifying
      kvm_free_memslot() by eliminating the last usage of its @dont param.
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9d4c197c
    • S
      KVM: Drop kvm_arch_create_memslot() · 414de7ab
      Sean Christopherson 提交于
      Remove kvm_arch_create_memslot() now that all arch implementations are
      effectively nops.  Removing kvm_arch_create_memslot() eliminates the
      possibility for arch specific code to allocate memory prior to setting
      a memslot, which sets the stage for simplifying kvm_free_memslot().
      
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      414de7ab
  12. 11 3月, 2020 1 次提交
  13. 28 2月, 2020 17 次提交
  14. 31 1月, 2020 3 次提交
  15. 28 1月, 2020 4 次提交