2
votes

I'm running qemu which emulates x86_64 processor on top of x86 host machine, and I'm interesting in achieving the following:

1) better execution time, so KVM is a better way to achieve that, as the guest and host machines share the same architecture.

2) counting the number of instruction generated by the guest machine(qemu), and virtual clock (-icount option) achieved that

I was trying to run the qemu including both kvm & icount options (-enable-kvm -icount 0) and I got this message "-icount is not allowed with kvm or xen"

is it possible to run the qemu including both options? thanks .

1
If you want to look at things like number of instructions executed in a KVM VM you should be looking at the hardware performance counters via perf, I think. - Peter Maydell
I'm interesting in using the instructions counter as a reference for the kernel time ( e.g executing X guest instruction is equivalent to 1 second ) - Adnan Zubaidi
Number of instructions executed per second will depend on what the instructions are, whether that's KVM or TCG, so it doesn't make much sense to use it as a time reference. In any case, as PaulR says icount is purely a TCG thing. - Peter Maydell

1 Answers

3
votes

As far as I know from reading the source code and debugging QEMU, -icount works by adding code to count the instructions and decrease a counter after every basic block translated by TCG, utilizing a small check at the beginning of each basic block to interrupt execution after each N guest instructions.

This approach cannot work with kvm or xen, as there is no code translation performed in this case that could add the additional instrumentation. So no, this is not possible, without a signficant change to QEMU.