1. 07 Apr, 2022 3 commits
    • Oliver Upton's avatar
      selftests: KVM: Don't leak GIC FD across dirty log test iterations · 386ba265
      Oliver Upton authored
      dirty_log_perf_test instantiates a VGICv3 for the guest (if supported by
      hardware) to reduce the overhead of guest exits. However, the test does
      not actually close the GIC fd when cleaning up the VM between test
      iterations, meaning that the VM is never actually destroyed in the
      kernel.
      
      While this is generally a bad idea, the bug was detected from the kernel
      spewing about duplicate debugfs entries as subsequent VMs happen to
      reuse the same FD even though the debugfs directory is still present.
      
      Abstract away the notion of setup/cleanup of the GIC FD from the test
      by creating arch-specific helpers for test setup/cleanup. Close the GIC
      FD on VM cleanup and do nothing for the other architectures.
      
      Fixes: c340f789 ("KVM: selftests: Add vgic initialization for dirty log perf test for ARM")
      Reviewed-by: default avatarJing Zhang <jingzhangos@google.com>
      Signed-off-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220406235615.1447180-3-oupton@google.com
      386ba265
    • Oliver Upton's avatar
      KVM: Don't create VM debugfs files outside of the VM directory · a44a4cc1
      Oliver Upton authored
      Unfortunately, there is no guarantee that KVM was able to instantiate a
      debugfs directory for a particular VM. To that end, KVM shouldn't even
      attempt to create new debugfs files in this case. If the specified
      parent dentry is NULL, debugfs_create_file() will instantiate files at
      the root of debugfs.
      
      For arm64, it is possible to create the vgic-state file outside of a
      VM directory, the file is not cleaned up when a VM is destroyed.
      Nonetheless, the corresponding struct kvm is freed when the VM is
      destroyed.
      
      Nip the problem in the bud for all possible errant debugfs file
      creations by initializing kvm->debugfs_dentry to -ENOENT. In so doing,
      debugfs_create_file() will fail instead of creating the file in the root
      directory.
      
      Cc: stable@kernel.org
      Fixes: 929f45e3 ("kvm: no need to check return value of debugfs_create functions")
      Signed-off-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220406235615.1447180-2-oupton@google.com
      a44a4cc1
    • Andrew Jones's avatar
      KVM: selftests: get-reg-list: Add KVM_REG_ARM_FW_REG(3) · 02de9331
      Andrew Jones authored
      When testing a kernel with commit a5905d6a ("KVM: arm64:
      Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated")
      get-reg-list output
      
      vregs: Number blessed registers:   234
      vregs: Number registers:           238
      
      vregs: There are 1 new registers.
      Consider adding them to the blessed reg list with the following lines:
      
      	KVM_REG_ARM_FW_REG(3),
      
      vregs: PASS
      ...
      
      That output inspired two changes: 1) add the new register to the
      blessed list and 2) explain why "Number registers" is actually four
      larger than "Number blessed registers" (on the system used for
      testing), even though only one register is being stated as new.
      The reason is that some registers are host dependent and they get
      filtered out when comparing with the blessed list. The system
      used for the test apparently had three filtered registers.
      Signed-off-by: default avatarAndrew Jones <drjones@redhat.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220316125129.392128-1-drjones@redhat.com
      02de9331
  2. 06 Apr, 2022 7 commits
  3. 03 Apr, 2022 8 commits
  4. 02 Apr, 2022 22 commits