From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6KVJ-0003Do-H7 for qemu-devel@nongnu.org; Mon, 14 Nov 2016 11:53:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6KVE-0002Py-IU for qemu-devel@nongnu.org; Mon, 14 Nov 2016 11:53:09 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35381) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c6KVE-0002PI-7y for qemu-devel@nongnu.org; Mon, 14 Nov 2016 11:53:04 -0500 Received: by mail-wm0-x241.google.com with SMTP id a20so17001607wme.2 for ; Mon, 14 Nov 2016 08:53:03 -0800 (PST) Date: Mon, 14 Nov 2016 16:52:59 +0000 From: Stefan Hajnoczi Message-ID: <20161114165259.GB1352@stefanha-x1.localdomain> References: <1478711602-12620-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gj572EiMnwbLXET9" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [RFC 0/3] aio: experimental virtio-blk polling mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Paolo Bonzini , Fam Zheng , Karl Rister --gj572EiMnwbLXET9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 14, 2016 at 03:59:32PM +0100, Christian Borntraeger wrote: > On 11/09/2016 06:13 PM, Stefan Hajnoczi wrote: > > Recent performance investigation work done by Karl Rister shows that the > > guest->host notification takes around 20 us. This is more than the "ov= erhead" > > of QEMU itself (e.g. block layer). > >=20 > > One way to avoid the costly exit is to use polling instead of notificat= ion. > > The main drawback of polling is that it consumes CPU resources. In ord= er to > > benefit performance the host must have extra CPU cycles available on ph= ysical > > CPUs that aren't used by the guest. > >=20 > > This is an experimental AioContext polling implementation. It adds a p= olling > > callback into the event loop. Polling functions are implemented for vi= rtio-blk > > virtqueue guest->host kick and Linux AIO completion. > >=20 > > The QEMU_AIO_POLL_MAX_NS environment variable sets the number of nanose= conds to > > poll before entering the usual blocking poll(2) syscall. Try setting t= his > > variable to the time from old request completion to new virtqueue kick. > >=20 > > By default no polling is done. The QEMU_AIO_POLL_MAX_NS must be set to= get any > > polling! > >=20 > > Karl: I hope you can try this patch series with several QEMU_AIO_POLL_M= AX_NS > > values. If you don't find a good value we should double-check the trac= ing data > > to see if this experimental code can be improved. > >=20 > > Stefan Hajnoczi (3): > > aio-posix: add aio_set_poll_handler() > > virtio: poll virtqueues for new buffers > > linux-aio: poll ring for completions > >=20 > > aio-posix.c | 133 ++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > > block/linux-aio.c | 17 +++++++ > > hw/virtio/virtio.c | 19 ++++++++ > > include/block/aio.h | 16 +++++++ > > 4 files changed, 185 insertions(+) > >=20 >=20 > Another observation: With more iothreads than host CPUs the performance d= rops significantly. This makes sense although we can eliminate it in common cases by only polling when we actually need to monitor events. The current series wastes CPU on Linux AIO polling when no requests are pending ;). --gj572EiMnwbLXET9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYKevrAAoJEJykq7OBq3PIrNEH/1AXuVynMarHW/4NXVUCChJY 58K5I8ckGw2bWoyMtWDTUL/q6kDhkZLi7oV25hWFLNsha+UjB9F3WumyuGM+D2re xdKLB/sBEBPWJcwPVDYotrbXO3B0JyzBBKaKCfCh46jtARHSg/KXfoY8iXcsIbBN 0coSdoGbarVttRXQRrrZmGEvP5IH+CAXgOMjQrysEShHADrBrYV49l3vT+jlISoI +23tEQuNKkgI2gwE+O0K2DJQ+vE8AuV9h0lJVolkmndsYYdiOtd5RVv9WtIeSnzk V4dOeci88Sjkfppn7mATMUoeia+dSO+RMOVhzYffPCAbMjVDC8YWokGAFe8d888= =F1tL -----END PGP SIGNATURE----- --gj572EiMnwbLXET9--