[0/7] KVM: Grab KVM references for stats fds

Message ID 20230711230131.648752-1-seanjc@google.com
Headers
Series KVM: Grab KVM references for stats fds |

Message

Sean Christopherson July 11, 2023, 11:01 p.m. UTC
  Grab a reference to the VM when handing a userspace stats fds for VMs and
vCPUs to ensure the stats files don't outlive the VM and its vCPUs, and add
a regression testcase in selftests.

Sean Christopherson (7):
  KVM: Grab a reference to KVM for VM and vCPU stats file descriptors
  KVM: selftests: Use pread() to read binary stats header
  KVM: selftests: Clean up stats fd in common stats_test() helper
  KVM: selftests: Explicitly free vcpus array in binary stats test
  KVM: selftests: Verify userspace can create "redundant" binary stats
    files
  KVM: selftests: Verify stats fd can be dup()'d and read
  KVM: selftests: Verify stats fd is usable after VM fd has been closed

 .../selftests/kvm/include/kvm_util_base.h     |  6 +-
 .../selftests/kvm/kvm_binary_stats_test.c     | 72 ++++++++++++-------
 virt/kvm/kvm_main.c                           | 24 +++++++
 3 files changed, 75 insertions(+), 27 deletions(-)


base-commit: 255006adb3da71bb75c334453786df781b415f54
  

Comments

Sean Christopherson July 26, 2023, 3:17 p.m. UTC | #1
On Tue, 11 Jul 2023 16:01:24 -0700, Sean Christopherson wrote:
> Grab a reference to the VM when handing a userspace stats fds for VMs and
> vCPUs to ensure the stats files don't outlive the VM and its vCPUs, and add
> a regression testcase in selftests.
> 
> Sean Christopherson (7):
>   KVM: Grab a reference to KVM for VM and vCPU stats file descriptors
>   KVM: selftests: Use pread() to read binary stats header
>   KVM: selftests: Clean up stats fd in common stats_test() helper
>   KVM: selftests: Explicitly free vcpus array in binary stats test
>   KVM: selftests: Verify userspace can create "redundant" binary stats
>     files
>   KVM: selftests: Verify stats fd can be dup()'d and read
>   KVM: selftests: Verify stats fd is usable after VM fd has been closed
> 
> [...]

Applied to kvm-x86 fixes, thanks!

[1/7] KVM: Grab a reference to KVM for VM and vCPU stats file descriptors
      https://github.com/kvm-x86/linux/commit/0d6d1727a21e
[2/7] KVM: selftests: Use pread() to read binary stats header
      https://github.com/kvm-x86/linux/commit/ba6ed5058b1e
[3/7] KVM: selftests: Clean up stats fd in common stats_test() helper
      https://github.com/kvm-x86/linux/commit/34ffae5d4294
[4/7] KVM: selftests: Explicitly free vcpus array in binary stats test
      https://github.com/kvm-x86/linux/commit/0dec04897a5c
[5/7] KVM: selftests: Verify userspace can create "redundant" binary stats files
      https://github.com/kvm-x86/linux/commit/518f3fde1f28
[6/7] KVM: selftests: Verify stats fd can be dup()'d and read
      https://github.com/kvm-x86/linux/commit/a4b51af2c290
[7/7] KVM: selftests: Verify stats fd is usable after VM fd has been closed
      https://github.com/kvm-x86/linux/commit/00b6b7e96803

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes
  
Paolo Bonzini July 29, 2023, 3:02 p.m. UTC | #2
Queued, thanks.

Paolo