From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Qemu-devel] [PATCH][RFC] Split non-TCG bits out of exec.c Date: Fri, 14 Nov 2008 08:07:32 -0600 Message-ID: <491D8624.50800@codemonkey.ws> References: <1226527840-14183-1-git-send-email-aliguori@us.ibm.com> <20081114040311.GN2055@shareable.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, Carsten Otte , Anthony Liguori , kvm-devel , Hollis Blanchard , Paul Brook To: Jamie Lokier Return-path: Received: from ag-out-0708.google.com ([72.14.246.246]:18391 "EHLO ag-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbYKNOHk (ORCPT ); Fri, 14 Nov 2008 09:07:40 -0500 Received: by ag-out-0708.google.com with SMTP id 31so1402704agc.10 for ; Fri, 14 Nov 2008 06:07:39 -0800 (PST) In-Reply-To: <20081114040311.GN2055@shareable.org> Sender: kvm-owner@vger.kernel.org List-ID: Jamie Lokier wrote: > Also, an earlier thread pointed out that loops doing a lot of MMIO are > _slower_ with KVM than without - this manifested as very slow VGA > output for some guests. Having KVM pass control to TCG for short runs > of guest instructions which do MMIO, or other instructions which need > to be emulated, would accelerate KVM in this respect. > Note, the devil is in the details here. An MMIO exit to userspace typically costs around 6k cycles. On the other hand, a TB translation tends to average closer to 300k often times reaching much higher. This with was with dyngen so TCG may be more or less expensive. An in-kernel MMIO exit on the other hand will cost around 3k cycles. MMIO coalescing is pretty efficient because it effectively reduces the cost of a exit by half. To make up the cost of TCG translation for just one TB, you need to have a tight loop of at least 50 iterations. We can handle rep instructions with a single exit in KVM so this needs to be an actual MMIO loop, not a rep loop. If you also consider all the potential locking issues with SMP guests, I think it's pretty likely that there are few cases where dropping to TCG is going to be a net performance win. Regards, Anthony Liguori > -- Jamie > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >