Re: [PATCH 2/6] KVM: Dirty memory tracking for performant checkpointing and improved live migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/28/2016 7:47 PM, Huang, Kai wrote:
> 
>>>>
>>>> +static u64 kvm_get_max_gfn(struct kvm *kvm)
>>>> +{
>>>> +	int num_gfn = -1;
>>>> +	struct kvm_memslots *slots = kvm_memslots(kvm);
>>>> +	struct kvm_memory_slot *memslot;
>>>> +	int gfn;
>>>> +
>>>> +	kvm_for_each_memslot(memslot, slots) {
>>>> +		gfn = memslot->base_gfn + memslot->npages;
>>>> +		if (gfn > num_gfn)
>>>> +			num_gfn = gfn;
>>>> +	}
>>>> +	return num_gfn - 1;
>>>> +}
>>>
>>> This might be wrong if there are devices assigned to the guest, as each
>>> assigned resource also occupies a memory slot. I assume you don't want
>>> to monitor assigned resources, do you?
>>
>> max gfn is only used for sanity check. When we are told to mark a page dirty,
>> or to reset the write trap for a page, we make sure that the gfn is valid.
>>
> 
> When you were saying 'sanity check', I think you were meaning 'sanity 
> check' whether the gfn is guest memory, from which point your above code 
> might get a much *bigger* max_gfn than real one, as I explained above, 
> which basically makes your 'sanity check' meaningless, therefore you can 
> probably remove this code.
> 
> Btw 'gfn is valid' is very vague as gfn for assigned resource is 
> certainly valid as well.
> 
> Thanks,
> -Kai
> 

Good point. Will fix that.

Thanks for your feedback, Kai.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux