lkml.org 
[lkml]   [2022]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC PATCH 9/9] kvm_main.c: handle atomic memslot update
From

On 9/9/2022 6:45 PM, Emanuele Giuseppe Esposito wrote:
> When kvm_vm_ioctl_set_memory_region_list() is invoked, we need
> to make sure that all memslots are updated in the inactive list
> and then swap (preferreably only once) the lists, so that all
> changes are visible immediately.
[...]
> +static int kvm_vm_ioctl_set_memory_region_list(struct kvm *kvm,
> + struct kvm_userspace_memory_region_list *list,
> + struct kvm_userspace_memory_region_entry __user *mem_arg)
> +{
> + struct kvm_userspace_memory_region_entry *mem, *m_iter;
> + struct kvm_userspace_memory_region *mem_region;
> + struct kvm_internal_memory_region_list *batch, *b_iter;
> + int i, r = 0;
> + bool *as_to_swap;
> +
> + /* TODO: limit the number of mem to a max? */
> +
> + if (!list->nent)
> + return r;
> +
> + mem = vmemdup_user(mem_arg, array_size(sizeof(*mem), list->nent));
> + if (IS_ERR(mem)) {
> + r = PTR_ERR(mem);
> + goto out;
> + }

IMO, it's more natural to dup the user memory at the first place, i.e.,
kvm_vm_ioctl,

it also makes the outlets shorter.


[...]

\
 
 \ /
  Last update: 2022-09-13 04:31    [W:0.325 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site