qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Wangyong <wang.yongD@h3c.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"hch@lst.de" <hch@lst.de>, Stefan Hajnoczi <stefanha@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: issue about virtio-blk queue size
Date: Fri, 20 Dec 2019 09:53:21 +0000	[thread overview]
Message-ID: <20191220095321.GB1635864@stefanha-x1.localdomain> (raw)
In-Reply-To: <18dcb1c11c1d481eadf491f9074f6306@h3c.com>

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

On Thu, Dec 05, 2019 at 01:30:09AM +0000, Wangyong wrote:
> >
> > On Thu, Nov 28, 2019 at 08:44:43AM +0000, Wangyong wrote:
> > > Hi all,
> >
> > This looks interesting, please continue this discussion on the QEMU mailing list
> > <qemu-devel@nongnu.org> so that others can participate.
> >
> > >
> > > This patch makes virtio_blk queue size configurable
> > >
> > > commit 6040aedddb5f474a9c2304b6a432a652d82b3d3c
> > > Author: Mark Kanda <mark.kanda@oracle.com>
> > > Date:   Mon Dec 11 09:16:24 2017 -0600
> > >
> > >     virtio-blk: make queue size configurable
> > >
> > > But when we set the queue size to more than 128, it will not take effect.
> > >
> > > That's because linux aio's maximum outstanding requests at a time is
> > > always less than or equal to 128
> > >
> > > The following code limits the outstanding requests at a time:
> > >
> > > #define MAX_EVENTS 128
> > >
> > > laio_do_submit()
> > > {
> > >
> > >     if (!s->io_q.blocked &&
> > >         (!s->io_q.plugged ||
> > >          s->io_q.in_flight + s->io_q.in_queue >= MAX_EVENTS)) {
> > >         ioq_submit(s);
> > >     }
> > > }
> > >
> > > Should we make the value of MAX_EVENTS configurable ?
> >
> > Increasing MAX_EVENTS to a larger hardcoded value seems reasonable as a
> > shortterm fix.  Please first check how /proc/sys/fs/aio-max-nr and
> > io_setup(2) handle this resource limit.  The patch must not break existing
> > systems where 128 works today.
> [root@node2 ~]# cat /etc/centos-release
> CentOS Linux release 7.5.1804 (Core)
> 
> [root@node2 ~]# cat /proc/sys/fs/aio-max-nr
> 4294967296
> 
> > > MAX_EVENTS should have the same value as queue size ?
> >
> > Multiple virtio-blk devices can share a single AioContext,
> Is multiple virtio-blk configured with one IOThread?
> Multiple virtio-blk performance will be worse.

Yes.  By default IOThreads are not used and all virtio-blk devices share
the main loop's AioContext.

When IOThreads are configured it's up to the user how to assign devices
to IOThreads.  Assigning multiple devices to one IOThread is realistic
because it's common to create only num_vcpus IOThreads.

A good starting point would be a patch that raises the limit to a
higher hardcoded number.  Then you can investigate how to size the
AioContext appropriately (maybe dynamically?) for a full fix.

Stefan

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

  reply	other threads:[~2019-12-20  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8920655f41aa4d1bbd5b7590ac0d1bef@h3c.com>
     [not found] ` <20191203143731.GD230219@stefanha-x1.localdomain>
2019-12-05  1:30   ` issue about virtio-blk queue size Wangyong
2019-12-20  9:53     ` Stefan Hajnoczi [this message]
2019-12-21  2:07       ` Wangyong
2020-01-02 11:20         ` Stefan Hajnoczi

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=20191220095321.GB1635864@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=hch@lst.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wang.yongD@h3c.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).