lkml.org 
[lkml]   [2022]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 9/9] kvm_main.c: handle atomic memslot update
On 9/9/22 12:45, Emanuele Giuseppe Esposito wrote:
> @@ -1782,7 +1782,8 @@ static void kvm_update_flags_memslot(struct kvm *kvm,
>
> /*
> * Takes kvm->slots_arch_lock, and releases it only if
> - * invalid_slot allocation or kvm_prepare_memory_region failed.
> + * invalid_slot allocation, kvm_prepare_memory_region failed
> + * or batch->is_move_delete is true.
> */

This _is_ getting out of hand, though. :) It is not clear to me why you
need to do multiple swaps. If you did a single swap, you could do all
the allocations of invalid slots in a separate loop, called with
slots_arch_lock taken and not released until the final swap. In other
words, something like

mutex_lock(&kvm->slots_arch_lock);
r = create_invalid_slots();
if (r < 0)
return r;

replace_old_slots();

// also handles abort on failure
prepare_memory_regions();
if (r < 0)
return r;
swap();
finish_memslots();

where each function is little more than a loop over the corresponding
function called by KVM_SET_MEMORY_REGION.

Paolo

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