Re: [PATCH 0/7] KVM: Alleviate mmu_lock hold time when we startdirty logging

From: Takuya Yoshikawa
Date: Thu Dec 20 2012 - 09:35:43 EST

On Thu, 20 Dec 2012 06:41:27 -0700
Alex Williamson <alex.williamson@xxxxxxxxxx> wrote:

> Hmm, isn't the fix as simple as:
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -847,7 +847,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
> if (!slots)
> goto out_free;
> - }
> + } else
> + slots->generation = kvm->memslots->generation;
> /* map new memory slot into the iommu */
> if (npages) {
> Or even just slots->generation++ since we're holding the lock across all
> of this.

Yes, the fix should work, but I do not want to update the
generation from outside of update_memslots().

> The original patch can be reverted, there are no following dependencies,
> but the idea was that we're making the memslot array larger, so there
> could be more pressure in allocating it, so let's not trivially do extra
> frees and allocs. Thanks,

I agree that the current set_memory_region() is not good for frequent updates.
But the alloc/free is not a major factor at the moment: flushing shadows should
be more problematic.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at