Re: [PATCH v5 15/19] KVM: Provide common implementation for generic dirty log functions

From: Peter Xu
Date: Thu Feb 06 2020 - 16:24:46 EST


On Tue, Jan 21, 2020 at 02:31:53PM -0800, Sean Christopherson wrote:

[...]

> @@ -1333,6 +1369,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
> unsigned long i, n;
> unsigned long *dirty_bitmap;
> unsigned long *dirty_bitmap_buffer;
> + bool flush;
>
> as_id = log->slot >> 16;
> id = (u16)log->slot;
> @@ -1356,7 +1393,9 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
> (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
> return -EINVAL;
>
> - *flush = false;
> + kvm_arch_sync_dirty_log(kvm, memslot);

Do we need this even for clear dirty log?

> +
> + flush = false;
> dirty_bitmap_buffer = kvm_second_dirty_bitmap(memslot);
> if (copy_from_user(dirty_bitmap_buffer, log->dirty_bitmap, n))
> return -EFAULT;

--
Peter Xu