Tracing KVM with Systemtap

Stefan Hajnoczi stefanha@gmail.com
Wed Sep 22 12:33:00 GMT 2010


On Wed, Sep 22, 2010 at 1:11 PM, Rayson Ho <rho@redhat.com> wrote:
> On Tue, 2010-09-21 at 14:33 +0100, Stefan Hajnoczi wrote:
>> > I will see what other probes are useful for the end users. Also, are
>> > there developer documentations for KVM? (I googled but found a lot of
>> > presentations about KVM but not a lot of info about the internals.)
>>
>> Not really.  I suggest grabbing the source and following vl.c:main()
>> to the main KVM execution code.
>
> I was looking for the hardware interfacing code earlier this morning --
> QEMU has the hardware specific directories (e.g. target-i386/ ,
> target-ppc/ ), and I was trying to understand the execution environment
> when the host and guest are running on the same architecture.
>
> I believe cpu_gen_code() and other related functions are what I should
> dig into...

KVM does not generate code.  Almost all the "emulation" code in the
source tree is part of the Tiny Code Generator (TCG) used when KVM is
not enabled (e.g. to emulate an ARM board on an x86-64 host).

If you follow the life-cycle in vl.c it will take you through cpus.c
and into kvm-all.c:kvm_cpu_exec().  Note that the details differ
slightly between qemu.git and qemu-kvm.git, and I have described
qemu.git.

Stefan



More information about the Systemtap mailing list