kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: Rename vm_open() to __vm_create()
@ 2021-10-12 17:40 Krish Sadhukhan
  2021-10-12 21:14 ` Jim Mattson
  0 siblings, 1 reply; 4+ messages in thread
From: Krish Sadhukhan @ 2021-10-12 17:40 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini

vm_open() actually creates the VM by opening the KVM device and calling
KVM_CREATE_VM ioctl, so it is semantically more correct to call it
__vm_create().

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
---
 tools/testing/selftests/kvm/lib/kvm_util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 10a8ed691c66..91603c9b8078 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -151,7 +151,7 @@ void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size)
 	vm->dirty_ring_size = ring_size;
 }
 
-static void vm_open(struct kvm_vm *vm, int perm)
+static void __vm_create(struct kvm_vm *vm, int perm)
 {
 	vm->kvm_fd = _open_kvm_dev_path_or_exit(perm);
 
@@ -296,7 +296,7 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
 		vm->type = KVM_VM_TYPE_ARM_IPA_SIZE(vm->pa_bits);
 #endif
 
-	vm_open(vm, perm);
+	__vm_create(vm, perm);
 
 	/* Limit to VA-bit canonical virtual addresses. */
 	vm->vpages_valid = sparsebit_alloc();
@@ -418,7 +418,7 @@ void kvm_vm_restart(struct kvm_vm *vmp, int perm)
 	int ctr;
 	struct userspace_mem_region *region;
 
-	vm_open(vmp, perm);
+	__vm_create(vmp, perm);
 	if (vmp->has_irqchip)
 		vm_create_irqchip(vmp);
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: selftests: Rename vm_open() to __vm_create()
  2021-10-12 17:40 [PATCH] KVM: selftests: Rename vm_open() to __vm_create() Krish Sadhukhan
@ 2021-10-12 21:14 ` Jim Mattson
  2021-10-12 23:17   ` Krish Sadhukhan
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Mattson @ 2021-10-12 21:14 UTC (permalink / raw)
  To: Krish Sadhukhan; +Cc: kvm, pbonzini

On Tue, Oct 12, 2021 at 1:43 PM Krish Sadhukhan
<krish.sadhukhan@oracle.com> wrote:
>
> vm_open() actually creates the VM by opening the KVM device and calling
> KVM_CREATE_VM ioctl, so it is semantically more correct to call it
> __vm_create().

I see no problem with the current semantics, since the KVM_CREATE_VM
ioctl *opens* a new VM file descriptor.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: selftests: Rename vm_open() to __vm_create()
  2021-10-12 21:14 ` Jim Mattson
@ 2021-10-12 23:17   ` Krish Sadhukhan
  2021-10-13  0:08     ` Jim Mattson
  0 siblings, 1 reply; 4+ messages in thread
From: Krish Sadhukhan @ 2021-10-12 23:17 UTC (permalink / raw)
  To: Jim Mattson; +Cc: kvm, pbonzini


On 10/12/21 2:14 PM, Jim Mattson wrote:
> On Tue, Oct 12, 2021 at 1:43 PM Krish Sadhukhan
> <krish.sadhukhan@oracle.com> wrote:
>> vm_open() actually creates the VM by opening the KVM device and calling
>> KVM_CREATE_VM ioctl, so it is semantically more correct to call it
>> __vm_create().
> I see no problem with the current semantics, since the KVM_CREATE_VM
> ioctl *opens* a new VM file descriptor.

Agreed. But the KVM device is also opened for many purposes. For 
example, in kvm_get_supported_cpuid() it is opened for getting CPUID 
stuff.  The purpose of opening the KVM device in this context is to 
create a VM and hence I thought it would be semantically correct to 
rename the function.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: selftests: Rename vm_open() to __vm_create()
  2021-10-12 23:17   ` Krish Sadhukhan
@ 2021-10-13  0:08     ` Jim Mattson
  0 siblings, 0 replies; 4+ messages in thread
From: Jim Mattson @ 2021-10-13  0:08 UTC (permalink / raw)
  To: Krish Sadhukhan; +Cc: kvm, pbonzini

On Tue, Oct 12, 2021 at 4:17 PM Krish Sadhukhan
<krish.sadhukhan@oracle.com> wrote:
>
>
> On 10/12/21 2:14 PM, Jim Mattson wrote:
> > On Tue, Oct 12, 2021 at 1:43 PM Krish Sadhukhan
> > <krish.sadhukhan@oracle.com> wrote:
> >> vm_open() actually creates the VM by opening the KVM device and calling
> >> KVM_CREATE_VM ioctl, so it is semantically more correct to call it
> >> __vm_create().
> > I see no problem with the current semantics, since the KVM_CREATE_VM
> > ioctl *opens* a new VM file descriptor.
>
> Agreed. But the KVM device is also opened for many purposes. For
> example, in kvm_get_supported_cpuid() it is opened for getting CPUID
> stuff.  The purpose of opening the KVM device in this context is to
> create a VM and hence I thought it would be semantically correct to
> rename the function.

You are misinterpreting my response. I said nothing about the  KVM device.

The KVM_CREATE_VM ioctl *opens* a brand-new VM file descriptor. In that sense,
vm_open makes perfect sense.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-13  0:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 17:40 [PATCH] KVM: selftests: Rename vm_open() to __vm_create() Krish Sadhukhan
2021-10-12 21:14 ` Jim Mattson
2021-10-12 23:17   ` Krish Sadhukhan
2021-10-13  0:08     ` Jim Mattson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).