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

Re: [win-pv-devel] [PATCH v2 2/4] Fail SRBs if ring is not Enabled


  • 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:43:08 +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: Wed, 18 Sep 2019 15:43:20 +0000
  • Ironport-sdr: Amd/azNUQCzy/ASnyJYivEdCcuhfjM/YSoBnSz64xxW0rg62s8qRjyRWc2nQEpQeB+BHbTK9Kj Pa5eZpci2DwGuFdkhwFrVCmUzFKdwEXOzeMWf2CwE+OeXtJ1rIBaBSDBg2WfrAGY5KhT0LYepP BoSlK4YK82KfwUTyoc0+V5Wgc2x8nLXNk19EzKgIEKktHMRAsCtjqzWHS3gkbsS1cJSU/B5m2R 5rh3MFCzsEO+p5hMOjuP2DNn3UVM8VNQAr4TjLR5bLs62XK2WGDs7YRZyixWjsWu2xPrv1MGC0 o18=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHVbiSoIqyKSVQ2SU2ldsgHC+kjkacxkxSw
  • Thread-topic: [win-pv-devel] [PATCH v2 2/4] Fail SRBs if ring is not Enabled

> -----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 2/4] Fail SRBs if ring is not Enabled
> 
> Dont queue incomming SRBs if the ring is not able to process requests.

^ incoming

> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

I already acked this. I'll fix the spelling error on commit.

  Paul

