All of lore.kernel.org
 help / color / mirror / Atom feed
* Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
@ 2020-07-30  7:46 Yajun Wu
  2020-08-05 12:11 ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Yajun Wu @ 2020-07-30  7:46 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Hi all,

I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
Basically increase queue size can get better RX rate for my case.

Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?

Thanks,
Yajun



[-- Attachment #2: Type: text/html, Size: 2336 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-07-30  7:46 Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit? Yajun Wu
@ 2020-08-05 12:11 ` Stefan Hajnoczi
  2020-08-05 12:13   ` Michael S. Tsirkin
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-08-05 12:11 UTC (permalink / raw)
  To: Yajun Wu; +Cc: jasowang, qemu-devel, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
> I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
> Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
> Basically increase queue size can get better RX rate for my case.
> 
> Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?

Hi,
The VIRTIO 1.1 specification says the maximum number of descriptors is
32768 for both split and packed virtqueues.

The vhost kernel code seems to support 32768.

The 1024 limit is an implementation limit in QEMU. Increasing it would
require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
the size of arrays.

I can't think of a fundamental reason why QEMU needs to limit itself to
1024 descriptors. Raising the limit would require fixing up the code and
ensuring that live migration remains compatible with older versions of
QEMU.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-08-05 12:11 ` Stefan Hajnoczi
@ 2020-08-05 12:13   ` Michael S. Tsirkin
  2020-08-06 12:37     ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2020-08-05 12:13 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: jasowang, Yajun Wu, qemu-devel

On Wed, Aug 05, 2020 at 01:11:07PM +0100, Stefan Hajnoczi wrote:
> On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
> > I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
> > Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
> > Basically increase queue size can get better RX rate for my case.
> > 
> > Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?
> 
> Hi,
> The VIRTIO 1.1 specification says the maximum number of descriptors is
> 32768 for both split and packed virtqueues.
> 
> The vhost kernel code seems to support 32768.
> 
> The 1024 limit is an implementation limit in QEMU. Increasing it would
> require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
> the size of arrays.
> 
> I can't think of a fundamental reason why QEMU needs to limit itself to
> 1024 descriptors. Raising the limit would require fixing up the code and
> ensuring that live migration remains compatible with older versions of
> QEMU.
> 
> Stefan

There's actually a reason for a limit: in theory the vq size
also sets a limit on the number of scatter/gather entries.
both QEMU and vhost can't handle a packet split over > 1k chunks.

We could add an extra limit for s/g size like block and scsi do,
this will need spec, guest and host side work.

-- 
MST



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-08-05 12:13   ` Michael S. Tsirkin
@ 2020-08-06 12:37     ` Stefan Hajnoczi
  2020-08-07  3:35       ` Jason Wang
  2020-08-10 14:45       ` Michael S. Tsirkin
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-08-06 12:37 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: jasowang, Yajun Wu, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

On Wed, Aug 05, 2020 at 08:13:29AM -0400, Michael S. Tsirkin wrote:
> On Wed, Aug 05, 2020 at 01:11:07PM +0100, Stefan Hajnoczi wrote:
> > On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
> > > I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
> > > Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
> > > Basically increase queue size can get better RX rate for my case.
> > > 
> > > Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?
> > 
> > Hi,
> > The VIRTIO 1.1 specification says the maximum number of descriptors is
> > 32768 for both split and packed virtqueues.
> > 
> > The vhost kernel code seems to support 32768.
> > 
> > The 1024 limit is an implementation limit in QEMU. Increasing it would
> > require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
> > the size of arrays.
> > 
> > I can't think of a fundamental reason why QEMU needs to limit itself to
> > 1024 descriptors. Raising the limit would require fixing up the code and
> > ensuring that live migration remains compatible with older versions of
> > QEMU.
> > 
> > Stefan
> 
> There's actually a reason for a limit: in theory the vq size
> also sets a limit on the number of scatter/gather entries.
> both QEMU and vhost can't handle a packet split over > 1k chunks.
> 
> We could add an extra limit for s/g size like block and scsi do,
> this will need spec, guest and host side work.

Interesting, thanks for explaining! This could be made explicit by
changing the QEMU code to:

include/hw/virtio/virtio.h:#define VIRTQUEUE_MAX_SIZE IOV_MAX

Looking more closely at the vhost kernel code I see that UIO_MAXIOV is
used in some places but not in vhost_vring_set_num() (ioctl
VHOST_SET_VRING_NUM). Is there a reason why UIO_MAXIOV isn't enforced
when the application sets the queue size?

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-08-06 12:37     ` Stefan Hajnoczi
@ 2020-08-07  3:35       ` Jason Wang
  2020-08-07  9:59         ` Stefan Hajnoczi
  2020-08-10 14:45       ` Michael S. Tsirkin
  1 sibling, 1 reply; 8+ messages in thread
From: Jason Wang @ 2020-08-07  3:35 UTC (permalink / raw)
  To: Stefan Hajnoczi, Michael S. Tsirkin; +Cc: Yajun Wu, qemu-devel


On 2020/8/6 下午8:37, Stefan Hajnoczi wrote:
> On Wed, Aug 05, 2020 at 08:13:29AM -0400, Michael S. Tsirkin wrote:
>> On Wed, Aug 05, 2020 at 01:11:07PM +0100, Stefan Hajnoczi wrote:
>>> On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
>>>> I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
>>>> Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
>>>> Basically increase queue size can get better RX rate for my case.
>>>>
>>>> Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?
>>> Hi,
>>> The VIRTIO 1.1 specification says the maximum number of descriptors is
>>> 32768 for both split and packed virtqueues.
>>>
>>> The vhost kernel code seems to support 32768.
>>>
>>> The 1024 limit is an implementation limit in QEMU. Increasing it would
>>> require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
>>> the size of arrays.
>>>
>>> I can't think of a fundamental reason why QEMU needs to limit itself to
>>> 1024 descriptors. Raising the limit would require fixing up the code and
>>> ensuring that live migration remains compatible with older versions of
>>> QEMU.
>>>
>>> Stefan
>> There's actually a reason for a limit: in theory the vq size
>> also sets a limit on the number of scatter/gather entries.
>> both QEMU and vhost can't handle a packet split over > 1k chunks.
>>
>> We could add an extra limit for s/g size like block and scsi do,
>> this will need spec, guest and host side work.
> Interesting, thanks for explaining! This could be made explicit by
> changing the QEMU code to:
>
> include/hw/virtio/virtio.h:#define VIRTQUEUE_MAX_SIZE IOV_MAX
>
> Looking more closely at the vhost kernel code I see that UIO_MAXIOV is
> used in some places but not in vhost_vring_set_num() (ioctl
> VHOST_SET_VRING_NUM). Is there a reason why UIO_MAXIOV isn't enforced
> when the application sets the queue size?


Actually three things:

1) queue size
2) #descriptors in a list
3) IOV size

