1. 01 6月, 2020 1 次提交
  2. 07 5月, 2020 1 次提交
  3. 16 4月, 2020 4 次提交
  4. 17 3月, 2020 6 次提交
  5. 25 2月, 2020 1 次提交
  6. 31 1月, 2020 1 次提交
  7. 24 9月, 2019 3 次提交
    • P
      KVM: selftests: Remove duplicate guest mode handling · 52200d0d
      Peter Xu 提交于
      Remove the duplication code in run_test() of dirty_log_test because
      after some reordering of functions now we can directly use the outcome
      of vm_create().
      
      Meanwhile, with the new VM_MODE_PXXV48_4K, we can safely revert
      b442324b too where we stick the x86_64 PA width to 39 bits for
      dirty_log_test.
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      52200d0d
    • P
      KVM: selftests: Introduce VM_MODE_PXXV48_4K · 567a9f1e
      Peter Xu 提交于
      The naming VM_MODE_P52V48_4K is explicit but unclear when used on
      x86_64 machines, because x86_64 machines are having various physical
      address width rather than some static values.  Here's some examples:
      
        - Intel Xeon E3-1220:  36 bits
        - Intel Core i7-8650:  39 bits
        - AMD   EPYC 7251:     48 bits
      
      All of them are using 48 bits linear address width but with totally
      different physical address width (and most of the old machines should
      be less than 52 bits).
      
      Let's create a new guest mode called VM_MODE_PXXV48_4K for current
      x86_64 tests and make it as the default to replace the old naming of
      VM_MODE_P52V48_4K because it shows more clearly that the PA width is
      not really a constant.  Meanwhile we also stop assuming all the x86
      machines are having 52 bits PA width but instead we fetch the real
      vm->pa_bits from CPUID 0x80000008 during runtime.
      
      We currently make this exclusively used by x86_64 but no other arch.
      
      As a slight touch up, moving DEBUG macro from dirty_log_test.c to
      kvm_util.h so lib can use it too.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      567a9f1e
    • P
      KVM: selftests: Move vm type into _vm_create() internally · 12c386b2
      Peter Xu 提交于
      Rather than passing the vm type from the top level to the end of vm
      creation, let's simply keep that as an internal of kvm_vm struct and
      decide the type in _vm_create().  Several reasons for doing this:
      
      - The vm type is only decided by physical address width and currently
        only used in aarch64, so we've got enough information as long as
        we're passing vm_guest_mode into _vm_create(),
      
      - This removes a loop dependency between the vm->type and creation of
        vms.  That's why now we need to parse vm_guest_mode twice sometimes,
        once in run_test() and then again in _vm_create().  The follow up
        patches will move on to clean up that as well so we can have a
        single place to decide guest machine types and so.
      
      Note that this patch will slightly change the behavior of aarch64
      tests in that previously most vm_create() callers will directly pass
      in type==0 into _vm_create() but now the type will depend on
      vm_guest_mode, however it shouldn't affect any user because all
      vm_create() users of aarch64 will be using VM_MODE_DEFAULT guest
      mode (which is VM_MODE_P40V48_4K) so at last type will still be zero.
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      12c386b2
  8. 02 8月, 2019 1 次提交
  9. 19 6月, 2019 2 次提交
  10. 05 6月, 2019 1 次提交
  11. 04 6月, 2019 2 次提交
  12. 25 5月, 2019 1 次提交
  13. 08 5月, 2019 1 次提交
  14. 29 3月, 2019 1 次提交
    • S
      KVM: selftests: complete IO before migrating guest state · 0f73bbc8
      Sean Christopherson 提交于
      Documentation/virtual/kvm/api.txt states:
      
        NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR and
              KVM_EXIT_EPR the corresponding operations are complete (and guest
              state is consistent) only after userspace has re-entered the
              kernel with KVM_RUN.  The kernel side will first finish incomplete
              operations and then check for pending signals.  Userspace can
              re-enter the guest with an unmasked signal pending to complete
              pending operations.
      
      Because guest state may be inconsistent, starting state migration after
      an IO exit without first completing IO may result in test failures, e.g.
      a proposed change to KVM's handling of %rip in its fast PIO handling[1]
      will cause the new VM, i.e. the post-migration VM, to have its %rip set
      to the IN instruction that triggered KVM_EXIT_IO, leading to a test
      assertion due to a stage mismatch.
      
      For simplicitly, require KVM_CAP_IMMEDIATE_EXIT to complete IO and skip
      the test if it's not available.  The addition of KVM_CAP_IMMEDIATE_EXIT
      predates the state selftest by more than a year.
      
      [1] https://patchwork.kernel.org/patch/10848545/
      
      Fixes: fa3899ad ("kvm: selftests: add basic test for state save and restore")
      Reported-by: NJim Mattson <jmattson@google.com>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0f73bbc8
  15. 21 12月, 2018 2 次提交
  16. 15 12月, 2018 1 次提交
  17. 14 12月, 2018 1 次提交
    • P
      kvm: introduce manual dirty log reprotect · 2a31b9db
      Paolo Bonzini 提交于
      There are two problems with KVM_GET_DIRTY_LOG.  First, and less important,
      it can take kvm->mmu_lock for an extended period of time.  Second, its user
      can actually see many false positives in some cases.  The latter is due
      to a benign race like this:
      
        1. KVM_GET_DIRTY_LOG returns a set of dirty pages and write protects
           them.
        2. The guest modifies the pages, causing them to be marked ditry.
        3. Userspace actually copies the pages.
        4. KVM_GET_DIRTY_LOG returns those pages as dirty again, even though
           they were not written to since (3).
      
      This is especially a problem for large guests, where the time between
      (1) and (3) can be substantial.  This patch introduces a new
      capability which, when enabled, makes KVM_GET_DIRTY_LOG not
      write-protect the pages it returns.  Instead, userspace has to
      explicitly clear the dirty log bits just before using the content
      of the page.  The new KVM_CLEAR_DIRTY_LOG ioctl can also operate on a
      64-page granularity rather than requiring to sync a full memslot;
      this way, the mmu_lock is taken for small amounts of time, and
      only a small amount of time will pass between write protection
      of pages and the sending of their content.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2a31b9db
  18. 17 10月, 2018 6 次提交
  19. 20 9月, 2018 1 次提交
  20. 22 8月, 2018 3 次提交
    • P
      kvm: selftest: add dirty logging test · 3b4cd0ff
      Peter Xu 提交于
      Test KVM dirty logging functionality.
      
      The test creates a standalone memory slot to test tracking the dirty
      pages since we can't really write to the default memory slot which still
      contains the guest ELF image.
      
      We have two threads running during the test:
      
      (1) the vcpu thread continuously dirties random guest pages by writting
          a iteration number to the first 8 bytes of the page
      
      (2) the host thread continuously fetches dirty logs for the testing
          memory region and verify each single bit of the dirty bitmap by
          checking against the values written onto the page
      
      Note that since the guest cannot calls the general userspace APIs like
      random(), it depends on the host to provide random numbers for the
      page indexes to dirty.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3b4cd0ff
    • P
      kvm: selftest: pass in extra memory when create vm · aee41be5
      Peter Xu 提交于
      This information can be used to decide the size of the default memory
      slot, which will need to cover the extra pages with page tables.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      aee41be5
    • P
      kvm: selftest: unify the guest port macros · 4e18bccc
      Peter Xu 提交于
      Most of the tests are using the same way to do guest to host sync but
      the code is mostly duplicated.  Generalize the guest port macros into
      the common header file and use it in different tests.
      
      Meanwhile provide "struct guest_args" and a helper "guest_args_read()"
      to hide the register details when playing with these port operations on
      RDI and RSI.
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4e18bccc