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

[win-pv-devel] [PATCH 1/5] Remove RingReQueueRequests



From: Owen Smith <owen.smith@xxxxxxxxxx>

Since the Frontend transitions the ring through Closed and back to
Enabled on a resume from suspend, which aborts all queued and
prepared requests, de-queueing and re-queuing all requests from the
Target suspend callback is unneccessary. Also removes the Target
suspend callback and interface which is now unused.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/ring.c   | 68 -----------------------------------------------------
 src/xenvbd/ring.h   |  5 ----
 src/xenvbd/target.c | 64 +++----------------------------------------------
 3 files changed, 3 insertions(+), 134 deletions(-)

diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index cbb408d..7008938 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -2220,71 +2220,3 @@ RingQueueShutdown(
     if (KeInsertQueueDpc(&Ring->Dpc, NULL, NULL))
            ++Ring->Dpcs;
 }
-
-VOID
-RingReQueueRequests(
-    IN  PXENVBD_RING    Ring
-    )
-{
-    LIST_ENTRY      List;
-
-    InitializeListHead(&List);
-
-    // pop all submitted requests, cleanup and add associated SRB to a list
-    for (;;) {
-        PXENVBD_SRBEXT      SrbExt;
-        PXENVBD_REQUEST     Request;
-        PLIST_ENTRY         ListEntry;
-
-        ListEntry = QueuePop(&Ring->SubmittedReqs);
-        if (ListEntry == NULL)
-            break;
-        Request = CONTAINING_RECORD(ListEntry, XENVBD_REQUEST, ListEntry);
-        SrbExt = Request->SrbExt;
-
-        RingPutRequest(Ring, Request);
-
-        if (InterlockedDecrement(&SrbExt->RequestCount) == 0) {
-            InsertTailList(&List, &SrbExt->ListEntry);
-        }
-    }
-
-    // pop all prepared requests, cleanup and add associated SRB to a list
-    for (;;) {
-        PXENVBD_SRBEXT      SrbExt;
-        PXENVBD_REQUEST     Request;
-        PLIST_ENTRY         ListEntry;
-
-        ListEntry = QueuePop(&Ring->PreparedReqs);
-        if (ListEntry == NULL)
-            break;
-        Request = CONTAINING_RECORD(ListEntry, XENVBD_REQUEST, ListEntry);
-        SrbExt = Request->SrbExt;
-
-        RingPutRequest(Ring, Request);
-
-        if (InterlockedDecrement(&SrbExt->RequestCount) == 0) {
-            InsertTailList(&List, &SrbExt->ListEntry);
-        }
-    }
-
-    // foreach SRB in list, put on start of FreshSrbs
-    for (;;) {
-        PXENVBD_SRBEXT      SrbExt;
-        PLIST_ENTRY         ListEntry;
-
-        ListEntry = RemoveTailList(&List);
-        if (ListEntry == &List)
-            break;
-        SrbExt = CONTAINING_RECORD(ListEntry, XENVBD_SRBEXT, ListEntry);
-
-        QueueUnPop(&Ring->FreshSrbs, &SrbExt->ListEntry);
-    }
-
-    // now the first set of requests popped off submitted list is the next SRB
-    // to be popped off the fresh list
-
-    Verbose("Target[%d] : %d Fresh SRBs\n",
-            FrontendGetTargetId(Ring->Frontend),
-            QueueCount(&Ring->FreshSrbs));
-}
diff --git a/src/xenvbd/ring.h b/src/xenvbd/ring.h
index 003f1ea..81f4e99 100644
--- a/src/xenvbd/ring.h
+++ b/src/xenvbd/ring.h
@@ -91,9 +91,4 @@ RingQueueShutdown(
     IN  PXENVBD_SRBEXT  SrbExt
     );
 
-extern VOID
-RingReQueueRequests(
-    IN  PXENVBD_RING    Ring
-    );
-
 #endif // _XENVBD_RING_H
diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
index e46459b..4407c70 100644
--- a/src/xenvbd/target.c
+++ b/src/xenvbd/target.c
@@ -67,9 +67,7 @@ struct _XENVBD_TARGET {
     // Frontend (Ring, includes XenBus interfaces)
     PXENVBD_FRONTEND            Frontend;
     XENBUS_DEBUG_INTERFACE      DebugInterface;
-    XENBUS_SUSPEND_INTERFACE    SuspendInterface;
     PXENBUS_DEBUG_CALLBACK      DebugCallback;
-    PXENBUS_SUSPEND_CALLBACK    SuspendCallback;
 
     // Eject
     BOOLEAN                     WrittenEjected;
@@ -1159,23 +1157,6 @@ TargetDebugCallback(
                  Target->Missing ? Target->Reason : "Not Missing");
 }
 
