[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH v2 4/4] Attempt to process responses on the ring


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Wed, 18 Sep 2019 14:25:17 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=owen.smith@xxxxxxxxxx; spf=Pass smtp.mailfrom=owen.smith@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Wed, 18 Sep 2019 13:26:03 +0000
  • Ironport-sdr: C2FxRjUmEzuh0gd4ZBrbSV57NuJmrhCLMv6HfMv+01xf3GnXfcSpL4IfyQX+jQHeK+VEOxeenY 0VAJWV6wHGQNtUg9EkcpU8E//ZXWS4dRjc8pmhRVq3cmTpY4DMrV5trbSsasCIueQVo9ZbJNLo rooTaCY3Grd+ku/QFnhvHonVUng0oFD8sKWj0rgeSp3xaYjD1QM5D8SESKWRcJtB0QSzs3A7pc sayHfLtyZ9tLkm58RAeFpVXdNsRJe8+eC2daRQhp6ZzIchLfz51MfZ3xXIcZcogOsB68sZ02iD dJo=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

When Disabling the ring, outstanding responses need to be completed.
Poll the ring to complete outstanding responses if the backend is still
connected and valid.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/ring.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index 8dcdee3..4bb7475 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -2044,11 +2044,57 @@ BlkifRingDisable(
     IN  PXENVBD_BLKIF_RING  BlkifRing
     )
 {
+    PXENVBD_RING            Ring;
+    PCHAR                   Buffer;
+    XenbusState             State;
+    NTSTATUS                status;
+
+    Ring = BlkifRing->Ring;
+
     Trace("====> %u\n", BlkifRing->Index);
 
     __BlkifRingAcquireLock(BlkifRing);
     ASSERT(BlkifRing->Enabled);
 
+    status = XENBUS_STORE(Read,
+                          &Ring->StoreInterface,
+                          NULL,
+                          FrontendGetBackendPath(Ring->Frontend),
+                          "state",
+                          &Buffer);
+    if (!NT_SUCCESS(status)) {
+        State = XenbusStateUnknown;
+    } else {
+        State = (XenbusState) strtol(Buffer, NULL, 10);
+
+        XENBUS_STORE(Free,
+                     &Ring->StoreInterface,
+                     Buffer);
+    }
+
+    if (State == XenbusStateConnected) {
+        ULONG               Attempt;
+
+        Attempt = 0;
+        ASSERT3U(BlkifRing->RequestsPushed, ==, BlkifRing->RequestsPosted);
+        while (BlkifRing->ResponsesProcessed != BlkifRing->RequestsPushed) {
+            Attempt++;
+            if (Attempt > 100)
+                break;
+
+            // Try to move things along
+            __BlkifRingSend(BlkifRing);
+            (VOID) BlkifRingPoll(BlkifRing);
+
+            // We are waiting for a watch event at DISPATCH_LEVEL so
+            // it is our responsibility to poll the store ring.
+            XENBUS_STORE(Poll,
+                         &Ring->StoreInterface);
+
+            KeStallExecutionProcessor(1000);    // 1ms
+        }
+    }
+
     BlkifRing->Enabled = FALSE;
 
     while (!IsListEmpty(&BlkifRing->SubmittedList)) {
-- 
2.16.2.windows.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.