qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets
@ 2013-05-03  4:05 Zhanghaoyu (A)
  2013-05-04  4:06 ` Zhanghaoyu (A)
  2013-05-04  7:48 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Zhanghaoyu (A) @ 2013-05-03  4:05 UTC (permalink / raw)
  To: kvm list, linux-kernel@vger.kernel.org, qemu-devel
  Cc: Qinchuanyu, Huangweidong (C), Zanghongyong, Luonengjun

I running a VM(RHEL-5.5) on KVM hypervisor(linux-3.8 + QEMU-1.4.1), and direct-assign intel 82576 VF to the VM. When TX/RX packets on VM to the other host via iperf tool, top tool result on VM shown that the %si is too high, approximately 95% ~ 100%, but from the view of host, the VM's total CPU usage is about 20% - 30%. And the throughput rate is approximately 200Mb/s, far from the line rate 1Gb/s, 
And, I found  the hardirq rate is lower than normal by running "watch -d -n 1 cat /proc/interrupts", I think it's caused by the too high %si, because the NIC's hardirq was disabled during the softirq process.
Then, I direct-assign the intel 82576 to the VM, the same case happened too. 
I found the intel 82576 and intel 82576 VF's interrupt mode are both PCI-MSI-X.

And,
I rmmod the igb driver, and, re-insmod the igb driver(igb-4.1.2) with the parameter IntMode=0/1(0:legacy, 1:MSI, 2:MSI-x), the problem then gone, the %si is approximately 20% -30%, and the throughput rate came to the line rate, about 940Mb/s.
I update the VM to RHEL-6.1, the problem disappeared too.
And, I found a very strange thing, the VM's 82576VF's irq routing is set one time on Vf's one interrupt received, so frequently.

Thanks,
Zhang Haoyu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets
  2013-05-03  4:05 [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets Zhanghaoyu (A)
@ 2013-05-04  4:06 ` Zhanghaoyu (A)
  2013-05-04  7:48 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Zhanghaoyu (A) @ 2013-05-04  4:06 UTC (permalink / raw)
  To: Zhanghaoyu (A), kvm list, linux-kernel@vger.kernel.org,
	qemu-devel
  Cc: Qinchuanyu, Luonengjun, Zanghongyong, Huangweidong (C)

> I running a VM(RHEL-5.5) on KVM hypervisor(linux-3.8 + QEMU-1.4.1), and direct-assign intel 82576 VF to the VM. When TX/RX packets on VM to the other host via iperf tool, top tool result on VM shown that the %si is too high, approximately 95% ~ 100%, but from the view of host, the VM's total CPU usage is about 20% - 30%. And the throughput rate is approximately 200Mb/s, far from the line rate 1Gb/s, And, I found  the hardirq rate is lower than normal by running "watch -d -n 1 cat /proc/interrupts", I think it's caused by the too high %si, because the NIC's hardirq was disabled during the softirq process.
> Then, I direct-assign the intel 82576 to the VM, the same case happened too. 
> I found the intel 82576 and intel 82576 VF's interrupt mode are both PCI-MSI-X.
> 
> And,
> I rmmod the igb driver, and, re-insmod the igb driver(igb-4.1.2) with the parameter IntMode=0/1(0:legacy, 1:MSI, 2:MSI-x), the problem then gone, the %si is approximately 20% -30%, and the throughput rate came to the line rate, about 940Mb/s.
> I update the VM to RHEL-6.1, the problem disappeared too.
> And, I found a very strange thing, the VM's 82576VF's irq routing is set one time on Vf's one interrupt received, so frequently.

With regard to rhel-5.5(linux-2.6.18), in ISR process, mask and unmask msi-x vector function msi_set_mask_bit() was invoked every time, which result in VMEXIT, then QEMU will invoke kvm_irqchip_update_msi_route() to ask KVM hypervisor to update the VM irq routing table. In KVM hypervisor, synchronizing process needed after updating routing table, so much time consumed for waiting in wait_rcu_gp(). 
So %si in VM is so high, while from the view of host, VM's total CPU usage is so low. 

Why in ISR process, masking and unmasking msi-x vector is needed every time? 

