From: Jason Wang <jasowang@redhat.com>
To: Yuri Benditovich <yuri.benditovich@daynix.com>
Cc: Yan Vugenfirer <yan@daynix.com>,
qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] virtio-net: do not start queues that are not enabled by the guest
Date: Thu, 21 Feb 2019 17:40:22 +0800 [thread overview]
Message-ID: <e6ea2819-ca95-796c-44e9-0067af82c46a@redhat.com> (raw)
In-Reply-To: <CAOEp5Ode1Ue0iLD4qUs+tcSGCZ+t+bm1TQpr3UG59jMU9kyVUg@mail.gmail.com>
On 2019/2/21 下午4:18, Yuri Benditovich wrote:
>> For 1.0 device, we can fix the queue_enable, but for 0.9x device how do
>> you enable one specific queue in this case? (setting status?)
>>
> Do I understand correctly that for 0.9 device in some cases the device will
> receive feature _MQ set, but will not receive VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET?
> Or the problem is different?
Let me clarify, VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET is used to control the
the number of queue pairs used by device for doing transmission and
reception. It was not used to enable or disable a virtqueue.
For 1.0 device, we should use queue_enable in pci cfg to enable and
disable queue:
We could do:
1) allocate memory and set queue_enable for vq0
2) allocate memory and set queue_enable for vq1
3) Set vq paris to 1
4) allocate memory and set queue_enable for vq2
5) allocate memory and set queue_enable for vq3
6) set vq pairs to 2
But this requires a proper implementation for queue_enable for vhost
which is missed in qemu and probably what you really want to do.
but for 0.9x device, there's no such way to do this. That's the issue.
So driver must allocate all queBes before starting the device, otherwise
there's no way to enable it afterwards. There're tricks to make it work
like what is done in your patch, but it depends on a specific
implementation like qemu which is sub-optimal.
>
>> A fundamental question is what prevents you from just initialization all
>> queues during driver start? It looks to me this save lots of efforts
>> than allocating queue dynamically.
>>
> This is not so trivial in Windows driver, as it does not have objects for queues
> that it does not use. Linux driver first of all allocates all the
> queues and then
> adds Rx/Tx to those it will use. Windows driver first decides how many queues
> it will use then allocates objects for them and initializes them from zero to
> fully functional state.
Well, you just need to allocate some memory for the virtqueue, there's
no need to make it visible to the rest until it was enabled.
Thanks
>
next prev parent reply other threads:[~2019-02-21 9:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 14:51 [Qemu-devel] [PATCH] virtio-net: do not start queues that are not enabled by the guest Yuri Benditovich
2019-02-18 3:49 ` Jason Wang
2019-02-18 9:58 ` Yuri Benditovich
2019-02-18 16:39 ` Michael S. Tsirkin
2019-02-18 20:49 ` Yuri Benditovich
2019-02-18 23:34 ` Michael S. Tsirkin
2019-02-19 6:27 ` Jason Wang
2019-02-19 14:19 ` Michael S. Tsirkin
2019-02-20 10:13 ` Jason Wang
2019-02-21 6:00 ` Yuri Benditovich
2019-02-21 6:49 ` Jason Wang
2019-02-21 8:18 ` Yuri Benditovich
2019-02-21 9:40 ` Jason Wang [this message]
2019-02-22 1:35 ` Michael S. Tsirkin
2019-02-22 3:04 ` Jason Wang
2019-02-22 3:10 ` Michael S. Tsirkin
2019-02-22 4:22 ` Michael S. Tsirkin
2019-02-25 7:47 ` Jason Wang
2019-02-25 12:33 ` Michael S. Tsirkin
2019-02-28 14:08 ` Michael S. Tsirkin
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=e6ea2819-ca95-796c-44e9-0067af82c46a@redhat.com \
--to=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yan@daynix.com \
--cc=yuri.benditovich@daynix.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).