From patchwork Sat May 4 09:12:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhanghaoyu (A)" X-Patchwork-Id: 241437 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 C9E932C00E8 for ; Sat, 4 May 2013 19:13:05 +1000 (EST) Received: from localhost ([::1]:54487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYYWd-0000sx-TE for incoming@patchwork.ozlabs.org; Sat, 04 May 2013 05:13:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYYWN-0000rt-SQ for qemu-devel@nongnu.org; Sat, 04 May 2013 05:12:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYYWM-0002Il-L9 for qemu-devel@nongnu.org; Sat, 04 May 2013 05:12:47 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:20607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYYWM-0002IX-2O for qemu-devel@nongnu.org; Sat, 04 May 2013 05:12:46 -0400 Received: from 172.24.2.119 (EHLO szxeml205-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BBP59637; Sat, 04 May 2013 17:12:39 +0800 (CST) Received: from SZXEML415-HUB.china.huawei.com (10.82.67.154) by szxeml205-edg.china.huawei.com (172.24.2.58) with Microsoft SMTP Server (TLS) id 14.1.323.7; Sat, 4 May 2013 17:12:36 +0800 Received: from szxeml556-mbx.china.huawei.com ([169.254.3.167]) by szxeml415-hub.china.huawei.com ([10.82.67.154]) with mapi id 14.01.0323.007; Sat, 4 May 2013 17:12:31 +0800 From: "Zhanghaoyu (A)" To: qemu-devel , Marcelo Tosatti Thread-Topic: [PATCH] [KVM] Needless to update msi route when only msi-x entry "control" section changed Thread-Index: Ac5Ip37P2odhksMnQ4uMmyPylhrF1w== Date: Sat, 4 May 2013 09:12:30 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: Qinchuanyu , Luonengjun , Zanghongyong , "Huangweidong \(C\)" Subject: [Qemu-devel] [PATCH] [KVM] Needless to update msi route when only msi-x entry "control" section changed 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 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. Signed-off-by: Zhang Haoyu Signed-off-by: Huang Weidong Signed-off-by: Qin Chuanyu --- hw/i386/kvm/pci-assign.c | 3 +++ 1 files changed, 3 insertions(+) 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 if (ret) { error_report("Error updating irq routing entry (%d)", ret); } + } } } }