Thanks,
Zhang Haoyu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets
  2013-05-03  4:05 [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets Zhanghaoyu (A)
  2013-05-04  4:06 ` Zhanghaoyu (A)
@ 2013-05-04  7:48 ` Paolo Bonzini
  2013-05-04  9:25   ` Zhanghaoyu (A)
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2013-05-04  7:48 UTC (permalink / raw)
  To: Zhanghaoyu (A)
  Cc: Huangweidong (C), kvm list, Luonengjun,
	linux-kernel@vger.kernel.org, qemu-devel, Zanghongyong,
	Qinchuanyu

Il 03/05/2013 06:05, Zhanghaoyu (A) ha scritto:
> I running a VM(RHEL-5.5) on KVM hypervisor(linux-3.8 + QEMU-1.4.1), and direct-assign intel 82576 VF to the VM. When TX/RX packets on VM to the other host via iperf tool, top tool result on VM shown that the %si is too high, approximately 95% ~ 100%, but from the view of host, the VM's total CPU usage is about 20% - 30%. And the throughput rate is approximately 200Mb/s, far from the line rate 1Gb/s, 
> And, I found  the hardirq rate is lower than normal by running "watch -d -n 1 cat /proc/interrupts", I think it's caused by the too high %si, because the NIC's hardirq was disabled during the softirq process.
> Then, I direct-assign the intel 82576 to the VM, the same case happened too. 
> I found the intel 82576 and intel 82576 VF's interrupt mode are both PCI-MSI-X.
> 
> And,
> I rmmod the igb driver, and, re-insmod the igb driver(igb-4.1.2) with the parameter IntMode=0/1(0:legacy, 1:MSI, 2:MSI-x), the problem then gone, the %si is approximately 20% -30%, and the throughput rate came to the line rate, about 940Mb/s.
> I update the VM to RHEL-6.1, the problem disappeared too.
> And, I found a very strange thing, the VM's 82576VF's irq routing is set one time on Vf's one interrupt received, so frequently.

RHEL 5.5 is a very old update.  Can you try RHEL 5.9?

In any case, this looks a lot like a bug in the version of the driver
that was included in RHEL5.5; you should contact Red Hat support
services if you can still reproduce it with the latest RHEL5 update.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets
  2013-05-04  7:48 ` Paolo Bonzini
@ 2013-05-04  9:25   ` Zhanghaoyu (A)
  0 siblings, 0 replies; 4+ messages in thread
From: Zhanghaoyu (A) @ 2013-05-04  9:25 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Huangweidong (C), kvm list, Luonengjun,
	linux-kernel@vger.kernel.org, qemu-devel, Zanghongyong,
	Qinchuanyu

>> I running a VM(RHEL-5.5) on KVM hypervisor(linux-3.8 + QEMU-1.4.1), 
>> and direct-assign intel 82576 VF to the VM. When TX/RX packets on VM to the other host via iperf tool, top tool result on VM shown that the %si is too high, approximately 95% ~ 100%, but from the view of host, the VM's total CPU usage is about 20% - 30%. And the throughput rate is approximately 200Mb/s, far from the line rate 1Gb/s, And, I found  the hardirq rate is lower than normal by running "watch -d -n 1 cat /proc/interrupts", I think it's caused by the too high %si, because the NIC's hardirq was disabled during the softirq process.
>> Then, I direct-assign the intel 82576 to the VM, the same case happened too. 
>> I found the intel 82576 and intel 82576 VF's interrupt mode are both PCI-MSI-X.
>> 
>> And,
>> I rmmod the igb driver, and, re-insmod the igb driver(igb-4.1.2) with the parameter IntMode=0/1(0:legacy, 1:MSI, 2:MSI-x), the problem then gone, the %si is approximately 20% -30%, and the throughput rate came to the line rate, about 940Mb/s.
>> I update the VM to RHEL-6.1, the problem disappeared too.
>> And, I found a very strange thing, the VM's 82576VF's irq routing is set one time on Vf's one interrupt received, so frequently.
>
>RHEL 5.5 is a very old update.  Can you try RHEL 5.9?
>
>In any case, this looks a lot like a bug in the version of the driver that was included in RHEL5.5; you should contact Red Hat support services if you can still reproduce it with the latest RHEL5 update.
>
>Paolo

One patch has been proposed to QEMU, shown as below,

[PATCH] [KVM] Needless to update msi route when only msi-x entry "control" section changed
With regard to old version linux guest(e.g., rhel-5.5), in ISR processing, mask and unmask msi-x vector every time, which result in VMEXIT, then QEMU will invoke kvm_irqchip_update_msi_route() to ask KVM hypervisor to update the VM irq routing table. In KVM hypervisor, synchronizing RCU needed after updating routing table, so much time consumed for waiting in wait_rcu_gp(). So CPU usage in VM is so high, while from the view of host, VM's total CPU usage is so low. 
Masking/unmasking msi-x vector only set msi-x entry "control" section, needless to update VM irq routing table.

hw/i386/kvm/pci-assign.c | 3 +++
1 files changed, 3 insertions(+)

--- a/hw/i386/kvm/pci-assign.c  2013-05-04 15:53:18.000000000 +0800
+++ b/hw/i386/kvm/pci-assign.c  2013-05-04 15:50:46.000000000 +0800
@@ -1576,6 +1576,8 @@ static void assigned_dev_msix_mmio_write
                 MSIMessage msg;
                 int ret;

+                /* Needless to update msi route when only msi-x entry "control" section changed */
+                if ((addr & (PCI_MSIX_ENTRY_SIZE - 1)) != PCI_MSIX_ENTRY_VECTOR_CTRL){
                 msg.address = entry->addr_lo |
                     ((uint64_t)entry->addr_hi << 32);
                 msg.data = entry->data; @@ -1585,6 +1587,7 @@ static void assigned_dev_msix_mmio_write
                 if (ret) {
                     error_report("Error updating irq routing entry (%d)", ret);
                 }
+                }
             }
         }
     }

Thanks,
Zhang Haoyu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-04  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03  4:05 [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets Zhanghaoyu (A)
2013-05-04  4:06 ` Zhanghaoyu (A)
2013-05-04  7:48 ` Paolo Bonzini
2013-05-04  9:25   ` Zhanghaoyu (A)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).