From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Scheduling of VCPUs and allocation of Guest Physical Memory Date: Mon, 09 Jun 2008 19:19:20 +0300 Message-ID: <484D5808.9010907@qumranet.com> References: <484795C3.8030603@cse.iitb.ac.in> <4847E205.4060605@codemonkey.ws> <4849483A.3030709@cse.iitb.ac.in> <48494C67.5090406@codemonkey.ws> <484D0F8F.4010807@cse.iitb.ac.in> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Sukanto Ghosh Return-path: Received: from il.qumranet.com ([212.179.150.194]:15112 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756086AbYFIQTO (ORCPT ); Mon, 9 Jun 2008 12:19:14 -0400 In-Reply-To: <484D0F8F.4010807@cse.iitb.ac.in> Sender: kvm-owner@vger.kernel.org List-ID: Sukanto Ghosh wrote: >> >> Yes, the guest has a different address space from the host. The QEMU >> process malloc()'s the physical memory for the guest, and tells KVM >> what the region is (via an ioctl to /dev/kvm). > > > Why does the QEMU process needs to malloc() the physical memory for > the guest ? Why can't it be done by the kernel itself ? Is it because > the said pages will be sharable between the QEMU process and the > guest, which will aid the QEMU process while performing DMA. > Userspace allocation is done in order to allow flexibility in how memory is allocated. Userspace can choose to allocate large pages, apply a numa policy to the memory, mlock() it, etc. It also makes swapping simple, as Linux already knows how to swap userspace memory. Also, s390 has to do it this way. > > > Also, when and how are host-initiated virtual interrupts delivered? I > guess, that it is done at the time of VM-entry. Yes. > But what about the interrupts that need to be delivered immediately > and while the VM is executing (assume interrupts are enabled in the > guest). Is any kind of signal-based mechanism employed to force a > VM-exit ? > Sending a signal to a task that is executing guest code will force it to exit to userspace immediately. The in-kernel interrupt controller emulation also forces guest exits by sending inter-processor interrupts. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.