Spec limit the 2) to 1) but 2) may not equal to 3).

So enforcing UIO_MAXIOV can not solve the problem completely.

For vhost-net, it depends on socket to build skb which requires an iov 
array to work. We need remove this limitation by:

- build skb by vhost-net itself
- do piecewise copying

Then we're not limited with #iov and more and support up to what spec 
supports.

Thanks


>
> Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-08-07  3:35       ` Jason Wang
@ 2020-08-07  9:59         ` Stefan Hajnoczi
  2020-08-10  9:49           ` Jason Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2020-08-07  9:59 UTC (permalink / raw)
  To: Jason Wang; +Cc: Yajun Wu, qemu-devel, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 2845 bytes --]

On Fri, Aug 07, 2020 at 11:35:08AM +0800, Jason Wang wrote:
> 
> On 2020/8/6 下午8:37, Stefan Hajnoczi wrote:
> > On Wed, Aug 05, 2020 at 08:13:29AM -0400, Michael S. Tsirkin wrote:
> > > On Wed, Aug 05, 2020 at 01:11:07PM +0100, Stefan Hajnoczi wrote:
> > > > On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
> > > > > I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
> > > > > Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
> > > > > Basically increase queue size can get better RX rate for my case.
> > > > > 
> > > > > Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?
> > > > Hi,
> > > > The VIRTIO 1.1 specification says the maximum number of descriptors is
> > > > 32768 for both split and packed virtqueues.
> > > > 
> > > > The vhost kernel code seems to support 32768.
> > > > 
> > > > The 1024 limit is an implementation limit in QEMU. Increasing it would
> > > > require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
> > > > the size of arrays.
> > > > 
> > > > I can't think of a fundamental reason why QEMU needs to limit itself to
> > > > 1024 descriptors. Raising the limit would require fixing up the code and
> > > > ensuring that live migration remains compatible with older versions of
> > > > QEMU.
> > > > 
> > > > Stefan
> > > There's actually a reason for a limit: in theory the vq size
> > > also sets a limit on the number of scatter/gather entries.
> > > both QEMU and vhost can't handle a packet split over > 1k chunks.
> > > 
> > > We could add an extra limit for s/g size like block and scsi do,
> > > this will need spec, guest and host side work.
> > Interesting, thanks for explaining! This could be made explicit by
> > changing the QEMU code to:
> > 
> > include/hw/virtio/virtio.h:#define VIRTQUEUE_MAX_SIZE IOV_MAX
> > 
> > Looking more closely at the vhost kernel code I see that UIO_MAXIOV is
> > used in some places but not in vhost_vring_set_num() (ioctl
> > VHOST_SET_VRING_NUM). Is there a reason why UIO_MAXIOV isn't enforced
> > when the application sets the queue size?
> 
> 
> Actually three things:
> 
> 1) queue size
> 2) #descriptors in a list
> 3) IOV size
> 
> Spec limit the 2) to 1) but 2) may not equal to 3).
> 
> So enforcing UIO_MAXIOV can not solve the problem completely.
> 
> For vhost-net, it depends on socket to build skb which requires an iov array
> to work. We need remove this limitation by:
> 
> - build skb by vhost-net itself
> - do piecewise copying
> 
> Then we're not limited with #iov and more and support up to what spec
> supports.

If I understand correctly, you are saying vhost_net.ko does not support
more than UIO_MAXIOV descriptors today but it could be fixed as you
described.

Thanks!

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-08-07  9:59         ` Stefan Hajnoczi
@ 2020-08-10  9:49           ` Jason Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Jason Wang @ 2020-08-10  9:49 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Yajun Wu, qemu-devel, Michael S. Tsirkin


On 2020/8/7 下午5:59, Stefan Hajnoczi wrote:
> On Fri, Aug 07, 2020 at 11:35:08AM +0800, Jason Wang wrote:
>> On 2020/8/6 下午8:37, Stefan Hajnoczi wrote:
>>> On Wed, Aug 05, 2020 at 08:13:29AM -0400, Michael S. Tsirkin wrote:
>>>> On Wed, Aug 05, 2020 at 01:11:07PM +0100, Stefan Hajnoczi wrote:
>>>>> On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
>>>>>> I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
>>>>>> Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
>>>>>> Basically increase queue size can get better RX rate for my case.
>>>>>>
>>>>>> Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?
>>>>> Hi,
>>>>> The VIRTIO 1.1 specification says the maximum number of descriptors is
>>>>> 32768 for both split and packed virtqueues.
>>>>>
>>>>> The vhost kernel code seems to support 32768.
>>>>>
>>>>> The 1024 limit is an implementation limit in QEMU. Increasing it would
>>>>> require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
>>>>> the size of arrays.
>>>>>
>>>>> I can't think of a fundamental reason why QEMU needs to limit itself to
>>>>> 1024 descriptors. Raising the limit would require fixing up the code and
>>>>> ensuring that live migration remains compatible with older versions of
>>>>> QEMU.
>>>>>
>>>>> Stefan
>>>> There's actually a reason for a limit: in theory the vq size
>>>> also sets a limit on the number of scatter/gather entries.
>>>> both QEMU and vhost can't handle a packet split over > 1k chunks.
>>>>
>>>> We could add an extra limit for s/g size like block and scsi do,
>>>> this will need spec, guest and host side work.
>>> Interesting, thanks for explaining! This could be made explicit by
>>> changing the QEMU code to:
>>>
>>> include/hw/virtio/virtio.h:#define VIRTQUEUE_MAX_SIZE IOV_MAX
>>>
>>> Looking more closely at the vhost kernel code I see that UIO_MAXIOV is
>>> used in some places but not in vhost_vring_set_num() (ioctl
>>> VHOST_SET_VRING_NUM). Is there a reason why UIO_MAXIOV isn't enforced
>>> when the application sets the queue size?
>>
>> Actually three things:
>>
>> 1) queue size
>> 2) #descriptors in a list
>> 3) IOV size
>>
>> Spec limit the 2) to 1) but 2) may not equal to 3).
>>
>> So enforcing UIO_MAXIOV can not solve the problem completely.
>>
>> For vhost-net, it depends on socket to build skb which requires an iov array
>> to work. We need remove this limitation by:
>>
>> - build skb by vhost-net itself
>> - do piecewise copying
>>
>> Then we're not limited with #iov and more and support up to what spec
>> supports.
> If I understand correctly, you are saying vhost_net.ko does not support
> more than UIO_MAXIOV descriptors today but it could be fixed as you
> described.


Yes, but it needs major refactoring on vhost_net.

thanks


>
> Thanks!
>
> Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit?
  2020-08-06 12:37     ` Stefan Hajnoczi
  2020-08-07  3:35       ` Jason Wang
@ 2020-08-10 14:45       ` Michael S. Tsirkin
  1 sibling, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2020-08-10 14:45 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: jasowang, Yajun Wu, qemu-devel

