From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbUGh-0004qF-9J for qemu-devel@nongnu.org; Fri, 16 Dec 2011 04:40:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RbUGf-0003ix-47 for qemu-devel@nongnu.org; Fri, 16 Dec 2011 04:39:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RbUGe-0003it-S6 for qemu-devel@nongnu.org; Fri, 16 Dec 2011 04:39:53 -0500 Date: Fri, 16 Dec 2011 15:09:45 +0530 From: Amit Shah Message-ID: <20111216093945.GB3071@amit-x200.redhat.com> References: <1323998066-2396-1-git-send-email-zanghongyong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1323998066-2396-1-git-send-email-zanghongyong@huawei.com> Subject: Re: [Qemu-devel] [PATCH] virtio-serial: Allow one MSI-X vector per virtqueue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zanghongyong@huawei.com Cc: aliguori@us.ibm.com, wusongwei@huawei.com, kvm@vger.kernel.org, hanweidong@huawei.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, xiaowei.yang@huawei.com, "Michael S. Tsirkin" , jiangningyu@huawei.com On (Fri) 16 Dec 2011 [09:14:26], zanghongyong@huawei.com wrote: > From: Hongyong Zang > > In pci_enable_msix(), the guest's virtio-serial driver tries to set msi-x > with one vector per queue. But it fails and eventually all virtio-serial > ports share one MSI-X vector. Because every virtio-serial port has *two* > virtqueues, virtio-serial needs (port+1)*2 vectors other than (port+1). Ouch, good catch. One comment below: > This patch allows every virtqueue to have its own MSI-X vector. > (When the MSI-X vectors needed are more than MSIX_MAX_ENTRIES defined in > qemu: msix.c, all the queues still share one MSI-X vector as before.) > > Signed-off-by: Hongyong Zang > --- > hw/virtio-pci.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c > index 77b75bc..2c9c6fb 100644 > --- a/hw/virtio-pci.c > +++ b/hw/virtio-pci.c > @@ -718,8 +718,11 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev) > return -1; > } > vdev->nvectors = proxy->nvectors == DEV_NVECTORS_UNSPECIFIED > - ? proxy->serial.max_virtserial_ports + 1 > + ? (proxy->serial.max_virtserial_ports + 1) * 2 > : proxy->nvectors; > + /*msix.c: #define MSIX_MAX_ENTRIES 32*/ > + if (vdev->nvectors > 32) > + vdev->nvectors = 32; This change isn't needed: if the proxy->nvectors value exceeds the max allowed, virtio_init_pci() will end up using a shared vector instead of separate ones. Thanks, Amit