high use of resource

Bug #1039166 reported by Fabio Marconi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qemu-kvm (Ubuntu)
Expired
High
Unassigned

Bug Description

Hello
Running testdrive with qemu-kvm.
KVM is really slow, the cpu consumption is everytime over the 100% with a simple minimal installation of Ubuntu server.
I'm waiting something about more than an hour to have it installed.
Screenshot attached
Thanks
Fabio

njin@quantic:~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: kvm (not installed)
ProcVersionSignature: Ubuntu 3.5.0-10.10-generic 3.5.1
Uname: Linux 3.5.0-10-generic x86_64
ApportVersion: 2.4-0ubuntu8
Architecture: amd64
Date: Mon Aug 20 20:29:05 2012
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Alpha amd64 (20120525)
KvmCmdLine:
 UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
 njin 10657 10656 59 1020219 1458980 1 18:38 ? 01:06:00 kvm -uuid d8745bd7-1c70-4678-853d-662779c4c967 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-server-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-i5hM9i.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
MachineType: Gigabyte Technology Co., Ltd. H55M-S2H
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.5.0-10-generic root=UUID=d67c1af9-7e7b-4f8a-87b3-ef1574169722 ro quiet splash vt.handoff=7
SourcePackage: qemu-kvm
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 08/20/2010
dmi.bios.vendor: Award Software International, Inc.
dmi.bios.version: F7
dmi.board.name: H55M-S2H
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.board.version: x.x
dmi.chassis.type: 3
dmi.chassis.vendor: Gigabyte Technology Co., Ltd.
dmi.modalias: dmi:bvnAwardSoftwareInternational,Inc.:bvrF7:bd08/20/2010:svnGigabyteTechnologyCo.,Ltd.:pnH55M-S2H:pvr:rvnGigabyteTechnologyCo.,Ltd.:rnH55M-S2H:rvrx.x:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvr:
dmi.product.name: H55M-S2H
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :
description: updated
description: updated
Revision history for this message
Fabio Marconi (fabiomarconi) wrote :
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1039166] Re: high use of resource

Thanks for reporting this bug.

Could you change the cache=writeback to cache=none, and see if that improves
the performance?

Changed in qemu-kvm (Ubuntu):
importance: Undecided → High
status: New → Incomplete
Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hallo
Dunno if I done right, but in testdrive I've added -cache=none to the KVM arguments.
I've tried also to run in terminal but it return an Error -13 when I try to load the iso image.
Thanks
Fabio

Changed in qemu-kvm (Ubuntu):
status: Incomplete → New
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Quoting Fabio Marconi (<email address hidden>):
> Hallo
> Dunno if I done right, but in testdrive I've added -cache=none to the KVM arguments.

Could you then restart the VM and show the result here of:

 ps -ef | grep kvm

> I've tried also to run in terminal but it return an Error -13 when I try to load the iso image.

-13 is -EACCES so you should be able to fix that by doing

 chown njin:njin quantal-server-amd64.iso

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hallo Serge
I've added the cache=none at the kvm testdrive parameters, but seems not affecting the settings:

njin@quantic:~$ ps -ef | grep kvm
root 562 2 0 19:06 ? 00:00:00 [kvm-irqfd-clean]
njin 3533 3496 0 20:34 ? 00:00:00 /bin/sh -c kvm -uuid e75dba4a-1fa8-4ee7-9c67-13c7a0439800 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-desktop-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-2gXmzk.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
njin 3534 3533 99 20:34 ? 00:00:27 kvm -uuid e75dba4a-1fa8-4ee7-9c67-13c7a0439800 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-desktop-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-2gXmzk.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
root 3540 2 0 20:34 ? 00:00:00 [kvm-pit/3534]
njin 3605 3551 0 20:34 pts/1 00:00:00 grep --color=auto kvm

As I'm not an expert in the use of qemu, can you please tell me the command to run a live session in qemu passing the cache=none command ?
Thanks in advance
Fabio
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Quoting Fabio Marconi (<email address hidden>):
> Hallo Serge
> I've added the cache=none at the kvm testdrive parameters, but seems not affecting the settings:
>
> njin@quantic:~$ ps -ef | grep kvm
> root 562 2 0 19:06 ? 00:00:00 [kvm-irqfd-clean]
> njin 3533 3496 0 20:34 ? 00:00:00 /bin/sh -c kvm -uuid e75dba4a-1fa8-4ee7-9c67-13c7a0439800 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-desktop-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-2gXmzk.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
> njin 3534 3533 99 20:34 ? 00:00:27 kvm -uuid e75dba4a-1fa8-4ee7-9c67-13c7a0439800 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-desktop-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-2gXmzk.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
> root 3540 2 0 20:34 ? 00:00:00 [kvm-pit/3534]
> njin 3605 3551 0 20:34 pts/1 00:00:00 grep --color=auto kvm
>
> As I'm not an expert in the use of qemu, can you please tell me the command to run a live session in qemu passing the cache=none command ?
> Thanks in advance

