From patchwork Sat May 4 09:25:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhanghaoyu (A)" X-Patchwork-Id: 241438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B109F2C00E8 for ; Sat, 4 May 2013 19:26:28 +1000 (EST) Received: from localhost ([::1]:56078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYYja-0002hZ-Ce for incoming@patchwork.ozlabs.org; Sat, 04 May 2013 05:26:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYYjL-0002hU-VZ for qemu-devel@nongnu.org; Sat, 04 May 2013 05:26:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYYjK-0006cE-Nh for qemu-devel@nongnu.org; Sat, 04 May 2013 05:26:11 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:53363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYYjK-0006bx-5H for qemu-devel@nongnu.org; Sat, 04 May 2013 05:26:10 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BBP60431; Sat, 04 May 2013 17:26:02 +0800 (CST) Received: from SZXEML410-HUB.china.huawei.com (10.82.67.137) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Sat, 4 May 2013 17:25:58 +0800 Received: from szxeml556-mbx.china.huawei.com ([169.254.3.167]) by szxeml410-hub.china.huawei.com ([10.82.67.137]) with mapi id 14.01.0323.007; Sat, 4 May 2013 17:25:50 +0800 From: "Zhanghaoyu (A)" To: Paolo Bonzini Thread-Topic: KVM VM(rhel-5.5) %si is too high when TX/RX packets Thread-Index: Ac5Hs1wISEMZKpucRUKMj7M5PG0M3gApUvGAABPW0OA= Date: Sat, 4 May 2013 09:25:50 +0000 Message-ID: References: <5184BD35.2000207@redhat.com> In-Reply-To: <5184BD35.2000207@redhat.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: C9Ae GiKj HgCd IGkb S2wm US+K YSkB ZqUD aljr cqOB dXAR i8Zl m2R2 neaq np1w pF1+; 4; awB2AG0AQAB2AGcAZQByAC4AawBlAHIAbgBlAGwALgBvAHIAZwA7AGwAaQBuAHUAeAAtAGsAZQByAG4AZQBsAEAAdgBnAGUAcgAuAGsAZQByAG4AZQBsAC4AbwByAGcAOwBwAGIAbwBuAHoAaQBuAGkAQAByAGUAZABoAGEAdAAuAGMAbwBtADsAcQBlAG0AdQAtAGQAZQB2AGUAbABAAG4AbwBuAGcAbgB1AC4AbwByAGcA; Sosha1_v1; 7; {7A54BAD0-C7B4-498D-AD17-1C870B9847D8}; aABhAG8AeQB1AC4AegBoAGEAbgBnAEAAaAB1AGEAdwBlAGkALgBjAG8AbQA=; Sat, 04 May 2013 09:25:41 GMT; UgBlADoAIABLAFYATQAgAFYATQAoAHIAaABlAGwALQA1AC4ANQApACAAJQBzAGkAIABpAHMAIAB0AG8AbwAgAGgAaQBnAGgAIAB3AGgAZQBuACAAVABYAC8AUgBYACAAcABhAGMAawBlAHQAcwA= x-cr-puzzleid: {7A54BAD0-C7B4-498D-AD17-1C870B9847D8} x-originating-ip: [10.135.68.97] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.64 Cc: "Huangweidong \(C\)" , kvm list , Luonengjun , "linux-kernel@vger.kernel.org" , qemu-devel , Zanghongyong , Qinchuanyu Subject: Re: [Qemu-devel] KVM VM(rhel-5.5) %si is too high when TX/RX packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org >> 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(+) if (ret) { error_report("Error updating irq routing entry (%d)", ret); } + } } } } Thanks, Zhang Haoyu --- 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