* Get a vm fd using kvm API's ioctls
@ 2014-02-05 16:30 Vincent KHERBACHE
2014-02-05 16:52 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Vincent KHERBACHE @ 2014-02-05 16:30 UTC (permalink / raw)
To: kvm
Hi all,
I'm trying to get the dirty bitmap of a specific VM, using
KVM_GET_DIRTY_LOG ioctl.
For this purpose, I should be able to get the file descriptor of an
existing VM by doing something like :
kvm_fd = open("/dev/kvm")
...
b = ioctl(KVM_GET_DIRTY_LOG, vm_fd)
I also can see, from the API documentation
(https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt), that
there is the following restriction concerning VM ioctls :
"Only run VM ioctls from the same process (address space) that was used
to create the VM."
Is there a way to get the fd of a running VM (created from an other
process), or maybe a better/easier manner to get the dirty bitmap ?
Any help would be welcome.
Thanks,
--
Vincent KHERBACHE
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Get a vm fd using kvm API's ioctls
2014-02-05 16:30 Get a vm fd using kvm API's ioctls Vincent KHERBACHE
@ 2014-02-05 16:52 ` Paolo Bonzini
2014-02-05 17:17 ` Vincent KHERBACHE
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2014-02-05 16:52 UTC (permalink / raw)
To: Vincent KHERBACHE, kvm
Il 05/02/2014 17:30, Vincent KHERBACHE ha scritto:
> Hi all,
>
> I'm trying to get the dirty bitmap of a specific VM, using
> KVM_GET_DIRTY_LOG ioctl.
>
> For this purpose, I should be able to get the file descriptor of an
> existing VM by doing something like :
>
> kvm_fd = open("/dev/kvm")
> ...
> b = ioctl(KVM_GET_DIRTY_LOG, vm_fd)
>
>
> I also can see, from the API documentation
> (https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt), that
> there is the following restriction concerning VM ioctls :
>
> "Only run VM ioctls from the same process (address space) that was used
> to create the VM."
>
>
> Is there a way to get the fd of a running VM (created from an other
> process), or maybe a better/easier manner to get the dirty bitmap ?
You can get ask the other process to retrieve the dirty bitmap and place
it in a shared memory segment.
However, note that KVM_GET_DIRTY_LOG retrieves _and clears_ the dirty
bitmap. So if the "owner" of the running VM is already using the dirty
bitmap, calling KVM_GET_DIRTY_LOG will likely break that usage.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Get a vm fd using kvm API's ioctls
2014-02-05 16:52 ` Paolo Bonzini
@ 2014-02-05 17:17 ` Vincent KHERBACHE
2014-02-05 17:19 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Vincent KHERBACHE @ 2014-02-05 17:17 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
Le 05/02/2014 17:52, Paolo Bonzini a écrit :
> Il 05/02/2014 17:30, Vincent KHERBACHE ha scritto:
>> Hi all,
>>
>> I'm trying to get the dirty bitmap of a specific VM, using
>> KVM_GET_DIRTY_LOG ioctl.
>>
>> For this purpose, I should be able to get the file descriptor of an
>> existing VM by doing something like :
>>
>> kvm_fd = open("/dev/kvm")
>> ...
>> b = ioctl(KVM_GET_DIRTY_LOG, vm_fd)
>>
>>
>> I also can see, from the API documentation
>> (https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt), that
>> there is the following restriction concerning VM ioctls :
>>
>> "Only run VM ioctls from the same process (address space) that was used
>> to create the VM."
>>
>>
>> Is there a way to get the fd of a running VM (created from an other
>> process), or maybe a better/easier manner to get the dirty bitmap ?
>
> You can get ask the other process to retrieve the dirty bitmap and place
> it in a shared memory segment.
>
> However, note that KVM_GET_DIRTY_LOG retrieves _and clears_ the dirty
> bitmap. So if the "owner" of the running VM is already using the dirty
> bitmap, calling KVM_GET_DIRTY_LOG will likely break that usage.
Thank you for your reply !
I take note of your remark about the bitmap clearing, it could be an
effective issue.
But I really have no idea of how can I 'ask' something the other process ?
Regards.
--
Vincent KHERBACHE
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Get a vm fd using kvm API's ioctls
2014-02-05 17:17 ` Vincent KHERBACHE
@ 2014-02-05 17:19 ` Paolo Bonzini
2014-02-05 18:46 ` Vincent KHERBACHE
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2014-02-05 17:19 UTC (permalink / raw)
To: Vincent KHERBACHE; +Cc: kvm
Il 05/02/2014 18:17, Vincent KHERBACHE ha scritto:
> Thank you for your reply !
>
> I take note of your remark about the bitmap clearing, it could be an
> effective issue.
>
> But I really have no idea of how can I 'ask' something the other process ?
You modify the source code for that program. :) It's likely QEMU or
kvmtool, in either case it's free software. :)
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Get a vm fd using kvm API's ioctls
2014-02-05 17:19 ` Paolo Bonzini
@ 2014-02-05 18:46 ` Vincent KHERBACHE
0 siblings, 0 replies; 5+ messages in thread
From: Vincent KHERBACHE @ 2014-02-05 18:46 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
Ok this is what I feared, modifying Qemu is the only way to get the dirty bitmap from a VM launched by a Qemu process..
Ans this is definitely what I will do. Thanks again for your help !
Paolo Bonzini <pbonzini@redhat.com> a écrit :
>Il 05/02/2014 18:17, Vincent KHERBACHE ha scritto:
>> Thank you for your reply !
>>
>> I take note of your remark about the bitmap clearing, it could be an
>> effective issue.
>>
>> But I really have no idea of how can I 'ask' something the other
>process ?
>
>You modify the source code for that program. :) It's likely QEMU or
>kvmtool, in either case it's free software. :)
>
>Paolo
--
Vincent KHERBACHE
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-05 18:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-05 16:30 Get a vm fd using kvm API's ioctls Vincent KHERBACHE
2014-02-05 16:52 ` Paolo Bonzini
2014-02-05 17:17 ` Vincent KHERBACHE
2014-02-05 17:19 ` Paolo Bonzini
2014-02-05 18:46 ` Vincent KHERBACHE
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox