On Mon, May 27, 2019 at 09:27:56AM +0200, Thomas Huth wrote: > On 23/05/2019 14.57, Andrew Jones wrote: > > This frees up the name vm_vcpu_add for another use. > > > > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> > > --- > > tools/testing/selftests/kvm/include/kvm_util.h | 4 ++-- > > tools/testing/selftests/kvm/lib/aarch64/processor.c | 2 +- > > tools/testing/selftests/kvm/lib/kvm_util.c | 12 +++++++----- > > tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- > > tools/testing/selftests/kvm/x86_64/evmcs_test.c | 2 +- > > .../selftests/kvm/x86_64/kvm_create_max_vcpus.c | 2 +- > > tools/testing/selftests/kvm/x86_64/smm_test.c | 2 +- > > tools/testing/selftests/kvm/x86_64/state_test.c | 2 +- > > 8 files changed, 15 insertions(+), 13 deletions(-) > [...] > > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > > index e9113857f44e..937292dca81b 100644 > > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > > @@ -756,21 +756,23 @@ static int vcpu_mmap_sz(void) > > } > > > > /* > > - * VM VCPU Add > > + * VM VCPU Add with provided memslots > > * > > * Input Args: > > * vm - Virtual Machine > > * vcpuid - VCPU ID > > + * pgd_memslot - Memory region slot for new virtual translation tables > > + * gdt_memslot - Memory region slot for data pages > > * > > * Output Args: None > > * > > * Return: None > > * > > - * Creates and adds to the VM specified by vm and virtual CPU with > > - * the ID given by vcpuid. > > + * Adds a virtual CPU to the VM specified by vm with the ID given by vcpuid > > + * and then sets it up with vcpu_setup() and the provided memslots. > > */ > > -void vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpuid, int pgd_memslot, > > - int gdt_memslot) > > +void vm_vcpu_add_memslots(struct kvm_vm *vm, uint32_t vcpuid, int pgd_memslot, > > + int gdt_memslot) > > I think the naming and description of the function is somewhat > unfortunate now. The function is not really about memslots, but about > setting up some MMU tables in the memory (and for this you need a > memslot). So maybe rather name it vm_vcpu_add_with_mmu() or something > similar? Also it would be nice to give the reason for the memslots in > the comment before the function. > Peter Xu suggested almost the same name, so I'll do that for a v2. I'll add a couple more words to the comment too. Thanks, drew