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

Re: [win-pv-devel] [PATCH 1/4] Replace XENVBD_SRB_STATE with LIST_ENTRY


  • To: Owen Smith <owen.smith@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
  • Date: Tue, 17 Sep 2019 14:51:18 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=Paul.Durrant@xxxxxxxxxx; spf=Pass smtp.mailfrom=Paul.Durrant@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Tue, 17 Sep 2019 14:51:48 +0000
  • Ironport-sdr: 9jm7fkqXEYCiODALf8qLxaYUJdtqOp8e3e+EXOzOqRCg65l6KSeYMDCCEdaP8SPHkjDn9s0zSD bb+KSVjGQp/KARYxKv2j6BuB7T57xVpmHkX2ql8XHsJB39jQqmhhRvPQquliUNDOWGOCUj4L5G IPG9DPq5HqnvVhSybByUO7QLwQU0dDUsba1jgGMpXJ95jkZTsk76NCWKZLQkfKtwtabfokEhnu uiLEfxfE1fNa6gxgLu7ZzbKbWyby5xf9/DJFSX+qNBiN2RFUiKDF9Lv3/cLcwJBNppWTfA0gKj J5k=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHVbKKIDVVLaG+OHkOohjIkdQA3Uacv89oQ
  • Thread-topic: [win-pv-devel] [PATCH 1/4] Replace XENVBD_SRB_STATE with LIST_ENTRY

