All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, borntraeger@de.ibm.com,
	Karl Rister <krister@redhat.com>, Fam Zheng <famz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 00/13] aio: experimental virtio-blk polling mode
Date: Fri, 2 Dec 2016 03:27:07 -0500 (EST)	[thread overview]
Message-ID: <1055838580.1161059.1480667227702.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20161201192652.9509-1-stefanha@redhat.com>


> v4:
>  * Added poll time self-tuning algorithm [Christian and Paolo]
>  * Try a single iteration of polling to avoid non-blocking
>  ppoll(2)/epoll_wait(2) [Paolo]
>  * Reordered patches to make performance analysis easier - see below

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

> v3:
>  * Avoid ppoll(2)/epoll_wait(2) if polling succeeded [Paolo]
>  * Disable guest->host virtqueue notification during polling [Christian]
>  * Rebased on top of my virtio-blk/scsi virtqueue notification disable
>  patches
> 
> v2:
>  * Uninitialized node->deleted gone [Fam]
>  * Removed 1024 polling loop iteration qemu_clock_get_ns() optimization which
>    created a weird step pattern [Fam]
>  * Unified with AioHandler, dropped AioPollHandler struct [Paolo]
>    (actually I think Paolo had more in mind but this is the first step)
>  * Only poll when all event loop resources support it [Paolo]
>  * Added run_poll_handlers_begin/end trace events for perf analysis
>  * Sorry, Christian, no virtqueue kick suppression yet
> 
> Recent performance investigation work done by Karl Rister shows that the
> guest->host notification takes around 20 us.  This is more than the
> "overhead"
> of QEMU itself (e.g. block layer).
> 
> One way to avoid the costly exit is to use polling instead of notification.
> The main drawback of polling is that it consumes CPU resources.  In order to
> benefit performance the host must have extra CPU cycles available on physical
> CPUs that aren't used by the guest.
> 
> This is an experimental AioContext polling implementation.  It adds a polling
> callback into the event loop.  Polling functions are implemented for
> virtio-blk
> virtqueue guest->host kick and Linux AIO completion.
> 
> The -object iothread,poll-max-ns=NUM parameter sets the number of nanoseconds
> to poll before entering the usual blocking poll(2) syscall.  Try setting this
> parameter to the time from old request completion to new virtqueue kick.  By
> default no polling is done so you must set this parameter to get busy
> polling.
> 
> Patch series overview:
> 
> Here are convenient points in the patch series at which to do performance
> benchmarking to see how various pieces interact.
> 
> 1. Basic -iothread poll-max-ns=NUM parameter without self-tuning:
> 
> aio: add flag to skip fds to aio_dispatch()
> aio: add AioPollFn and io_poll() interface
> aio: add polling mode to AioContext
> virtio: poll virtqueues for new buffers
> linux-aio: poll ring for completions
> iothread: add polling parameters
> 
> 2. My "[PATCH 0/3] virtio: disable notifications in blk and scsi" series is
>    needed as a base.  This is unrelated to polling but we'll also disable
>    notifications during polling later:
> 
> virtio-blk: suppress virtqueue kick during processing
> virtio-scsi: suppress virtqueue kick during processing
> 
> 3. Disable virtqueue notifications (reduce vmexits) during polling:
> 
> virtio: turn vq->notification into a nested counter
> aio: add .io_poll_begin/end() callbacks
> virtio: disable virtqueue notifications during polling
> 
> 4. Self-tuning, adjusts polling time depending on wait times:
> 
> aio: self-tune polling time
> iothread: add poll-grow and poll-shrink parameters
> 
> Stefan Hajnoczi (13):
>   aio: add flag to skip fds to aio_dispatch()
>   aio: add AioPollFn and io_poll() interface
>   aio: add polling mode to AioContext
>   virtio: poll virtqueues for new buffers
>   linux-aio: poll ring for completions
>   iothread: add polling parameters
>   virtio-blk: suppress virtqueue kick during processing
>   virtio-scsi: suppress virtqueue kick during processing
>   virtio: turn vq->notification into a nested counter
>   aio: add .io_poll_begin/end() callbacks
>   virtio: disable virtqueue notifications during polling
>   aio: self-tune polling time
>   iothread: add poll-grow and poll-shrink parameters
> 
>  include/block/aio.h         |  53 +++++++-
>  include/sysemu/iothread.h   |   5 +
>  aio-posix.c                 | 308
>  +++++++++++++++++++++++++++++++++++++++-----
>  aio-win32.c                 |  32 ++++-
>  async.c                     |  21 ++-
>  block/curl.c                |   8 +-
>  block/iscsi.c               |   3 +-
>  block/linux-aio.c           |  19 ++-
>  block/nbd-client.c          |   8 +-
>  block/nfs.c                 |   7 +-
>  block/sheepdog.c            |  26 ++--
>  block/ssh.c                 |   4 +-
>  block/win32-aio.c           |   4 +-
>  hw/block/virtio-blk.c       |  18 ++-
>  hw/scsi/virtio-scsi.c       |  36 +++---
>  hw/virtio/virtio.c          |  54 ++++++--
>  iohandler.c                 |   2 +-
>  iothread.c                  |  84 ++++++++++++
>  nbd/server.c                |   9 +-
>  stubs/set-fd-handler.c      |   1 +
>  tests/test-aio.c            |   4 +-
>  util/event_notifier-posix.c |   2 +-
>  trace-events                |   6 +
>  23 files changed, 604 insertions(+), 110 deletions(-)
> 
> --
> 2.9.3
> 
> 

  parent reply	other threads:[~2016-12-02  8:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 19:26 [Qemu-devel] [PATCH v4 00/13] aio: experimental virtio-blk polling mode Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 01/13] aio: add flag to skip fds to aio_dispatch() Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 02/13] aio: add AioPollFn and io_poll() interface Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 03/13] aio: add polling mode to AioContext Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 04/13] virtio: poll virtqueues for new buffers Stefan Hajnoczi
