From: Ian Jackson Subject: Re: [Qemu-devel] Re: [PATCH] hook cpu running at a higher level. Date: Tue, 30 Dec 2008 17:25:17 +0000 Message-ID: <18778.22909.18515.419986@mariner.uk.xensource.com> References: <1230575362-14485-1-git-send-email-glommer@redhat.com> <18777.63215.125693.799799@mariner.uk.xensource.com> <5d6222a80812300335kacdf330pfe4a51e59e0e203e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Glauber Costa , avi@redhat.com, kvm@vger.kernel.org, stefano.stabellini@eu.citrix.com To: qemu-devel@nongnu.org Return-path: Received: from smtp02.citrix.com ([66.165.176.63]:11901 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752135AbYL3RZV (ORCPT ); Tue, 30 Dec 2008 12:25:21 -0500 In-Reply-To: <5d6222a80812300335kacdf330pfe4a51e59e0e203e@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Glauber Costa writes ("Re: [Qemu-devel] Re: [PATCH] hook cpu running at a higher level."): > On Tue, Dec 30, 2008 at 8:24 AM, Ian Jackson > > The Xen qemu process runs only in one thread which is fine because it > > doesn't need to be involved with actual processor execution. In > > theory parallel execution (in different threads and thus on different > > physical cpus) of IO emulations requested by different guest vcpus > > might make some small performance difference but I doubt it would be > > worth our while. So I think the Xen setup will still from qemu's > > point of view look like a single vcpu no matter how many vcpus the > > guest aactually has. > > Is it one vcpu or various in lockstep ? If you have only one vcpu, > your main loop can be even simpler than qemu's, which holds them all > in a for loop. Whether it's one vcpu or several depends how you think about it. The guest and Xen see several vcpus, which execute (without any involvement from qemu) on the various physical cpus according to the Xen hypervisor's scheduler. qemu only sees one vcpu object which appears to generate all of the IO requests. Our main loop is really just read io request from magic fd call cpu_something_rw which eventually calls appropriate io emulation send response to io request (ack or any data `read') back to magic fd so yes it is very simple. Execution of the guest's vcpus happens asynchronously (from qemu's point of view) until they need to do IO; then the hypervisor passes the request to qemu and stops the vcpu (by not scheduling it) until it gets a response from qemu. While no IO requests are being processed, qemu sleeps. Ian.