From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOWjp-0000Is-Jp for qemu-devel@nongnu.org; Wed, 17 Oct 2012 12:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOWjo-00018r-Hs for qemu-devel@nongnu.org; Wed, 17 Oct 2012 12:44:57 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:36892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOWjo-00018j-BE for qemu-devel@nongnu.org; Wed, 17 Oct 2012 12:44:56 -0400 Received: by mail-we0-f173.google.com with SMTP id t11so4529447wey.4 for ; Wed, 17 Oct 2012 09:44:55 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <507EE07E.20504@redhat.com> Date: Wed, 17 Oct 2012 18:44:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Disabling KVM "on the fly" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Clemens Kolbitsch Cc: qemu-devel@nongnu.org Il 17/10/2012 18:37, Clemens Kolbitsch ha scritto: > Guys, > > I know this is question might seem a bit odd, but I'm curious: > > Has anyone ever tried to write code to disable KVM on the fly / is it > at all possible? I have a situation where I need to use TCG for > certain parts of the code, but would love to have acceleration for > everything else. My idea was to pause the VM, then use the > snapshotting mechanism to dump the state, and then to resume the > snapshot, but writing the KVM state into the non-KVM structures. As a start, you can try using "migrate exec:cat>foo.save" with a KVM machine and "-incoming 'exec:cat foo.save'" with a TCG machine. The main problem should be that TCG doesn't implement kvmclock. If you disable the KVM interrupt controller and timer (which is just an implementation detail, not a hardware difference), the differences between KVM and TCG are just that KVM doesn't initialize some TCG-only data structure, and that KVM uses many CPU threads; TCG uses one that goes through CPUs round-robin. The CPU threads of course execute different code. So no, in theory there is nothing that prevents this from working in principle, except for kvmclock. Paolo > I know nothing of that sort is implemented at this point. Leaving > aside the issue of certain CPUID instructions suddenly returning > different results, are there obvious problems even trying to go down > that road? > > Would love to hear some thoughts on this - don't hesitate to tell me > "that's stupid and impossible because XYZ" (assuming you also fill in > the blanks ;) ) > > Thanks! > Clemens >