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

Re: [win-pv-devel] [PATCH v2 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: Wed, 18 Sep 2019 15:41:56 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: esa5.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: Wed, 18 Sep 2019 15:42:13 +0000
  • Ironport-sdr: JenMxW5nwmCWSHSVtYBSF6Ly9xVndFpWiDpMbTZHUWAJ4yQqMsjQXk25EBOT3/zzcU8tT37bDj pZV9WHuc/cwYtdwrLYyF4nLAjmTj34Da+Jxa7BXHM2ZYxXU49NrD47cC4xVX4gNgGXle4DqpEi SE/8DfIyf57udagNr1oNv4vlVoNY9UhuSTx7jr2lRIkweasapkWZH/DLs/mRgJb4rz5brzxFpX 5oYcrCjb00xTcq+twrujNQW2ZPLHlp3aZPJeYXMoT1eVYI/PVsL3p0cbOJO3YiGEQ2GjXXDe99 cpI=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHVbiSh+wr5djk1v0KDR7rZ1u5OSacxkV/w
  • Thread-topic: [win-pv-devel] [PATCH v2 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: 18 September 2019 14:25
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH v2 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>

Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
>  src/xenvbd/ring.c | 51 ++++++++++++++++++---------------------------------
>  1 file changed, 18 insertions(+), 33 deletions(-)
> 
> diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
> index 2b3538e..514374c 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;
>      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,14 @@ BlkifRingDisable(
>      ASSERT(BlkifRing->Enabled);
> 
>      // Discard any pending requests
> -    while (!IsListEmpty(&BlkifRing->State.List)) {
> +    while (!IsListEmpty(&BlkifRing->PreparedQueue)) {
>          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);
> +        ASSERT3P(ListEntry, !=, &BlkifRing->PreparedQueue);
> 
>          Request = CONTAINING_RECORD(ListEntry,
>                                      XENVBD_REQUEST,
> @@ -2089,8 +2076,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®.