> -----Original Message-----
> From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of 
> Owen Smith
> Sent: 16 September 2019 16:18
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH 1/4] Replace XENVBD_SRB_STATE with LIST_ENTRY
> 
> Dont treat the prepared queue differently to any other list.
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>  src/xenvbd/ring.c | 52 +++++++++++++++++++---------------------------------
>  1 file changed, 19 insertions(+), 33 deletions(-)
> 
> diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
> index 2b3538e..52eaca5 100644
> --- a/src/xenvbd/ring.c
> +++ b/src/xenvbd/ring.c
> @@ -58,11 +58,6 @@
>  #define xen_mb  KeMemoryBarrier
>  #define xen_wmb KeMemoryBarrier
> 
> -typedef struct _XENVBD_SRB_STATE {
> -    LIST_ENTRY                      List;
> -    ULONG                           Count;
> -} XENVBD_SRB_STATE, *PXENVBD_SRB_STATE;
> -
>  typedef struct _XENVBD_BLKIF_RING {
>      PXENVBD_RING                    Ring;
>      ULONG                           Index;
> @@ -83,8 +78,8 @@ typedef struct _XENVBD_BLKIF_RING {
>      BOOLEAN                         Stopped;
>      PVOID                           Lock;
>      PKTHREAD                        LockThread;
> -    XENVBD_SRB_STATE                State;
>      LIST_ENTRY                      SrbQueue;
> +    LIST_ENTRY                      PreparedQueue;
>      LIST_ENTRY                      SubmittedList;

Probably not for this patch but it would be nice to have consistent naming 
here. So IMO s/SubmittedList/SubmittedQueue/g?

>      LIST_ENTRY                      ShutdownQueue;
>      ULONG                           SrbsQueued;
> @@ -613,8 +608,6 @@ BlkifRingQueueRequests(
>      IN  PLIST_ENTRY         List
>      )
>  {
> -    PXENVBD_SRB_STATE       State = &BlkifRing->State;
> -
>      for (;;) {
>          PLIST_ENTRY         ListEntry;
>          PXENVBD_REQUEST     Request;
> @@ -627,8 +620,7 @@ BlkifRingQueueRequests(
>                                      XENVBD_REQUEST,
>                                      ListEntry);
> 
> -        InsertTailList(&State->List, ListEntry);
> -        State->Count++;
> +        InsertTailList(&BlkifRing->PreparedQueue, ListEntry);
>      }
>  }
> 
> @@ -1089,25 +1081,19 @@ __BlkifRingPostRequests(
>      IN  PXENVBD_BLKIF_RING  BlkifRing
>      )
>  {
> -    PXENVBD_SRB_STATE       State;
> -
> -    State = &BlkifRing->State;
> -
>      for (;;) {
>          blkif_request_t     *req;
>          PXENVBD_REQUEST     Request;
>          PLIST_ENTRY         ListEntry;
> 
> -        if (State->Count == 0)
> +        if (IsListEmpty(&BlkifRing->PreparedQueue))
>              return STATUS_SUCCESS;
> 
>          if (RING_FULL(&BlkifRing->Front))
>              return STATUS_ALLOTTED_SPACE_EXCEEDED;
> 
> -        --State->Count;
> -
> -        ListEntry = RemoveHeadList(&State->List);
> -        ASSERT3P(ListEntry, != , &State->List);
> +        ListEntry = RemoveHeadList(&BlkifRing->PreparedQueue);
> +        ASSERT3P(ListEntry, != , &BlkifRing->PreparedQueue);
> 
>          RtlZeroMemory(ListEntry, sizeof(LIST_ENTRY));
> 
> @@ -1376,13 +1362,11 @@ BlkifRingSchedule(
>      IN  PXENVBD_BLKIF_RING  BlkifRing
>      )
>  {
> -    PXENVBD_SRB_STATE       State;
>      BOOLEAN                 Polled;
> 
>      if (!BlkifRing->Enabled)
>          return;
> 
> -    State = &BlkifRing->State;
>      Polled = FALSE;
> 
>      while (!BlkifRing->Stopped) {
> @@ -1390,7 +1374,7 @@ BlkifRingSchedule(
>          PXENVBD_SRBEXT      SrbExt;
>          NTSTATUS            status;
> 
> -        if (State->Count != 0) {
> +        if (!IsListEmpty(&BlkifRing->PreparedQueue)) {
>              status = __BlkifRingPostRequests(BlkifRing);
>              if (!NT_SUCCESS(status))
>                  BlkifRing->Stopped = TRUE;
> @@ -1685,7 +1669,7 @@ BlkifRingCreate(
>      InitializeListHead(&(*BlkifRing)->SrbQueue);
>      InitializeListHead(&(*BlkifRing)->ShutdownQueue);
>      InitializeListHead(&(*BlkifRing)->SubmittedList);
> -    InitializeListHead(&(*BlkifRing)->State.List);
> +    InitializeListHead(&(*BlkifRing)->PreparedQueue);
> 
>      KeInitializeThreadedDpc(&(*BlkifRing)->Dpc, BlkifRingDpc, *BlkifRing);
> 
> @@ -1780,7 +1764,7 @@ fail4:
> 
>      RtlZeroMemory(&(*BlkifRing)->Dpc, sizeof(KDPC));
> 
> -    RtlZeroMemory(&(*BlkifRing)->State.List, sizeof(LIST_ENTRY));
> +    RtlZeroMemory(&(*BlkifRing)->PreparedQueue, sizeof(LIST_ENTRY));
>      RtlZeroMemory(&(*BlkifRing)->SubmittedList, sizeof(LIST_ENTRY));
>      RtlZeroMemory(&(*BlkifRing)->ShutdownQueue, sizeof(LIST_ENTRY));
>      RtlZeroMemory(&(*BlkifRing)->SrbQueue, sizeof(LIST_ENTRY));
> @@ -1827,12 +1811,16 @@ BlkifRingDestroy(
> 
>      RtlZeroMemory(&BlkifRing->Dpc, sizeof(KDPC));
> 
> -    ASSERT3U(BlkifRing->State.Count, == , 0);
> -    ASSERT(IsListEmpty(&BlkifRing->State.List));
> -    RtlZeroMemory(&BlkifRing->State.List, sizeof(LIST_ENTRY));
> +    ASSERT(IsListEmpty(&BlkifRing->PreparedQueue));
> +    RtlZeroMemory(&BlkifRing->PreparedQueue, sizeof(LIST_ENTRY));
> 
> +    ASSERT(IsListEmpty(&BlkifRing->SubmittedList));
>      RtlZeroMemory(&BlkifRing->SubmittedList, sizeof(LIST_ENTRY));
> +
> +    ASSERT(IsListEmpty(&BlkifRing->SrbQueue));
>      RtlZeroMemory(&BlkifRing->SrbQueue, sizeof(LIST_ENTRY));
> +
> +    ASSERT(IsListEmpty(&BlkifRing->ShutdownQueue));
>      RtlZeroMemory(&BlkifRing->ShutdownQueue, sizeof(LIST_ENTRY));
> 
>      __RingFree(BlkifRing->Path);
> @@ -2065,15 +2053,15 @@ BlkifRingDisable(
>      ASSERT(BlkifRing->Enabled);
> 
>      // Discard any pending requests
> -    while (!IsListEmpty(&BlkifRing->State.List)) {
> +    for (;;) {

What's wrong with using !IsListEmpty(&BlkifRing->PreparedQueue)?

  Paul

>          PLIST_ENTRY         ListEntry;
>          PXENVBD_REQUEST     Request;
>          PXENVBD_SRBEXT      SrbExt;
>          PSCSI_REQUEST_BLOCK Srb;
> 
> -        ListEntry = RemoveHeadList(&BlkifRing->State.List);
> -        ASSERT3P(ListEntry, != , &BlkifRing->State.List);
> -        --BlkifRing->State.Count;
> +        ListEntry = RemoveHeadList(&BlkifRing->PreparedQueue);
> +        if (ListEntry  == &BlkifRing->PreparedQueue)
> +            break;
> 
>          Request = CONTAINING_RECORD(ListEntry,
>                                      XENVBD_REQUEST,
> @@ -2089,8 +2077,6 @@ BlkifRingDisable(
>              __BlkifRingCompleteSrb(BlkifRing, SrbExt);
>      }
> 
> -    ASSERT3U(BlkifRing->State.Count, == , 0);
> -
>      Attempt = 0;
>      ASSERT3U(BlkifRing->RequestsPushed, == , BlkifRing->RequestsPosted);
>      while (BlkifRing->ResponsesProcessed != BlkifRing->RequestsPushed) {
> --
> 2.16.2.windows.1
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/win-pv-devel
_______________________________________________
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®.