qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Linux CPU accouting with kqemu


From: Laurent Vivier
Subject: Re: [Qemu-devel] Linux CPU accouting with kqemu
Date: Fri, 6 Jun 2008 20:59:52 +0200


Le 6 juin 08 à 19:57, Steve Fosdick a écrit :

I have noticed that the Linux system CPU usage seems remarkably high
when running Windows XP as a guest under qemu/kqemu, but not when
running under qemu without kqemu.

Just today I was reading the kqemu API documentation and it occurred to
be that from the Linux perspective the user/system CPU times may be
backward with kqemu.

Is it perhaps the case that when kqemu has been told to run code in the
guest VM (KQEMU_EXEC ioctl) and this is happenning without any
exceptions (more likely when the guest is running user-mode code rather
than OS code) Linux still sees this as running in the kernel and
records it as "system" time but when kqemu returns to qemu (because of
an exception) the Linux kernel now sees this as user CPU time when in
all likelihood the guest OS is now executing somewhere it it's kernel?

If kqemu works like KVM, it is the case.

I've made some modifications for KVM in the linux kernel to account this time to user time and to a new field called guest time.
To use this, kqemu should be modified in the same way:

add "current->flags |= PF_VCPU;"
when entering in the guest code and 
"current->flags &= ~PF_VCPU;" when exiting.

The patch for kvm is here:


You can have details with the patch submission thread:



Regards,
Laurent
----------------------- Laurent Vivier ----------------------
"The best way to predict the future is to invent it."
- Alan Kay






reply via email to

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