qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Disabling KVM "on the fly"


From: Jan Kiszka
Subject: Re: [Qemu-devel] Disabling KVM "on the fly"
Date: Wed, 17 Oct 2012 20:37:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-10-17 18:44, Paolo Bonzini wrote:
> 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),

Unnecessary. Both models (KVM in-kernel and QEMU userspace) are
compatible - in the absence of bugs.

> 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.

-cpu qemu64,-kvmclock should solve that.

You also need -global pc-sysfw.rom_only=1 as KVM does not support write
protected memory areas and creates an "old-style" BIOS region.

But loading a KVM image into TCG lets non-trival guests lock up. Likely
due to differences in the CPU virtualization/emulation (MSRs...). Also,
certain KVM specific CPU states cannot be easily translated into TCG
(and are definitely just ignored in TCG so far).

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]