From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Get a vm fd using kvm API's ioctls Date: Wed, 05 Feb 2014 17:52:39 +0100 Message-ID: <52F26C57.5080409@redhat.com> References: <52F2671D.2010704@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit To: Vincent KHERBACHE , kvm@vger.kernel.org Return-path: Received: from mail-qc0-f179.google.com ([209.85.216.179]:42500 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752681AbaBEQwn (ORCPT ); Wed, 5 Feb 2014 11:52:43 -0500 Received: by mail-qc0-f179.google.com with SMTP id e16so1052938qcx.24 for ; Wed, 05 Feb 2014 08:52:42 -0800 (PST) In-Reply-To: <52F2671D.2010704@inria.fr> Sender: kvm-owner@vger.kernel.org List-ID: 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