> ---
>  src/xenvbd/adapter.c |  6 ++----
>  src/xenvbd/ring.c    | 34 +++++++++++++++++++++++++++-------
>  src/xenvbd/ring.h    |  2 +-
>  src/xenvbd/target.c  |  8 ++++----
>  src/xenvbd/target.h  |  4 ++--
>  5 files changed, 36 insertions(+), 18 deletions(-)
> 
> diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c
> index 79a5a0e..2d8d65f 100644
> --- a/src/xenvbd/adapter.c
> +++ b/src/xenvbd/adapter.c
> @@ -1993,13 +1993,11 @@ AdapterHwStartIo(
>          break;
> 
>      case SRB_FUNCTION_FLUSH:
> -        TargetFlush(Target, SrbExt);
> -        WasQueued = TRUE;
> +        WasQueued = TargetFlush(Target, SrbExt);
>          break;
> 
>      case SRB_FUNCTION_SHUTDOWN:
> -        TargetShutdown(Target, SrbExt);
> -        WasQueued = TRUE;
> +        WasQueued = TargetShutdown(Target, SrbExt);
>          break;
> 
>      default:
> diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
> index 514374c..6edee5c 100644
> --- a/src/xenvbd/ring.c
> +++ b/src/xenvbd/ring.c
> @@ -2147,7 +2147,7 @@ BlkifRingDisconnect(
>      Trace("<==== %u\n", BlkifRing->Index);
>  }
> 
> -static VOID
> +static BOOLEAN
>  __BlkifRingQueueSrb(
>      IN  PXENVBD_BLKIF_RING  BlkifRing,
>      IN  PXENVBD_SRBEXT      SrbExt
> @@ -2158,6 +2158,9 @@ __BlkifRingQueueSrb(
>      ULONG_PTR               LockBit;
>      ULONG_PTR               New;
> 
> +    if (!BlkifRing->Enabled)
> +        goto fail1;
> +
>      ListEntry = &SrbExt->ListEntry;
> 
>      do {
> @@ -2177,17 +2180,36 @@ __BlkifRingQueueSrb(
> 
>      if (__BlkifRingTryAcquireLock(BlkifRing))
>          __BlkifRingReleaseLock(BlkifRing);
> +
> +    return TRUE;
> +
> +fail1:
> +    Error("fail1\n");
> +
> +    SrbExt->Srb->SrbStatus = SRB_STATUS_BUSY;
> +    return FALSE;
>  }
> 
> -static VOID
> +static BOOLEAN
>  __BlkifRingQueueShutdown(
>      IN  PXENVBD_BLKIF_RING  BlkifRing,
>      IN  PXENVBD_SRBEXT      SrbExt
>      )
>  {
> +    if (!BlkifRing->Enabled)
> +        goto fail1;
> +
>      __BlkifRingAcquireLock(BlkifRing);
>      InsertTailList(&BlkifRing->ShutdownQueue, &SrbExt->ListEntry);
>      __BlkifRingReleaseLock(BlkifRing);
> +
> +    return TRUE;
> +
> +fail1:
> +    Error("fail1\n");
> +
> +    SrbExt->Srb->SrbStatus = SRB_STATUS_BUSY;
> +    return FALSE;
>  }
> 
>  static DECLSPEC_NOINLINE VOID
> @@ -2616,12 +2638,10 @@ RingQueueRequest(
>      BlkifRing = __RingGetBlkifRing(Ring, Srb->QueueTag);
>      ASSERT(BlkifRing != NULL);
> 
> -    __BlkifRingQueueSrb(BlkifRing, SrbExt);
> -
> -    return TRUE;
> +    return __BlkifRingQueueSrb(BlkifRing, SrbExt);
>  }
> 
> -VOID
> +BOOLEAN
>  RingQueueShutdown(
>      IN  PXENVBD_RING    Ring,
>      IN  PXENVBD_SRBEXT  SrbExt
> @@ -2633,5 +2653,5 @@ RingQueueShutdown(
>      BlkifRing = __RingGetBlkifRing(Ring, Srb->QueueTag);
>      ASSERT(BlkifRing != NULL);
> 
> -    __BlkifRingQueueShutdown(BlkifRing, SrbExt);
> +    return __BlkifRingQueueShutdown(BlkifRing, SrbExt);
>  }
> diff --git a/src/xenvbd/ring.h b/src/xenvbd/ring.h
> index e3309e2..81c2644 100644
> --- a/src/xenvbd/ring.h
> +++ b/src/xenvbd/ring.h
> @@ -80,7 +80,7 @@ RingQueueRequest(
>      IN  PXENVBD_SRBEXT  SrbExt
>      );
> 
> -extern VOID
> +extern BOOLEAN
>  RingQueueShutdown(
>      IN  PXENVBD_RING    Ring,
>      IN  PXENVBD_SRBEXT  SrbExt
> diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
> index 176cbbe..e322949 100644
> --- a/src/xenvbd/target.c
> +++ b/src/xenvbd/target.c
> @@ -973,22 +973,22 @@ TargetReset(
>      Verbose("[%u] <=====\n", TargetGetTargetId(Target));
>  }
> 
> -VOID
> +BOOLEAN
>  TargetFlush(
>      IN  PXENVBD_TARGET  Target,
>      IN  PXENVBD_SRBEXT  SrbExt
>      )
>  {
> -    RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
> +    return RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
>  }
> 
> -VOID
> +BOOLEAN
>  TargetShutdown(
>      IN  PXENVBD_TARGET  Target,
>      IN  PXENVBD_SRBEXT  SrbExt
>      )
>  {
> -    RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
> +    return RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
>  }
> 
>  VOID
> diff --git a/src/xenvbd/target.h b/src/xenvbd/target.h
> index dd360f5..cbd0ba4 100644
> --- a/src/xenvbd/target.h
> +++ b/src/xenvbd/target.h
> @@ -110,13 +110,13 @@ TargetReset(
>      IN  PXENVBD_TARGET  Target
>      );
> 
> -extern VOID
> +extern BOOLEAN
>  TargetFlush(
>      IN  PXENVBD_TARGET  Target,
>      IN  PXENVBD_SRBEXT  SrbExt
>      );
> 
> -extern VOID
> +extern BOOLEAN
>  TargetShutdown(
>      IN  PXENVBD_TARGET  Target,
>      IN  PXENVBD_SRBEXT  SrbExt
> --
> 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®.