Received: from eggs.gnu.org ([2001:4830:134:3::10]:54200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6KVt-0003ga-6M for qemu-devel@nongnu.org; Mon, 14 Nov 2016 11:53:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6KVo-0002bL-8B for qemu-devel@nongnu.org; Mon, 14 Nov 2016 11:53:45 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c6KVn-0002ak-SE for qemu-devel@nongnu.org; Mon, 14 Nov 2016 11:53:40 -0500 Received: by mail-wm0-x242.google.com with SMTP id g23so16999781wme.1 for ; Mon, 14 Nov 2016 08:53:39 -0800 (PST) Date: Mon, 14 Nov 2016 16:53:34 +0000 From: Stefan Hajnoczi Message-ID: <20161114165334.GC1352@stefanha-x1.localdomain> References: <1478711602-12620-1-git-send-email-stefanha@redhat.com> <1bca4a16-5a2c-8de7-b66d-a8ceb3e5a756@de.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4jXrM3lyYWu4nBt5" Content-Disposition: inline In-Reply-To: <1bca4a16-5a2c-8de7-b66d-a8ceb3e5a756@de.ibm.com> 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 --4jXrM3lyYWu4nBt5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 14, 2016 at 03:51:18PM +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 > Hmm, I see all affected threads using more CPU power, but the performance= numbers are > somewhat inconclusive on s390. I have no proper test setup (only a shared= LPAR), but > all numbers are in the same ballpark of 3-5Gbyte/sec for 5 disks for 4k r= andom reads > with iodepth=3D8. >=20 > What I find interesting is that the guest still does a huge amount of exi= ts for the > guest->host notifications. I think if we could combine this with some not= ification > suppression, then things could be even more interesting. Great idea. I'll add that to the next revision. Stefan --4jXrM3lyYWu4nBt5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYKewOAAoJEJykq7OBq3PIvXwH/RfO8RV0vicD6dZXX8f89OdM hM7NBJLwUCxcxJA2X8pA2Ix0ggc6Miwjph1LkfAces4q+5lTfW+rm2Te2v5PfuXn KSHYtpL5I1AE6Ffrwzd6aFrqG4dTHn2IcTKhlusf0isuJnLYD7itzdkqJfFuJxBo I0yyoRDl+zk9B+YDT3HjEp2VXv9fzWaretJAj9gn+tCgc2ITy5tjiNmP+jDgr1rQ YCAUimB+74DGkIoX7DMpOmapkEnWrVrWD93HRXcaokd6dkf+uvI4RZqUimPNkiPT PSW91Kkro8mahFXa2wNr2dnWBTxvA2VliV7dAhvZIuE2NJeDWvf4IdqTeLyEm+U= =X5aU -----END PGP SIGNATURE----- --4jXrM3lyYWu4nBt5--