Commit graph

9 commits

Author SHA1 Message Date
Sean Christopherson
95fb046071 KVM: selftests: Rename vm_create() => vm_create_barebones(), drop param
Rename vm_create() to vm_create_barebones() and drop the @phys_pages
param.  Pass '0' for the number of pages even though some callers pass
'DEFAULT_GUEST_PHY_PAGES', as the intent behind creating truly barebones
VMs is purely to create a VM, i.e. there aren't vCPUs, there's no guest
code loaded, etc..., and so there is nothing that will ever need or
consume guest memory.

Freeing up the name vm_create() will allow using the name for an inner
helper to the other VM creators, which need a "full" VM.

Opportunisticaly rewrite the function comment for addr_gpa2alias() to
focus on what the _function_ does, not what its _sole caller_ does.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-06-11 11:46:33 -04:00
Sean Christopherson
2ab2c307c7 KVM: selftests: Drop @mode from common vm_create() helper
Drop @mode from vm_create() and have it use VM_MODE_DEFAULT.  Add and use
an inner helper, __vm_create(), to service the handful of tests that want
something other than VM_MODE_DEFAULT.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-06-11 10:15:10 -04:00
Sean Christopherson
ccc82ba6be KVM: selftests: Always open VM file descriptors with O_RDWR
Drop the @perm param from vm_create() and always open VM file descriptors
with O_RDWR.  There's no legitimate use case for other permissions, and
if a selftest wants to do oddball negative testing it can open code the
necessary bits instead of forcing a bunch of tests to provide useless
information.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-06-11 10:14:52 -04:00
Vitaly Kuznetsov
908fa88e42 KVM: selftests: Make sure kvm_create_max_vcpus test won't hit RLIMIT_NOFILE
With the elevated 'KVM_CAP_MAX_VCPUS' value kvm_create_max_vcpus test
may hit RLIMIT_NOFILE limits:

 # ./kvm_create_max_vcpus
 KVM_CAP_MAX_VCPU_ID: 4096
 KVM_CAP_MAX_VCPUS: 1024
 Testing creating 1024 vCPUs, with IDs 0...1023.
 /dev/kvm not available (errno: 24), skipping test

Adjust RLIMIT_NOFILE limits to make sure KVM_CAP_MAX_VCPUS fds can be
opened. Note, raising hard limit ('rlim_max') requires CAP_SYS_RESOURCE
capability which is generally not needed to run kvm selftests (but without
raising the limit the test is doomed to fail anyway).

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20211123135953.667434-1-vkuznets@redhat.com>
[Skip the test if the hard limit can be raised. - Paolo]
Reviewed-by: Sean Christopherson <seanjc@google.com>
Tested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-26 08:14:20 -05:00
Juergen Gross
a1c42ddedf kvm: rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS
KVM_MAX_VCPU_ID is not specifying the highest allowed vcpu-id, but the
number of allowed vcpu-ids. This has already led to confusion, so
rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS to make its semantics more
clear

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210913135745.13944-3-jgross@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-30 04:27:05 -04:00
Andrew Jones
244c6b6df9 KVM: selftests: Convert some printf's to pr_info's
We leave some printf's because they inform the user the test is being
skipped. QUIET should not disable those. We also leave the printf's
used for help text.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-16 17:57:07 +01:00
Wainer dos Santos Moschetta
f245eeaddc selftests: kvm: Simplify loop in kvm_create_max_vcpus test
On kvm_create_max_vcpus test remove unneeded local
variable in the loop that add vcpus to the VM.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-11-15 11:44:12 +01:00
Paolo Bonzini
fd4198bf17 KVM: s390: add kselftests
This is the initial implementation for KVM selftests on s390.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJdGfsWAAoJEBF7vIC1phx8MLAP+wWRG6ZBr4K0GJMRVWnudfbD
 Bk/j2s4Oi8V/B8Px5/aa5BEhCzrQVWHxdCGPSdViV3Z8V2HWY0bDOl/Ul2+yaKrx
 IgnQkEJZjLlN8/RZKX9F28MnST05b3EqXhzt7+vSUMcmnWFVFzErWQW9JT1LQVDE
 x/pVlGW/SpLEEdDR22ZEAqQQLuSid+I0RpvWSe7wRTVd0IlIN0X8q70f2yU7Lxpw
 oAVinmZ1fhu6WF1TMPbpL9GJtKMX5I0XqYnw8x9fFGkSWU7NNHzrvnv6ui7jwagG
 tRqKE6vWeCVr+0PDarDOXTM6o5PfskOHXNENAKuCCJk4oGKQM2GTYJ15t5IyTDBl
 qTIR6BccJ8PDudm7Mir6jyFyu89t6C/lsYGvbar4p44GouO4Z5mowUkpLmAMSJgO
 i+gFCeKR9cj2Zz15cjsD2CrsQI6EPa9t3O8T4hsLuSOxRU+oc2plegRZ7i7hLNnw
 075RGRv/hgzC9bUjOtJ3u7Rqny8TSGgNIedg3CujOD2TLYvrCT9CmcibTFlrQpvk
 UBPUNSN+TIqPgvD/5fnEG809EKS0yiqu+8Ihm4b5W6zx8cP3cSoXEcaBuQXCLbQ5
 XVDb4Yji0tMfxP75uCofEE/R2NMvHfkJ72zGvuXv1nSkXSPViQGkmXrWE0ie87hm
 qyilYkncFh3wd6usbhBW
 =STwX
 -----END PGP SIGNATURE-----

Merge tag 'kvm-s390-next-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

KVM: s390: add kselftests

This is the initial implementation for KVM selftests on s390.
2019-07-15 13:28:58 +02:00
Thomas Huth
49fe9a5d16 KVM: selftests: Move kvm_create_max_vcpus test to generic code
There is nothing x86-specific in the test apart from the VM_MODE_P52V48_4K
which we can now replace with VM_MODE_DEFAULT. Thus let's move the file to
the main folder and enable it for aarch64 and s390x, too.

Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190523164309.13345-10-thuth@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2019-06-04 14:05:38 +02:00
Renamed from tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c (Browse further)