Re: [PATCH v2 09/15] KVM: Move memslot deletion to helper function

From: Christoffer Dall
Date: Wed Oct 23 2019 - 05:29:46 EST


Hi Sean,

On Mon, Oct 21, 2019 at 05:35:31PM -0700, Sean Christopherson wrote:
> Move memslot deletion into its own routine so that the success path for
> other memslot updates does not need to use kvm_free_memslot(), i.e. can
> explicitly destroy the dirty bitmap when necessary. This paves the way
> for dropping @dont from kvm_free_memslot(), i.e. all callers now pass
> NULL for @dont.
>
> Add a comment above the code to make a copy of the existing memslot
> prior to deletion, it is not at all obvious that the pointer will become
> stale due sorting and/or installation of new memslots.

nit: due to / during

>
> Note, kvm_arch_commit_memory_region() allows an architecture to free
> resources when moving a memslot or changing its flags, i.e. implement
> logic similar to the dirty bitmap is handling, if such functionality is

nit: s/is handling/handling/

> needed in the future.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>

Otherwise looks good to me.

Acked-by: Christoffer Dall <christoffer.dall@xxxxxxx>