-static DECLSPEC_NOINLINE VOID
-TargetSuspendCallback(
-    IN  PVOID       Argument
-    )
-{
-    PXENVBD_TARGET  Target = Argument;
-
-    RingReQueueRequests(FrontendGetRing(Target->Frontend));
-
-    Verbose("Target[%d] : %s (%s)\n",
-            TargetGetTargetId(Target),
-            Target->Missing ? "MISSING" : "NOT_MISSING",
-            Target->Reason);
-    Target->Missing = FALSE;
-    Target->Reason = NULL;
-}
-
 NTSTATUS
 TargetD3ToD0(
     IN  PXENVBD_TARGET  Target
@@ -1191,8 +1172,6 @@ TargetD3ToD0(
 
     AdapterGetDebugInterface(TargetGetAdapter(Target),
                              &Target->DebugInterface);
-    AdapterGetSuspendInterface(TargetGetAdapter(Target),
-                               &Target->SuspendInterface);
 
     status = XENBUS_DEBUG(Acquire, &Target->DebugInterface);
     if (!NT_SUCCESS(status))
@@ -1207,44 +1186,19 @@ TargetD3ToD0(
     if (!NT_SUCCESS(status))
         goto fail2;
 
-    status = XENBUS_SUSPEND(Acquire, &Target->SuspendInterface);
-    if (!NT_SUCCESS(status))
-        goto fail3;
-
-    status = XENBUS_SUSPEND(Register,
-                            &Target->SuspendInterface,
-                            SUSPEND_CALLBACK_LATE,
-                            TargetSuspendCallback,
-                            Target,
-                            &Target->SuspendCallback);
-    if (!NT_SUCCESS(status))
-        goto fail4;
-
     status = FrontendD3ToD0(Target->Frontend);
     if (!NT_SUCCESS(status))
-        goto fail5;
+        goto fail3;
 
     status = FrontendSetState(Target->Frontend, XENVBD_ENABLED);
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail4;
 
     return STATUS_SUCCESS;
 
-fail6:
-    Error("fail6\n");
-    FrontendD0ToD3(Target->Frontend);
-
-fail5:
-    Error("fail5\n");
-    XENBUS_SUSPEND(Deregister,
-                   &Target->SuspendInterface,
-                   Target->SuspendCallback);
-    Target->SuspendCallback = NULL;
-
 fail4:
     Error("fail4\n");
-    XENBUS_SUSPEND(Release,
-                   &Target->SuspendInterface);
+    FrontendD0ToD3(Target->Frontend);
 
 fail3:
     Error("fail3\n");
@@ -1261,8 +1215,6 @@ fail2:
 fail1:
     Error("Fail1 (%08x)\n", status);
 
-    RtlZeroMemory(&Target->SuspendInterface,
-                  sizeof(XENBUS_SUSPEND_INTERFACE));
     RtlZeroMemory(&Target->DebugInterface,
                   sizeof(XENBUS_DEBUG_INTERFACE));
     Target->DevicePowerState = PowerDeviceD3;
@@ -1286,14 +1238,6 @@ TargetD0ToD3(
 
     FrontendD0ToD3(Target->Frontend);
 
-    XENBUS_SUSPEND(Deregister,
-                   &Target->SuspendInterface,
-                   Target->SuspendCallback);
-    Target->SuspendCallback = NULL;
-
-    XENBUS_SUSPEND(Release,
-                   &Target->SuspendInterface);
-
     XENBUS_DEBUG(Deregister,
                  &Target->DebugInterface,
                  Target->DebugCallback);
@@ -1302,8 +1246,6 @@ TargetD0ToD3(
     XENBUS_DEBUG(Release,
                  &Target->DebugInterface);
 
-    RtlZeroMemory(&Target->SuspendInterface,
-                  sizeof(XENBUS_SUSPEND_INTERFACE));
     RtlZeroMemory(&Target->DebugInterface,
                   sizeof(XENBUS_DEBUG_INTERFACE));
 }
-- 
2.8.3


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

 


Rackspace

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