2016-12-05  0:54   ` Fam Zheng
2016-12-05 10:14     ` Stefan Hajnoczi
2016-12-05 10:59       ` Paolo Bonzini
2016-12-05 14:46         ` Stefan Hajnoczi
2016-12-05 15:22           ` Paolo Bonzini
2016-12-06  9:28             ` Stefan Hajnoczi
2016-12-05 11:12       ` Christian Borntraeger
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 05/13] linux-aio: poll ring for completions Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 06/13] iothread: add polling parameters Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 07/13] virtio-blk: suppress virtqueue kick during processing Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 08/13] virtio-scsi: " Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 09/13] virtio: turn vq->notification into a nested counter Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 10/13] aio: add .io_poll_begin/end() callbacks Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 11/13] virtio: disable virtqueue notifications during polling Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 12/13] aio: self-tune polling time Stefan Hajnoczi
2016-12-05 20:06   ` Christian Borntraeger
2016-12-06  9:20     ` Stefan Hajnoczi
2016-12-06 10:12       ` Christian Borntraeger
2016-12-06 17:22         ` Stefan Hajnoczi
2016-12-01 19:26 ` [Qemu-devel] [PATCH v4 13/13] iothread: add poll-grow and poll-shrink parameters Stefan Hajnoczi
2016-12-02  8:27 ` Paolo Bonzini [this message]
2016-12-02 11:11 ` [Qemu-devel] [PATCH v4 00/13] aio: experimental virtio-blk polling mode Stefan Hajnoczi
2016-12-05 10:25 ` Fam Zheng
2016-12-05 14:56   ` Stefan Hajnoczi
2016-12-05 16:40     ` Karl Rister
2016-12-06  9:27       ` Stefan Hajnoczi
2016-12-05 11:19 ` Christian Borntraeger

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=1055838580.1161059.1480667227702.JavaMail.zimbra@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=famz@redhat.com \
    --cc=krister@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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.