Re: [PATCH v9 02/19] KVM: selftests: Allocate pgd in virt_map() as necessary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sagi Shahar wrote:
> If virt_map() is called before any call to ____vm_vaddr_alloc() it
> will create the mapping using an invalid pgd.
> 
> Add call to virt_pgd_alloc() as part of virt_map() before creating the
> mapping, similarly to ____vm_vaddr_alloc()
> 
> Signed-off-by: Sagi Shahar <sagis@xxxxxxxxxx>

Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>

> ---
>  tools/testing/selftests/kvm/lib/kvm_util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index c3f5142b0a54..b4c8702ba4bd 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -1609,6 +1609,7 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr,
>  	TEST_ASSERT(vaddr + size > vaddr, "Vaddr overflow");
>  	TEST_ASSERT(paddr + size > paddr, "Paddr overflow");
>  
> +	virt_pgd_alloc(vm);
>  	while (npages--) {
>  		virt_pg_map(vm, vaddr, paddr);
>  		sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift);
> -- 
> 2.51.0.rc1.193.gad69d77794-goog
> 






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux