From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0zKo-0003gK-70 for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:07:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0zKn-0003g7-C1 for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:07:41 -0500 Received: from [199.232.76.173] (port=54136 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0zKn-0003g4-6v for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:07:41 -0500 Received: from ag-out-0708.google.com ([72.14.246.251]:38909) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0zKn-0003Pb-8L for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:07:41 -0500 Received: by ag-out-0708.google.com with SMTP id 31so1395768agc.5 for ; Fri, 14 Nov 2008 06:07:39 -0800 (PST) Message-ID: <491D8624.50800@codemonkey.ws> Date: Fri, 14 Nov 2008 08:07:32 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH][RFC] Split non-TCG bits out of exec.c References: <1226527840-14183-1-git-send-email-aliguori@us.ibm.com> <20081114040311.GN2055@shareable.org> In-Reply-To: <20081114040311.GN2055@shareable.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: Carsten Otte , Anthony Liguori , Hollis Blanchard , kvm-devel , qemu-devel@nongnu.org, Paul Brook 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 >