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

[win-pv-devel] [PATCH] Rework request submission


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Thu, 5 Sep 2019 14:37:45 +0100
  • Authentication-results: esa1.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: Thu, 05 Sep 2019 13:38:11 +0000
  • Ironport-sdr: pgUxbqNXgPShkB2TjYev4tYC7606tA6nCms1Y4uYQDh1N/gJt2r8igCwBzrirxSgK6uHjjLase bs412/bTpJGAd8RAl+7fgm0mrXoSVXS7enjqOFnu7Q04px/xvTN8qL5ZeiJjlCa57a1eHRhdWb +saS3GYhfBbMgAMtJJUCwUuuHI8c3W0PRpzaYTW+3wonNYIIRx6kn0h5WDgyz2x/BkhgAVJNEb 52SMR4oGfLNeFvIk/lYk60/L4sGEsEgfCfC6MX7gDeuABGAPovRVg/x4LouWit3DZh5UpFGSxC Zcg=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Make BlkifRingPostRequests return success for submitting 0 or more requests,
or failure when the ring is full. This prevents the loop in BlkifRingSchedule
from preparing the next SRB when the ring is already full.
Also attempt to notify the backend of changes every iteration of the loop in
BlkifRingSchedule, to trigger the backend as soon as possible.

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

diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index 45a885d..2b3538e 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -1089,28 +1089,21 @@ __BlkifRingPostRequests(
     IN  PXENVBD_BLKIF_RING  BlkifRing
     )
 {
-#define RING_SLOTS_AVAILABLE(_Front, _req_prod, _rsp_cons)   \
-        (RING_SIZE(_Front) - ((_req_prod) - (_rsp_cons)))
-
     PXENVBD_SRB_STATE       State;
-    RING_IDX                req_prod;
-    RING_IDX                rsp_cons;
-    NTSTATUS                status;
 
     State = &BlkifRing->State;
 
-    req_prod = BlkifRing->Front.req_prod_pvt;
-    rsp_cons = BlkifRing->Front.rsp_cons;
-
-    status = STATUS_ALLOTTED_SPACE_EXCEEDED;
-    if (RING_SLOTS_AVAILABLE(&BlkifRing->Front, req_prod, rsp_cons) <= 1)
-        goto fail1;
-
-    while (State->Count != 0) {
+    for (;;) {
         blkif_request_t     *req;
         PXENVBD_REQUEST     Request;
         PLIST_ENTRY         ListEntry;
 
+        if (State->Count == 0)
+            return STATUS_SUCCESS;
+
+        if (RING_FULL(&BlkifRing->Front))
+            return STATUS_ALLOTTED_SPACE_EXCEEDED;
+
         --State->Count;
 
         ListEntry = RemoveHeadList(&State->List);
@@ -1122,8 +1115,8 @@ __BlkifRingPostRequests(
                                     XENVBD_REQUEST,
                                     ListEntry);
 
-        req = RING_GET_REQUEST(&BlkifRing->Front, req_prod);
-        req_prod++;
+        req = RING_GET_REQUEST(&BlkifRing->Front, 
BlkifRing->Front.req_prod_pvt);
+        BlkifRing->Front.req_prod_pvt++;
         BlkifRing->RequestsPosted++;
 
         __BlkifRingInsertRequest(BlkifRing,
@@ -1131,19 +1124,7 @@ __BlkifRingPostRequests(
                                  req);
 
         InsertTailList(&BlkifRing->SubmittedList, ListEntry);
-
-        if (RING_SLOTS_AVAILABLE(&BlkifRing->Front, req_prod, rsp_cons) <= 1)
-            break;
     }
-
-    BlkifRing->Front.req_prod_pvt = req_prod;
-
-    return STATUS_SUCCESS;
-
-fail1:
-    return status;
-
-#undef  RING_SLOTS_AVAILABLE
 }
 
 static FORCEINLINE PXENVBD_REQUEST
@@ -1424,9 +1405,7 @@ BlkifRingSchedule(
             continue;
         }
 
-        if (BlkifRing->RequestsPosted - BlkifRing->RequestsPushed >=
-            RING_SIZE(&BlkifRing->Front) / 4)
-            __BlkifRingPushRequests(BlkifRing);
+        __BlkifRingPushRequests(BlkifRing);
 
         if (IsListEmpty(&BlkifRing->SrbQueue))
             break;
-- 
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®.