From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcWRt-00037j-HE for qemu-devel@nongnu.org; Mon, 19 Dec 2011 01:11:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RcWRq-0007So-Mf for qemu-devel@nongnu.org; Mon, 19 Dec 2011 01:11:45 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:48097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcWRq-0007SP-8c for qemu-devel@nongnu.org; Mon, 19 Dec 2011 01:11:42 -0500 Received: from huawei.com (szxga03-in [172.24.2.9]) by szxga03-in.huawei.com (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <0LWF006IIT5ZCI@szxga03-in.huawei.com> for qemu-devel@nongnu.org; Mon, 19 Dec 2011 14:10:48 +0800 (CST) Received: from szxrg01-dlp.huawei.com ([172.24.2.119]) by szxga03-in.huawei.com (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <0LWF006D9T5Z6D@szxga03-in.huawei.com> for qemu-devel@nongnu.org; Mon, 19 Dec 2011 14:10:47 +0800 (CST) Date: Mon, 19 Dec 2011 14:09:43 +0800 From: Zang Hongyong In-reply-to: <20111216093945.GB3071@amit-x200.redhat.com> Message-id: <4EEED527.4070103@huawei.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: QUOTED-PRINTABLE References: <1323998066-2396-1-git-send-email-zanghongyong@huawei.com> <20111216093945.GB3071@amit-x200.redhat.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: Amit Shah 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 =E4=BA=8E 2011/12/16,=E6=98=9F=E6=9C=9F=E4=BA=94 17:39, Amit Shah = =E5=86=99=E9=81=93: > 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 se= t 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 (por= t+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 defi= ned in >> qemu: msix.c, all the queues still share one MSI-X vector as befor= e.) >> >> 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 =3D proxy->nvectors =3D=3D DEV_NVECTORS_UNSPE= CIFIED >> - ? proxy->serial.max_virts= erial_ports + 1 >> + ? (proxy->serial.max_virt= serial_ports + 1) * 2 >> : proxy->nvectors; >> + /*msix.c: #define MSIX_MAX_ENTRIES 32*/ >> + if (vdev->nvectors> 32) >> + vdev->nvectors =3D 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 instea= d > of separate ones. > > Thanks, > > =09=09Amit > > . > Hi Amit, If the nvectors exceeds the max, msix_init() will return -EINVAL in Q= EMU, and the front-end driver in Guest will use regular interrupt instead = of=20 MSI-X. Hongyong