[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f80a561-a338-cdb3-e641-d8803b859ce0@redhat.com>
Date: Wed, 28 Sep 2022 19:29:22 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Emanuele Giuseppe Esposito <eesposit@...hat.com>,
kvm@...r.kernel.org
Cc: Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
David Hildenbrand <david@...hat.com>,
Maxim Levitsky <mlevitsk@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: Re: [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
Powered by blists - more mailing lists