From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [questions] savevm|loadvm Date: Thu, 01 Apr 2010 11:42:11 +0300 Message-ID: <4BB45C63.3070401@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Wenhao Xu , qemu-devel@nongnu.org, kvm@vger.kernel.org To: Juan Quintela Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On 03/31/2010 02:31 PM, Juan Quintela wrote: > Wenhao Xu wrote: > >> Hi, Juan, >> I am fresh to both QEMU and KVM. But so far, I notice that QEMU >> uses "KVM_SET_USER_MEMORY_REGION" to set memory region that KVM can >> use and uses cpu_register_physical_memory_offset to register the same >> memory to QEMU emulator, which means QEMU and KVM use the same host >> virtual memory. And therefore the memory KVM modified could be >> directly reflected to QEMU. I don't quite understand the different >> memory layout problem between the two. So I don't know exactly what >> you mean to "fix" it? >> > 1st. qemu-kvm.git and qemu.git memory layouts are different, indeed with > qemu.git kvm mode. (yes it is complex and weird). > > kvm vs qemu initialization is different. Expecting to stop kvm, and run > tcg from there is not going to work. I guess it would need a lot of > changes, but I haven't looked at it myself. > I don't think it's so far fetched. In fact early versions of qemu-kvm switched between emulation and virtualization (emulate until 64-bit mode, also emulate mmio instructions in qemu). Even today, all memory initialization is done via generic qemu mechanisms. So long as you synchronize all state (pit, irqchip, registers) you should be fine. >> For why switching is useful? Actually, I am a master student now >> and doing a course project. What am I arguing is that QEMU could be >> potentially useful to do many instrumentation analysis, but it is a >> bit slow. So by combing with KVM, when the os runs to some place where >> we are interested in, switch it to QEMU emulator mode and do the >> analysis and then switch back. >> > idea is good, but I don't think that it is _so_ easy at this point. tcg > and kvm basically live in a different world. Not sure of what needs to > be done to make them back on sync. > cpu_synchronize_state() -- error compiling committee.c: too many arguments to function From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxFyt-0001yG-Mt for qemu-devel@nongnu.org; Thu, 01 Apr 2010 04:42:27 -0400 Received: from [140.186.70.92] (port=44996 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxFys-0001y8-0Y for qemu-devel@nongnu.org; Thu, 01 Apr 2010 04:42:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxFyp-0001XB-Jr for qemu-devel@nongnu.org; Thu, 01 Apr 2010 04:42:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22010) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxFyp-0001Wp-CU for qemu-devel@nongnu.org; Thu, 01 Apr 2010 04:42:23 -0400 Message-ID: <4BB45C63.3070401@redhat.com> Date: Thu, 01 Apr 2010 11:42:11 +0300 From: Avi Kivity MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [questions] savevm|loadvm List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: Wenhao Xu , qemu-devel@nongnu.org, kvm@vger.kernel.org On 03/31/2010 02:31 PM, Juan Quintela wrote: > Wenhao Xu wrote: > >> Hi, Juan, >> I am fresh to both QEMU and KVM. But so far, I notice that QEMU >> uses "KVM_SET_USER_MEMORY_REGION" to set memory region that KVM can >> use and uses cpu_register_physical_memory_offset to register the same >> memory to QEMU emulator, which means QEMU and KVM use the same host >> virtual memory. And therefore the memory KVM modified could be >> directly reflected to QEMU. I don't quite understand the different >> memory layout problem between the two. So I don't know exactly what >> you mean to "fix" it? >> > 1st. qemu-kvm.git and qemu.git memory layouts are different, indeed with > qemu.git kvm mode. (yes it is complex and weird). > > kvm vs qemu initialization is different. Expecting to stop kvm, and run > tcg from there is not going to work. I guess it would need a lot of > changes, but I haven't looked at it myself. > I don't think it's so far fetched. In fact early versions of qemu-kvm switched between emulation and virtualization (emulate until 64-bit mode, also emulate mmio instructions in qemu). Even today, all memory initialization is done via generic qemu mechanisms. So long as you synchronize all state (pit, irqchip, registers) you should be fine. >> For why switching is useful? Actually, I am a master student now >> and doing a course project. What am I arguing is that QEMU could be >> potentially useful to do many instrumentation analysis, but it is a >> bit slow. So by combing with KVM, when the os runs to some place where >> we are interested in, switch it to QEMU emulator mode and do the >> analysis and then switch back. >> > idea is good, but I don't think that it is _so_ easy at this point. tcg > and kvm basically live in a different world. Not sure of what needs to > be done to make them back on sync. > cpu_synchronize_state() -- error compiling committee.c: too many arguments to function