Hi,
i'm developing a custom kernel for x86 platform.So Far i used as virtual
environment Simics.
Recently i decided to move to Qemu.
Running my kernel on Qemu I found it tremendously slow even with KVM
enabled.

Here a little example:

     #include "lib/lib.h"

     main()
     {
         int i=0;
         for (i=0;i<=900000;i++)
         {
               printf("num=%d \n",i);
         }
        exit(0);
}

In this code printf uses a custom simple system call that switch the kernel
in ring mode and writes a string in the text screen video memory at 0xB8000.
Performace are awful in Qemu even with KVM support.

With Simics performance are very close to real hardware.

Some number:
Running code under Linux on real hardware 30 sescs
Running code under my os with qemu with no kvm 4 min
Running code under my os with qemu+kmv 60 minites.

This is my Qemu launch string with KVM:
./qemu-system-x86_64 -enable-kvm -m 1000M -hda
/home/peppe/Scrivania/disk.img

KVM module is loaded:
lsmod | grep kvm
kvm_intel 142999 0
kvm 444314 1 kvm_intel

To double check my virtualization environment i loaded a Fedora 13 live
image with Qemu + KVM and all is worked as expected.

MY Question is:
Why my code is so slow under KVM?
Need i to perform a special tuning on KVM?
Is KVM SUTED to run custom kernel like mine?

In this example i suppose KVM needs to perform some special trap in order
to access to text memory video.
Just because this is a unusual path is it perhaps not optimized?

Regards,
Giuseppe.

Reply via email to