lkml.org 
[lkml]   [2007]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [kvm-devel] [PATCH 27/50] KVM: Support assigning userspace memory to the guest
Avi Kivity wrote:
> From: Izik Eidus <izike@qumranet.com>
>
> Instead of having the kernel allocate memory to the guest, let userspace
> allocate it and pass the address to the kernel.
>
> This is required for s390 support, but also enables features like memory
> sharing and using hugetlbfs backed memory.
>
>

[...]

> @@ -728,11 +752,27 @@ static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
>
> memset(new.phys_mem, 0, npages * sizeof(struct page *));
> memset(new.rmap, 0, npages * sizeof(*new.rmap));
> - for (i = 0; i < npages; ++i) {
> - new.phys_mem[i] = alloc_page(GFP_HIGHUSER
> - | __GFP_ZERO);
> - if (!new.phys_mem[i])
> + if (user_alloc) {
> + unsigned long pages_num;
> +
> + new.user_alloc = 1;
> + down_read(&current->mm->mmap_sem);
> +
> + pages_num = get_user_pages(current, current->mm,
> + mem->userspace_addr,
> + npages, 1, 0, new.phys_mem,
> + NULL);
> +
>

I just combined a patch that changes the 'force' parameter to
get_user_pages from 0 to 1, into this patch, to avoid introducing a bug
and its fix in the same patchset. I won't be resending this patch since
the change is too trivial. Same change applies to patch 48, "KVM: MMU:
Partial swapping of guest memory".

--
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2007-12-23 19:19    [W:0.228 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site