[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YQBw8BIcCAq5ybHr@google.com>
Date: Tue, 27 Jul 2021 20:47:44 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: David Matlack <dmatlack@...gle.com>
Cc: Erdem Aktas <erdemaktas@...gle.com>,
linux-kselftest@...r.kernel.org, Peter Gonda <pgonda@...gle.com>,
Marc Orr <marcorr@...gle.com>, Sagi Shahar <sagis@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Shuah Khan <shuah@...nel.org>,
Andrew Jones <drjones@...hat.com>,
Ben Gardon <bgardon@...gle.com>, Peter Xu <peterx@...hat.com>,
Emanuele Giuseppe Esposito <eesposit@...hat.com>,
Christian Borntraeger <borntraeger@...ibm.com>,
Ricardo Koller <ricarkol@...gle.com>,
Eric Auger <eric.auger@...hat.com>,
Yanan Wang <wangyanan55@...wei.com>,
Aaron Lewis <aaronlewis@...gle.com>,
Jim Mattson <jmattson@...gle.com>,
Oliver Upton <oupton@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Peter Shier <pshier@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Zhenzhong Duan <zhenzhong.duan@...el.com>,
"Maciej S. Szmigiero" <maciej.szmigiero@...cle.com>,
Like Xu <like.xu@...ux.intel.com>,
open list <linux-kernel@...r.kernel.org>,
"open list:KERNEL VIRTUAL MACHINE (KVM)" <kvm@...r.kernel.org>
Subject: Re: [RFC PATCH 1/4] KVM: selftests: Add support for creating
non-default type VMs
On Mon, Jul 26, 2021, David Matlack wrote:
> On Mon, Jul 26, 2021 at 11:37:54AM -0700, Erdem Aktas wrote:
> > Currently vm_create function only creates KVM_X86_LEGACY_VM type VMs.
> > Changing the vm_create function to accept type parameter to create
> > new VM types.
> >
> > Signed-off-by: Erdem Aktas <erdemaktas@...gle.com>
> > Reviewed-by: Sean Christopherson <seanjc@...gle.com>
*-by tags should not be added unless explicitly provided. IIRC, our internal
gerrit will convert +1 to Reviewed-by, but I don't think that's the case here.
This applies to all patches in this series.
See "Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:" in
Documentation/process/submitting-patches.rst for more info.
> > Reviewed-by: Peter Gonda <pgonda@...gle.com>
> > Reviewed-by: Marc Orr <marcorr@...gle.com>
> > Reviewed-by: Sagi Shahar <sagis@...gle.com>
>
> Reviewed-by: David Matlack <dmatlack@...gle.com>
>
> (aside from the nit below)
>
> > ---
> > .../testing/selftests/kvm/include/kvm_util.h | 1 +
> > tools/testing/selftests/kvm/lib/kvm_util.c | 29 +++++++++++++++++--
> > 2 files changed, 27 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
> > index d53bfadd2..c63df42d6 100644
> > --- a/tools/testing/selftests/kvm/include/kvm_util.h
> > +++ b/tools/testing/selftests/kvm/include/kvm_util.h
> > @@ -88,6 +88,7 @@ int vcpu_enable_cap(struct kvm_vm *vm, uint32_t vcpu_id,
> > void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size);
> >
> > struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm);
> > +struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm, int type);
>
> nit: Consider using a more readable function name such as
> vm_create_with_type().
Ha! This is why I don't like doing internal reviews :-D
Erdem originally had vm_create_type(), I suggested __vm_create() as the double
underscore scheme is more common in the kernel for cases where there's a default
wrapper and an inner helper that implements the full API.
Convention aside, the argument againsts ...with_type() are that it doesn't scale,
e.g. if someone adds another parameter parameter for which vm_create() provides a
default, and it doesn't self-document the relationship between vm_create() and
the inner helper, e.g. by convention, based on names alone I know that vm_create()
likely is a wrapper around __vm_create().
Compare that with the existing
vm_create_default_with_vcpus()
vm_create_default()
vm_create_with_vcpus()
vm_create()
where the relationship between all the helpers is not immediately clear, and
vm_create_with_vcpus() is a misnomer because it does much more than call vm_create()
and instantiate vCPUs, e.g. it also instantiates the IRQ chip and loads the test
into guest memory.
Powered by blists - more mailing lists