Skip to contentSkip to conversation

virtio performance issue

DISCUSSION Ben-Ami Yassour 4 participants 6 messages Sep 16, 2008 – Sep 17, 2008 KVM

lore
Share & tools
lore
#0 lore raw

I am running virtio with the latest KVM code, and see a significant performance issue.

Ping to the host (or any other close machine) reports a 4ms delay.

In the same setup with an e1000 emulation (just changing model=virtio to model=e1000 in the KVM command line), ping reports 0.177ms delay.

BTW, initially I saw that the throughput when using netperf is very low, even from guest to host, even though the CPU utilization is low.

What might be the problem?

Thanks,
Ben

#1 lore raw
Quoted 5 lines · Ben-Ami Yassour

I am running virtio with the latest KVM code, and see a significant performance issue.

Ping to the host (or any other close machine) reports a 4ms delay.

What kvm version and what host kernel version?

It's very easy to mistakenly compile qemu without GSO support too. You have to make sure that the 2.6.27 if_tun.h is being included by QEMU.

Regards,

Anthony Liguori

Quoted 12 lines

In the same setup with an e1000 emulation (just changing model=virtio to model=e1000 in the KVM command line), ping reports 0.177ms delay.

BTW, initially I saw that the throughput when using netperf is very low, even from guest to host, even though the CPU utilization is low.

What might be the problem?

Thanks,
Ben

#2 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 5 lines · Ben-Ami Yassour

I am running virtio with the latest KVM code, and see a significant performance issue.

Ping to the host (or any other close machine) reports a 4ms delay.

What kvm version and what host kernel version?

It's very easy to mistakenly compile qemu without GSO support too. You have to make sure that the 2.6.27 if_tun.h is being included by QEMU.

Is there an option to control GSO support? How?

I am using the kernel and userspace that I pulled from the kvm tree today.

Based on your comment, we checked and the build of the userspace does not take if_tun.h from the kernel tree, it takes it from the system include files.
The reason was that the file was not copied as part of the userspace build.

To fix this we made the following change:

kernel/Makefile +1 -1
index 3f5f6da..b81b098 100644
@@ -53,7 +53,7 @@ T = $(subst -sync,,$@)-tmp
 header-sync:
        rm -rf $T
        rsync -R \
-            "$(LINUX)"/./include/linux/kvm*.h \
+            "$(LINUX)"/./include/linux/*.h \
             "$(LINUX)"/./include/asm-*/kvm*.h \
 

Even with this change and compiling the userspace with the correct if_tun.h the results are the same, ping takes 4ms.

What could be the reason?

Thanks,
Ben

#3 lore raw
Quoted 8 lines · Ben-Ami Yassour
Quoted 7 lines · Anthony Liguori
Quoted 5 lines · Ben-Ami Yassour

I am running virtio with the latest KVM code, and see a significant performance issue.

Ping to the host (or any other close machine) reports a 4ms delay.

Quoted 6 lines
Quoted 4 lines

What kvm version and what host kernel version?

It's very easy to mistakenly compile qemu without GSO support too. You have to make sure that the 2.6.27 if_tun.h is being included by QEMU.

Is there an option to control GSO support? How?

GSO support is unconditionally enabled with model=virtio if kvm-userspace is built with the correct kernel headers, the host kernel supports tun/tap's IFF_VNET_HDR extension and if the guest supports GSO.

Quoted 15 lines

I am using the kernel and userspace that I pulled from the kvm tree today.

Based on your comment, we checked and the build of the userspace does not take if_tun.h from the kernel tree, it takes it from the system include files.
The reason was that the file was not copied as part of the userspace build.

To fix this we made the following change:

kernel/Makefile +0 -0
index 3f5f6da..b81b098 100644

kernel/Makefile T = $(subst -sync,,$@)-tmp · line 57

Quoted 6 lines
kernel/Makefile +1 -1
@@ -53,7 +53,7 @@ T = $(subst -sync,,$@)-tmp
 header-sync:
        rm -rf $T
        rsync -R \
-            "$(LINUX)"/./include/linux/kvm*.h \
+            "$(LINUX)"/./include/linux/*.h \
             "$(LINUX)"/./include/asm-*/kvm*.h \

Ouch, looks like we need a fix like this alright - maybe just copy if_tun.h and virtio*.h ?

Quoted 2 lines

Even with this change and compiling the userspace with the correct if_tun.h the results are the same, ping takes 4ms.

GSO shouldn't affect ping latency - it should only affect throughput.

I'd expect ping latency to be in the range of .15ms and .3ms since we delay our reply for .15ms currently.

Is this a regression? Have you tried bisecting it?

Cheers,
Mark.

#4 lore raw
Quoted 11 lines · Mark McLoughlin
Quoted 10 lines · Ben-Ami Yassour
Quoted 9 lines · Anthony Liguori
Quoted 5 lines · Ben-Ami Yassour

I am running virtio with the latest KVM code, and see a significant performance issue.

Ping to the host (or any other close machine) reports a 4ms delay.

What kvm version and what host kernel version?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It's very easy to mistakenly compile qemu without GSO support too. You have to make sure that the 2.6.27 if_tun.h is being included by QEMU.

Is there an option to control GSO support? How?

GSO support is unconditionally enabled with model=virtio if kvm-userspace is built with the correct kernel headers, the host kernel supports tun/tap's IFF_VNET_HDR extension and if the guest supports GSO.

How can we verify that GSO is actually used?

Quoted 7 lines

GSO shouldn't affect ping latency - it should only affect throughput.

I'd expect ping latency to be in the range of .15ms and .3ms since we delay our reply for .15ms currently.

Is this a regression? Have you tried bisecting it?

We are not sure yet what it is. We see very high variability in I/O rates, and have not yet found a combination of version, environment and parameters that shows good performance reliably. The head of the tree does show *bad* performance reliably.
We are trying kvm-73 now.

Thanks,
Ben

#5 lore raw
In reply to Ben-Ami Yassour

Ben-Ami Yassour <[email protected]> wrote:

Hello Ben,

Quoted 5 lines

I am running virtio with the latest KVM code, and see a significant performance issue.

Ping to the host (or any other close machine) reports a 4ms delay.

Quoted 7 lines

In the same setup with an e1000 emulation (just changing model=virtio to model=e1000 in the KVM command line), ping reports 0.177ms delay.

BTW, initially I saw that the throughput when using netperf is very low, even from guest to host, even though the CPU utilization is low.

What might be the problem?

I had exactly the same issue (with an 2.6.26 kernel and kvm-70 though). In an attempt to make the guest kernel (w/o modules) as small as possible I had disabled ACPI in its config. Which works, but introduced the very same 4ms delay you are seeing and made the VM clock go wild (even worse with KVM_CLOCK). I did not see other speed issues, but I have to admit I never benchmarked it.

After enabling ACPI the 4ms delay baseline disappeared and the clock in the guest is now perfectly in sync with the host.

Regards,
Bernhard