Skip to contentSkip to conversation

qemu-kvm faster that qemu?

Qemu-devel walt 6 participants 14 messages Aug 25, 2010 – Aug 29, 2010

lore
Share & tools
lore

walt

author
#0 lore raw

Hi qemu team,

I just discovered that qemu now offers kvm support, so I decided to compare it to qemu-kvm.

I'm running the latest git versions of both programs on an AMD64 host running the latest kernel from Linus.git.

The guest is Windows 7 on a qcow2 disk image and one kvm64 cpu.

Using the same qcow2 image for both qemu and qemu-kvm, I find that qemu-kvm boots to the Win7 login prompt in 25 seconds, but qemu with kvm enabled takes about 45 seconds.

Is this an expected outcome, or must I be doing something wrong with qemu?

BTW, I tried reverting the qcow2 patch being discussed in another thread but it made no difference. Perhaps there's not much writing to disk during bootup?

Thanks!

#1 lore raw
Quoted 5 lines · walt

Hi qemu team,

I just discovered that qemu now offers kvm support, so I decided to compare it to qemu-kvm.

Quoted 8 lines

I'm running the latest git versions of both programs on an AMD64 host running the latest kernel from Linus.git.

The guest is Windows 7 on a qcow2 disk image and one kvm64 cpu.

Using the same qcow2 image for both qemu and qemu-kvm, I find that qemu-kvm boots to the Win7 login prompt in 25 seconds, but qemu with kvm enabled takes about 45 seconds.

make sure you build qemu with --enable-io-thread. Also, what's your full command line?

Regards,

Anthony Liguori

Quoted 14 lines

Is this an expected outcome, or must I be doing something wrong with qemu?

BTW, I tried reverting the qcow2 patch being discussed in another thread but it made no difference. Perhaps there's not much writing to disk during bootup?

Thanks!

author
#2 lore raw

[Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 9 lines · Anthony Liguori
Quoted 8 lines · walt

Hi qemu team,

I just discovered that qemu now offers kvm support, so I decided to compare it to qemu-kvm.

I'm running the latest git versions of both programs on an AMD64 host running the latest kernel from Linus.git.

Quoted 7 lines
Quoted 4 lines

The guest is Windows 7 on a qcow2 disk image and one kvm64 cpu.

I find that qemu-kvm boots to the Win7 login prompt in 25 seconds, while qemu with kvm enabled takes about 45 seconds.

make sure you build qemu with --enable-io-thread.

I built qemu both with and without io-thread, and it makes no difference at least in this particular experiment.

(BTW, I found that qemu-kvm will not even compile with --enable-io-thread because qemu_mutex_lock_iothread becomes defined in two places.)

Quoted 1 line

Also, what's your full command line?

For qemu:
/usr/local/bin/qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 w7.diff

For qemu-kvm:
/home/wa1ter/bin/qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 w7.diff

Note that w7.diff is the same file in both cases: a qcow2 differencing disk made from the original qcow2 backing file w7.img.

Thanks for your reply. I'm curious if anyone can reproduce this difference in speed.

#3 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 24 lines · walt
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · walt

Hi qemu team,

I just discovered that qemu now offers kvm support, so I decided to compare it to qemu-kvm.

I'm running the latest git versions of both programs on an AMD64 host running the latest kernel from Linus.git.

Quoted 7 lines
Quoted 4 lines

The guest is Windows 7 on a qcow2 disk image and one kvm64 cpu.

I find that qemu-kvm boots to the Win7 login prompt in 25 seconds, while qemu with kvm enabled takes about 45 seconds.

make sure you build qemu with --enable-io-thread.

I built qemu both with and without io-thread, and it makes no difference at least in this particular experiment.

(BTW, I found that qemu-kvm will not even compile with --enable-io-thread because qemu_mutex_lock_iothread becomes defined in two places.)

Quoted 7 lines
Quoted 1 line

Also, what's your full command line?

For qemu:
/usr/local/bin/qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 w7.diff

For qemu-kvm:
/home/wa1ter/bin/qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 w7.diff

You'll get more accurate and repeatable results by using:

qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 -drive file=w7.diff,cache=none

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Regards,

Anthony Liguori

Quoted 8 lines

Note that w7.diff is the same file in both cases: a qcow2 differencing disk made from the original qcow2 backing file w7.img.

Thanks for your reply. I'm curious if anyone can reproduce this difference in speed.

#4 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Hi,

Quoted 3 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Didn't try win7, but for winxp it is a *huge* difference.

cheers,
Gerd

#5 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Didn't try win7, but for winxp it is a *huge* difference.

On which HW? My guess is this is because of tpr patching.

--
Gleb.

#6 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 10 lines · Gleb Natapov
Quoted 8 lines · Gerd Hoffmann
   Hi,
Quoted 3 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Didn't try win7, but for winxp it is a *huge* difference.

On which HW?

Intel without ept. It's a Lenovo T500.

Quoted 1 line

My guess is this is because of tpr patching.

Most like, yes.

cheers,
Gerd

#7 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Gleb Natapov
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Didn't try win7, but for winxp it is a *huge* difference.

Quoted 7 lines
Quoted 1 line

On which HW?

Intel without ept. It's a Lenovo T500.

Quoted 1 line

My guess is this is because of tpr patching.

Most like, yes.

Isn't that only required on SVM?

Alex

#8 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 15 lines · Alexander Graf
Quoted 12 lines · Gerd Hoffmann
Quoted 10 lines · Gleb Natapov
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Didn't try win7, but for winxp it is a *huge* difference.

On which HW?

Quoted 8 lines
Quoted 5 lines

Intel without ept. It's a Lenovo T500.

Quoted 1 line

My guess is this is because of tpr patching.

Most like, yes.

Isn't that only required on SVM?

No, old vmx too.

--
Gleb.

#9 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 5 lines · Gleb Natapov
Quoted 3 lines

Isn't that only required on SVM?

No, old vmx too.

'flexpriority' in /proc/cpuinfo means tpr patching is unnecessary.

But to use flexpriority you need in-kernel irqchip, so qemu.git will be slow even if you have it.

Signature · 1 line
error compiling committee.c: too many arguments to function
#10 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

In reply to Gleb Natapov
Quoted 5 lines · Gleb Natapov
Quoted 3 lines · Gerd Hoffmann
   Hi,
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Didn't try win7, but for winxp it is a *huge* difference.

On which HW? My guess is this is because of tpr patching.

Does Windows 7 hit the TPR heavily? I thought all modern versions of Windows significantly reduced their interactions with the TPR.

Regards,

Anthony Liguori

Quoted 3 lines

--
Gleb.

#11 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Gleb Natapov
Quoted 5 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Didn't try win7, but for winxp it is a *huge* difference.

On which HW? My guess is this is because of tpr patching.

Does Windows 7 hit the TPR heavily? I thought all modern versions of Windows significantly reduced their interactions with the TPR.

Windows 7 doesn't. tpr patching explains only winxp slowdown. --
Gleb.

author
#12 lore raw

[Qemu-devel] Re: qemu-kvm faster than qemu?

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 5 lines · walt
Quoted 4 lines · Anthony Liguori
Quoted 2 lines · walt

I find that qemu-kvm boots to the Win7 login prompt in 25 seconds, while qemu with kvm enabled takes about 45 seconds.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Also, what's your full command line?

/usr/local/bin/qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 w7.diff

You'll get more accurate and repeatable results by using:

qemu-system-x86_64 -m 1024 -enable-kvm -cpu kvm64 -drive file=w7.diff,cache=none

Turning off the cache slows both of them down, as I would expect:

qemu-kvm:  52 seconds
qemu:      65 seconds
Quoted 1 line

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Using that flag wipes out the difference entirely: both come in at about 65 seconds.

I also tried xp-32 running on the same two kvm64 virtual machines, with slightly different results:

qemu-kvm:  35 seconds (65 seconds using -no-kvm-irqchip, a huge disadvantage)
qemu:      58 seconds

Anything unexpected in these results?

Thanks for your time.

#13 lore raw

Re: [Qemu-devel] Re: qemu-kvm faster than qemu?

Quoted 5 lines · walt
Quoted 2 lines

Also try qemu-kvm with -no-kvm-irqchip. I can't believe an in-kernel lapic would make this much of a difference with windows 7 but it's worth trying.

Using that flag wipes out the difference entirely: both come in at about 65 seconds.

Quoted 7 lines

I also tried xp-32 running on the same two kvm64 virtual machines, with slightly different results:

qemu-kvm:  35 seconds (65 seconds using -no-kvm-irqchip, a huge disadvantage)
qemu:      58 seconds

Anything unexpected in these results?

Looks like kernel irqchip is the cause for the difference, which isn't too surprising.

Signature · 1 line
error compiling committee.c: too many arguments to function