From patchwork Wed Jun 26 05:05:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhanghaoyu (A)" X-Patchwork-Id: 254568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 20ACE2C008E for ; Wed, 26 Jun 2013 15:06:10 +1000 (EST) Received: from localhost ([::1]:57425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Urhvg-0007vW-VH for incoming@patchwork.ozlabs.org; Wed, 26 Jun 2013 01:06:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrhvR-0007vK-Pp for qemu-devel@nongnu.org; Wed, 26 Jun 2013 01:05:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrhvN-0005nr-Pj for qemu-devel@nongnu.org; Wed, 26 Jun 2013 01:05:49 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:64238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrhvN-0005n4-7A for qemu-devel@nongnu.org; Wed, 26 Jun 2013 01:05:45 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BDW27166; Wed, 26 Jun 2013 13:05:30 +0800 (CST) Received: from SZXEML407-HUB.china.huawei.com (10.82.67.94) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Wed, 26 Jun 2013 13:05:27 +0800 Received: from szxeml556-mbx.china.huawei.com ([169.254.3.163]) by szxeml407-hub.china.huawei.com ([10.82.67.94]) with mapi id 14.01.0323.007; Wed, 26 Jun 2013 13:05:18 +0800 From: "Zhanghaoyu (A)" To: qemu-devel , Marcelo Tosatti , "paolo.bonzini@gmail.com" Thread-Topic: meaningless to compare irqfd's msi message with new msi message in virtio_pci_vq_vector_unmask Thread-Index: Ac5yKr4hddx6m4rlRxWXeo5/ZWxzUg== Date: Wed, 26 Jun 2013 05:05:17 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US 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.65 Cc: "Huangweidong \(C\)" , Zanghongyong , Luonengjun , Zhanghuanzhong Subject: [Qemu-devel] meaningless to compare irqfd's msi message with new msi message in virtio_pci_vq_vector_unmask 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 searched "vector_irqfd" globally, no place found to set/change irqfd's msi message, only irqfd's virq or users member may be changed in kvm_virtio_pci_vq_vector_use, kvm_virtio_pci_vq_vector_release, etc. So I think it's meaningless to do below check in virtio_pci_vq_vector_unmask, if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) And, I think the comparison between old msi message and new msi messge should be performed in kvm_update_routing_entry, the raw patch shown as below, Signed-off-by: Zhang Haoyu Signed-off-by: Zhang Huanzhong --- hw/virtio/virtio-pci.c | 8 +++----- kvm-all.c | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index b070b64..e4829a3 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -613,11 +613,9 @@ static int virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy, if (proxy->vector_irqfd) { irqfd = &proxy->vector_irqfd[vector]; - if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) { - ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg); - if (ret < 0) { - return ret; - } + ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg); + if (ret < 0) { + return ret; } } diff --git a/kvm-all.c b/kvm-all.c index e6b262f..63a33b4 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1034,6 +1034,11 @@ static int kvm_update_routing_entry(KVMState *s, continue; } + if (entry->type == new_entry->type && + entry->flags == new_entry->flags && + !memcmp(&entry->u, &new_entry->u, sizeof(entry->u))) { + return 0; + } entry->type = new_entry->type; entry->flags = new_entry->flags; entry->u = new_entry->u;