From: Zang Hongyong <zanghongyong@huawei.com>
To: Amit Shah <amit.shah@redhat.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" <mst@redhat.com>,
jiangningyu@huawei.com
Subject: Re: [Qemu-devel] [PATCH] virtio-serial: Allow one MSI-X vector per virtqueue
Date: Mon, 19 Dec 2011 14:09:43 +0800 [thread overview]
Message-ID: <4EEED527.4070103@huawei.com> (raw)
In-Reply-To: <20111216093945.GB3071@amit-x200.redhat.com>
于 2011/12/16,星期五 17:39, Amit Shah 写道:
> On (Fri) 16 Dec 2011 [09:14:26], zanghongyong@huawei.com wrote:
>> From: Hongyong Zang<zanghongyong@huawei.com>
>>
>> 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<zanghongyong@huawei.com>
>> ---
>> 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
>
> .
>
Hi Amit,
If the nvectors exceeds the max, msix_init() will return -EINVAL in QEMU,
and the front-end driver in Guest will use regular interrupt instead of
MSI-X.
Hongyong
next prev parent reply other threads:[~2011-12-19 6:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 1:14 [Qemu-devel] [PATCH] virtio-serial: Allow one MSI-X vector per virtqueue zanghongyong
2011-12-16 9:39 ` Amit Shah
2011-12-19 6:09 ` Zang Hongyong [this message]
2011-12-19 7:26 ` Amit Shah
2011-12-19 8:49 ` Zang Hongyong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EEED527.4070103@huawei.com \
--to=zanghongyong@huawei.com \
--cc=aliguori@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=hanweidong@huawei.com \
--cc=jiangningyu@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
--cc=wusongwei@huawei.com \
--cc=xiaowei.yang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).