WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] minios: blkfront_aio_poll may reenter

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: blkfront_aio_poll may reenter
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Mar 2008 05:30:14 -0700
Delivery-date: Thu, 27 Mar 2008 05:30:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206537300 0
# Node ID 6327432958e6fa48d9c29cf14fce055618ee629a
# Parent  d02490be30f5dcda46d98d25d81144a66d16eef9
minios: blkfront_aio_poll may reenter
if the callback calls blkfront_sync for instance.
In such a case, we would see responses and hence release grants
several times. We need to be more synchronous and stop when we detect
that we have re-entered.
This fixes HVM restore with stubdomains.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/blkfront.c |   25 ++++++++++++++-----------
 extras/mini-os/minios.mk  |    8 ++++----
 2 files changed, 18 insertions(+), 15 deletions(-)

diff -r d02490be30f5 -r 6327432958e6 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Wed Mar 26 13:13:50 2008 +0000
+++ b/extras/mini-os/blkfront.c Wed Mar 26 13:15:00 2008 +0000
@@ -319,6 +319,7 @@ int blkfront_aio_poll(struct blkfront_de
 {
     RING_IDX rp, cons;
     struct blkif_response *rsp;
+    int more;
 
 moretodo:
 #ifdef HAVE_LIBC
@@ -334,6 +335,7 @@ moretodo:
     while ((cons != rp))
     {
        rsp = RING_GET_RESPONSE(&dev->ring, cons);
+       nr_consumed++;
 
         if (rsp->status != BLKIF_RSP_OKAY)
             printk("block error %d for op %d\n", rsp->status, rsp->operation);
@@ -343,29 +345,30 @@ moretodo:
         case BLKIF_OP_WRITE:
         {
             struct blkfront_aiocb *aiocbp = (void*) (uintptr_t) rsp->id;
+            int status = rsp->status;
             int j;
 
             for (j = 0; j < aiocbp->n; j++)
                 gnttab_end_access(aiocbp->gref[j]);
 
+            dev->ring.rsp_cons = ++cons;
             /* Nota: callback frees aiocbp itself */
-            aiocbp->aio_cb(aiocbp, rsp->status ? -EIO : 0);
+            aiocbp->aio_cb(aiocbp, status ? -EIO : 0);
+            if (dev->ring.rsp_cons != cons)
+                /* We reentered, we must not continue here */
+                goto out;
             break;
         }
+        default:
+            printk("unrecognized block operation %d response\n", 
rsp->operation);
         case BLKIF_OP_WRITE_BARRIER:
         case BLKIF_OP_FLUSH_DISKCACHE:
-            break;
-        default:
-            printk("unrecognized block operation %d response\n", 
rsp->operation);
+            dev->ring.rsp_cons = ++cons;
             break;
         }
-
-       nr_consumed++;
-       ++cons;
-    }
-    dev->ring.rsp_cons = cons;
-
-    int more;
+    }
+
+out:
     RING_FINAL_CHECK_FOR_RESPONSES(&dev->ring, more);
     if (more) goto moretodo;
 
diff -r d02490be30f5 -r 6327432958e6 extras/mini-os/minios.mk
--- a/extras/mini-os/minios.mk  Wed Mar 26 13:13:50 2008 +0000
+++ b/extras/mini-os/minios.mk  Wed Mar 26 13:15:00 2008 +0000
@@ -16,10 +16,10 @@ DEF_LDFLAGS =
 
 ifeq ($(debug),y)
 DEF_CFLAGS += -g
-#DEF_CFLAGS += MM_DEBUG
-#DEF_CFLAGS += FS_DEBUG
-#DEF_CFLAGS += LIBC_DEBUG
-#DEF_CFLAGS += GNT_DEBUG
+#DEF_CFLAGS += -DMM_DEBUG
+#DEF_CFLAGS += -DFS_DEBUG
+#DEF_CFLAGS += -DLIBC_DEBUG
+DEF_CFLAGS += -DGNT_DEBUG
 else
 DEF_CFLAGS += -O3
 endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: blkfront_aio_poll may reenter, Xen patchbot-unstable <=