From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsyqY-0007wQ-2I for qemu-devel@nongnu.org; Mon, 24 Nov 2014 13:58:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsyqS-0004eE-RX for qemu-devel@nongnu.org; Mon, 24 Nov 2014 13:58:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsyqS-0004dr-I5 for qemu-devel@nongnu.org; Mon, 24 Nov 2014 13:58:44 -0500 Date: Mon, 24 Nov 2014 18:58:39 +0000 From: Stefan Hajnoczi Message-ID: <20141124185839.GB14760@stefanha-thinkpad.redhat.com> References: <1416839379-19677-1-git-send-email-ming.lei@canonical.com> <1416839379-19677-3-git-send-email-ming.lei@canonical.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RASg3xLB4tUQ4RcS" Content-Disposition: inline In-Reply-To: <1416839379-19677-3-git-send-email-ming.lei@canonical.com> Subject: Re: [Qemu-devel] [PATCH v5 2/3] linux-aio: handling -EAGAIN for !s->io_q.plugged case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ming Lei Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 24, 2014 at 10:29:38PM +0800, Ming Lei wrote: > Previously -EAGAIN is simply ignored for !s->io_q.plugged case, > and sometimes it is easy to cause -EIO to VM, such as NVME device. >=20 > This patch handles -EAGAIN by io queue for !s->io_q.plugged case, > and it will be retried in following aio completion cb. >=20 > Suggested-by: Paolo Bonzini > Signed-off-by: Ming Lei > --- > block/linux-aio.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) >=20 > diff --git a/block/linux-aio.c b/block/linux-aio.c > index 70312a4..0cb098d 100644 > --- a/block/linux-aio.c > +++ b/block/linux-aio.c > @@ -282,12 +282,17 @@ static int ioq_enqueue(struct qemu_laio_state *s, s= truct iocb *iocb) > s->io_q.iocbs[idx++] =3D iocb; > s->io_q.idx =3D idx; > =20 > - /* submit immediately if queue depth is above 2/3 */ > - if (idx > s->io_q.size * 2 / 3) { > - return ioq_submit(s); > + /* > + * This is reached in two cases: queue not plugged but io_submit > + * returned -EAGAIN, or queue plugged. In the latter case, start > + * submitting some I/O if the queue is getting too full. In the > + * former case, instead, wait until an I/O operation is completed. > + */ > + if (!s->io_q.plugged || likely(idx < s->io_q.size * 2 / 3)) { > + return 0; > } > =20 > - return 0; > + return ioq_submit(s); Same as in the previous patch, the ioq_submit() return value is not meaningful to ioq_enqueue() callers. It should not be returned. --RASg3xLB4tUQ4RcS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUc3/fAAoJEJykq7OBq3PIZdAH/itrPRlvKzHP8cY1/MQGwF0a rgfgUsZTKrGd6KUq4PLlts9h6z9Z0m74USN978sAOmfLojE8S5ZjjIej8BWeFB4O wnP/KEjGBHviYwh4ioy7fURyaLAYP4SzWpMsXXBwBKJYTbYXb60Vvr3MwnCR6b1+ W+777wzwdzDhaTkc3UX+3xI0oAS3ai7P7Xf8TxoKmoRHVXU2HXbg/xTFQk+kl/9T dgVoJwZbHo7QK3zY4EDFu76wNk++jOIj/K5vFMa0CF5j37+veLdw4b5LWeKfvgch u7q6+Ok0eZNrSb4eoJsXoxXqMyhP8Nuw+jSp5mzyYdvqp3qJE4OILcG3X+ZkGNw= =S8Gs -----END PGP SIGNATURE----- --RASg3xLB4tUQ4RcS--