On Wed, Aug 03, 2022 at 03:46:35PM +0200, Vitaly Kuznetsov wrote: > Similar to vm_vaddr_alloc(), virt_map() needs to reflect the mapping > in vm->vpages_mapped. > > While on it, remove unneeded code wraping in vm_vaddr_alloc(). > > Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> > --- > tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index 9889fe0d8919..ad9e15d4c6a9 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -1214,8 +1214,7 @@ vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min) > > virt_pg_map(vm, vaddr, paddr); > > - sparsebit_set(vm->vpages_mapped, > - vaddr >> vm->page_shift); > + sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift); > } > > return vaddr_start; > @@ -1288,6 +1287,8 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, > virt_pg_map(vm, vaddr, paddr); > vaddr += page_size; > paddr += page_size; > + > + sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift); > } > } > > -- > 2.35.3 > Reviewed-by: Andrew Jones <andrew.jones@xxxxxxxxx>