All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: Re: [PATCH] stubdom: optimize block io completion polling
Date: Wed, 13 Feb 2008 15:57:38 +0000	[thread overview]
Message-ID: <20080213155738.GC10579@implementation.uk.xensource.com> (raw)
In-Reply-To: <20080213135959.GB10579@implementation.uk.xensource.com>

Samuel Thibault, le Wed 13 Feb 2008 13:59:59 +0000, a écrit :
> stubdom: optimize block io completion polling
> by not polling all the time but just when some requests have completed.

Oops, sorry, although it never happened during my tests, I'm pretty sure
there is a race, please use this patch instead:

stubdom: optimize block io completion polling
by not polling all the time but just when some requests have completed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>

diff -r e85399173769 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Tue Feb 12 16:59:08 2008 +0000
+++ b/extras/mini-os/blkfront.c	Wed Feb 13 15:55:47 2008 +0000
@@ -327,6 +327,11 @@
     struct blkif_response *rsp;
 
 moretodo:
+#ifdef HAVE_LIBC
+    files[dev->fd].read = 0;
+    mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
+#endif
+
     rp = dev->ring.sring->rsp_prod;
     rmb(); /* Ensure we see queued responses up to 'rp'. */
     cons = dev->ring.rsp_cons;
--- a/tools/ioemu/block-vbd.c	Tue Feb 12 16:59:08 2008 +0000
+++ b/tools/ioemu/block-vbd.c	Wed Feb 13 15:55:47 2008 +0000
@@ -67,6 +67,12 @@
     return 100;
 }
 
+static void vbd_io_completed(void *opaque)
+{
+    BDRVVbdState *s = opaque;
+    blkfront_aio_poll(s->dev);
+}
+
 static int vbd_open(BlockDriverState *bs, const char *filename, int flags)
 {
     BDRVVbdState *s = bs->opaque;
@@ -85,6 +91,7 @@
     }
 
     s->fd = blkfront_open(s->dev);
+    qemu_set_fd_handler(s->fd, vbd_io_completed, NULL, s);
 
     QEMU_LIST_INSERT_HEAD(&vbds, s, list);
 
@@ -102,9 +109,6 @@
 
 void qemu_aio_poll(void)
 {
-    BDRVVbdState *s;
-    for (s = vbds.lh_first; s; s = s->list.le_next)
-	blkfront_aio_poll(s->dev);
 }
 
 /* Wait for all IO requests to complete.  */

      reply	other threads:[~2008-02-13 15:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 13:59 [PATCH] stubdom: optimize block io completion polling Samuel Thibault
2008-02-13 15:57 ` Samuel Thibault [this message]

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=20080213155738.GC10579@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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.