On Thu, Aug 06, 2020 at 01:37:08PM +0100, Stefan Hajnoczi wrote:
> On Wed, Aug 05, 2020 at 08:13:29AM -0400, Michael S. Tsirkin wrote:
> > On Wed, Aug 05, 2020 at 01:11:07PM +0100, Stefan Hajnoczi wrote:
> > > On Thu, Jul 30, 2020 at 07:46:09AM +0000, Yajun Wu wrote:
> > > > I'm doing iperf test on VIRTIO net through vhost-user(HW VDPA).
> > > > Find maximal acceptable tx_queue_size/rx_queue_size is 1024.
> > > > Basically increase queue size can get better RX rate for my case.
> > > > 
> > > > Can we increase the limit(VIRTQUEUE_MAX_SIZE) to 8192 to possibly gain better performance?
> > > 
> > > Hi,
> > > The VIRTIO 1.1 specification says the maximum number of descriptors is
> > > 32768 for both split and packed virtqueues.
> > > 
> > > The vhost kernel code seems to support 32768.
> > > 
> > > The 1024 limit is an implementation limit in QEMU. Increasing it would
> > > require QEMU code changes. For example, VIRTQUEUE_MAX_SIZE is used as
> > > the size of arrays.
> > > 
> > > I can't think of a fundamental reason why QEMU needs to limit itself to
> > > 1024 descriptors. Raising the limit would require fixing up the code and
> > > ensuring that live migration remains compatible with older versions of
> > > QEMU.
> > > 
> > > Stefan
> > 
> > There's actually a reason for a limit: in theory the vq size
> > also sets a limit on the number of scatter/gather entries.
> > both QEMU and vhost can't handle a packet split over > 1k chunks.
> > 
> > We could add an extra limit for s/g size like block and scsi do,
> > this will need spec, guest and host side work.
> 
> Interesting, thanks for explaining! This could be made explicit by
> changing the QEMU code to:
> 
> include/hw/virtio/virtio.h:#define VIRTQUEUE_MAX_SIZE IOV_MAX
> 
> Looking more closely at the vhost kernel code I see that UIO_MAXIOV is
> used in some places but not in vhost_vring_set_num() (ioctl
> VHOST_SET_VRING_NUM). Is there a reason why UIO_MAXIOV isn't enforced
> when the application sets the queue size?
> 
> Stefan


Backends such as vhost-user can handle > iov max. Devices such
as scsi and block have a limit for s/g separate from vq size.

-- 
MST




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-10 14:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  7:46 Any reason VIRTQUEUE_MAX_SIZE is 1024? Can we increase this limit? Yajun Wu
2020-08-05 12:11 ` Stefan Hajnoczi
2020-08-05 12:13   ` Michael S. Tsirkin
2020-08-06 12:37     ` Stefan Hajnoczi
2020-08-07  3:35       ` Jason Wang
2020-08-07  9:59         ` Stefan Hajnoczi
2020-08-10  9:49           ` Jason Wang
2020-08-10 14:45       ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.