qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Clemens Kolbitsch <kolbitsch@lastline.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Disabling KVM "on the fly"
Date: Wed, 17 Oct 2012 18:44:46 +0200	[thread overview]
Message-ID: <507EE07E.20504@redhat.com> (raw)
In-Reply-To: <CAN+VXVPPkWP+Ocm57PnNhnpGNbWyOPEZ5dpqK85P-vyx9w3-dw@mail.gmail.com>

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
> 

  reply	other threads:[~2012-10-17 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 16:37 [Qemu-devel] Disabling KVM "on the fly" Clemens Kolbitsch
2012-10-17 16:44 ` Paolo Bonzini [this message]
2012-10-17 18:37   ` Jan Kiszka
2012-10-18  6:29     ` Paolo Bonzini
2012-10-18 17:24       ` Jan Kiszka
2012-10-18 17:38         ` Clemens Kolbitsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=507EE07E.20504@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kolbitsch@lastline.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).