Hm, it looks like this is hardcoded into testdrive. The file
/usr/share/pyshared/testdrive/virt/kvm.py

has:

            cmd = "kvm -m %s -smp %s -cdrom %s -drive file=%s,if=virtio,cache=writeback,index=0,boot=on %s" % (self.MEM, self.SMP, self.PATH_TO_ISO, self.DISK_FILE, self.KVM_ARGS)

(roughly line 67). You would want to change that to:

            cmd = "kvm -m %s -smp %s -cdrom %s -drive file=%s,if=virtio,cache=none,index=0,boot=on %s" % (self.MEM, self.SMP, self.PATH_TO_ISO, self.DISK_FILE, self.KVM_ARGS)

If this works, then we should open a bug against testdrive-common to make that configurable and perhaps change the default.

(Please let me know if you have trouble making this change)

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hallo Serge
Actually, in Quantal, the file is located at:
/usr/lib/python2.7/dist-packages/testdrive/virt/kvm.py
I've done the requested changes, but it won't work.
Looking at attached screenshot seems that I've done things right. If you need something more, just let me know.
Thanks
Fabio
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Just now I'm downloading a new version (just uploaded) of qemu-kvm, hope it fix..
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Fabio,

could you show the 'ps -ef | grep kvm' output with the updated kvm.py file?

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hallo
here it is

njin@quantic:~/Ubuntu$ ps -ef | grep kvm
root 765 2 0 08:31 ? 00:00:00 [kvm-irqfd-clean]
njin 11859 11822 0 19:18 ? 00:00:00 /bin/sh -c kvm -uuid 4b6f3851-59ef-4af0-a8be-ea600aaa78c6 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-desktop-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-pg7Iem.img,if=virtio,cache=none,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
njin 11860 11859 91 19:18 ? 00:00:07 kvm -uuid 4b6f3851-59ef-4af0-a8be-ea600aaa78c6 -m 1024 -smp 4 -cdrom /home/njin/Ubuntu/quantal-desktop-amd64.iso -drive file=/home/njin/.cache/testdrive/img/testdrive-disk-pg7Iem.img,if=virtio,cache=none,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net user -soundhw es1370 -vga cirrus
root 11866 2 0 19:18 ? 00:00:00 [kvm-pit/11860]
njin 11869 11704 0 19:18 pts/3 00:00:00 grep --color=auto kvm

normally it works 50% more than VB, (starting the cd is about170% - 200% and more)

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks Fabio,

Odd, I was sure that would be it. Do you get the same result with precise-desktop?

I'm sorry that I haven't had a chance to reproduce. I'll try to do so this afternoon.

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

yes with precise or win8 same behaviour, seems that there's some particular setting to speedup the guest when something moves, but this makes it jump to over 200%.
Also I'm using a -VT processor i3

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I can't reproduce this on an amd laptop with uptodate quantal, using the
quantal desktop iso for a guest.

I do get about 174% cpu time for kvm while it is starting up and doing
heavy i/o. But when it offers me the choice to try or install ubuntu,
it settles down to 3%. I assume in your case the cpu time stays high
even when the guest is idle, or it never gets to that point?

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Hallo Serge
Sorry I'm doing to much things at the same time forgetting part of this issue.
Yes it reach that point and consumption go down with the cache=none setting (or the upgrade has its influence?), and in this way the machine is really fast.
Do you suggest to revert back to cache=writeback ?
Thanks
fabio

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Quoting Fabio Marconi (<email address hidden>):
> Hallo Serge
> Sorry I'm doing to much things at the same time forgetting part of this issue.
> Yes it reach that point and consumption go down with the cache=none setting (or the upgrade has its influence?), and in this way the machine is really fast.
> Do you suggest to revert back to cache=writeback ?

My test was done with cache=writeback, so it's worth a try.

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Ok, I've done the test and the consumptions go down with writeback too, and also stay on a lower level respect that without writeback.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Hi Fabio,

so then it sounds like it may be working fine. Once the VM is installed, does performance become more tolerable? What sort of backing store do you have - are you using an ecryptfs encrypted home directory? Keeping a KVM backign store in an encrypted home directory could certainly slow things down.

Changed in qemu-kvm (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for qemu-kvm (Ubuntu) because there has been no activity for 60 days.]

Changed in qemu-kvm (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.