From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0zIe-0002r1-1v for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:05:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0zIc-0002p5-Kt for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:05:27 -0500 Received: from [199.232.76.173] (port=44497 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0zIc-0002ou-7S for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:05:26 -0500 Received: from mail-gx0-f25.google.com ([209.85.217.25]:65430) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0zIc-0002zy-7u for qemu-devel@nongnu.org; Fri, 14 Nov 2008 09:05:26 -0500 Received: by gxk6 with SMTP id 6so181282gxk.10 for ; Fri, 14 Nov 2008 06:05:25 -0800 (PST) Message-ID: <491D83FF.1090009@codemonkey.ws> Date: Fri, 14 Nov 2008 07:58:23 -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: > Anthony Liguori wrote: > >> Unlike kqemu, KVM does not use TCG at all when accelerating QEMU. Having TCG >> present is not a problem when using KVM on x86. x86 already has TCG host and >> target support and it's quite convenient to be able to disable/enable KVM and >> compare it to TCG when debugging. >> > > I agree with removing/isolating the dependency on TCG, and there are good > reasons for it. > > But does the fact KVM doesn't use TCG prevent KVM from running some > x86 modes correctly? E.g. I gather 16-bit code is run by KVM using > VM86 mode, which is not exactly correct. It would be nice to have KVM > acceleration but also complete and correct emulation, by switching to > TCG for those modes. > That's just a limitation of Intel VT. AMD SVM runs 16-bit code natively. We're slowly improving our in-kernel emulator so eventually we'll be able to emulate 16-bit mode in the kernel. Running 16-bit code in TCG is something that has been considered. > 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. > It falls apart for SMP guests. TCG does not preserve atomicity of memory instructions so you could never have an SMP VCPU running on bare metal while TCG is running. There is a rather large initial cost for building the TBs too so in practice, there are few areas that benefit from this sort of hand off. The VGA optimization actually addresses this problem in a much nicer way. KVM also supports MMIO batching which we'll eventually merge that covers the remaining cases pretty well. 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 >