Re: kvm memslot questions

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

 



thank you very very much!
1、
I want to alloc VM memory in KVM ,not installing anything in VM,and  I
want to write data to that memory then let VM use it! So in order to
know which memory is not used by VM,I need check the bitmap,but at
first,I found the dirty_bitmap of slot I want to use is NULL,so I have
to set KVM_MEM_LOG_DIRTY_PAGES flags in KVM matually.
2、
And I have another question,the function in KVM to set dirty_bitmap call
static inline void set_bit_le(int nr, void *addr)
{
set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}

when test the bit,I do not know if I should use BITOP_LE_SWIZZLE,It
seems that that right without SWIZZLE.




2016-12-12 23:17 GMT+08:00 Radim Krčmář <rkrcmar@xxxxxxxxxx>:
> 2016-12-12 17:18+0800, jack.chen:
>> hello,now I want to know which GFN of VM  is available,so I set
>> kvm_userspace_mem->flags |= 0x1; in kvm_vm_ioctl function ,so KVM can
>> create dirty_bitmap for slots
>
> The caller of KVM_SET_USER_MEMORY_REGION knows which GFNs are
> "available", because it configures that into
> kvm_userspace_mem->guest_phys_addr and kvm_userspace_mem->size.
>
> KVM knows which GFNs are "available", because it remembers all memory
> regions that were configured.
>
>> case KVM_SET_USER_MEMORY_REGION: {
>> struct kvm_userspace_memory_region kvm_userspace_mem;
>>
>> ……
>> kvm_userspace_mem->flags |= 0x1;
>
> Why do you want to use the dirty page bitmap in KVM?
>
>> r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem);
>> break;
>>
>> and I have 2 questions:
>> 1.
>> if corresponding bit is setted,the GFN is used by VM,other than it is
>> available!right?
>
> The GFN is always available.
> If the corresponding bit in dirty log is set, then the GFN was modified
> since userspace did the last KVM_GET_DIRTY_LOG ioctl.
>
>> 2、
>> how to check wheather the bit is 1 or not,the test_bit function
>> returns -1 to me,I do not know if I use wrong function!
>> thanks in advance!!!
>
> test_bit() from arch/x86/include/asm/bitops.h returns bool so there is
> something wrong with your test_bit().
>
> In any case, see kvm_vm_ioctl_get_dirty_log() for what is needed to
> access the dirty log.
--
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