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

Re: [win-pv-devel] [PATCH 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: Tue, 17 Sep 2019 14:53:38 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: esa2.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:53:48 +0000
  • Ironport-sdr: T2VqH67clhqJZJVfprARY2kgAFGurJGAgnbx2g4JlKblXa80dBICmMiYesmY4LgL/cp/IkvR+a pVsU057KzqeKakb8HOwTSEWEJ+PvA6dpyc1ERSy3nyUFpaED6wZTkTZ7FYVFPcKPNAPpuR7JD5 0ZQ4p7Om0jeZvovFDhbeFwQCMbC2yJkjxnlqhXlFDthmsgSgu14BvuNHvGwH24+uAWeIQMnxQB NZyHXRm6moPrV7GvwfDKhIt3iePhtZr/6ql7fpebmr1NmHEEjZA2uL8LOola8HJmvTOxaFPhbX Jrw=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHVbKKGrS/gBxWMD02NvbdraxO4xKcv9gBg
  • Thread-topic: [win-pv-devel] [PATCH 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: 16 September 2019 16:18
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH 2/4] Fail SRBs if ring is not Enabled
> 
> Dont queue incomming SRBs if the ring is not able to process requests.
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

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

> ---
>  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 52eaca5..3be7c14 100644
> --- a/src/xenvbd/ring.c
> +++ b/src/xenvbd/ring.c
> @@ -2148,7 +2148,7 @@ BlkifRingDisconnect(
>      Trace("<==== %u\n", BlkifRing->Index);
>  }
> 
> -static VOID
> +static BOOLEAN
>  __BlkifRingQueueSrb(
>      IN  PXENVBD_BLKIF_RING  BlkifRing,
>      IN  PXENVBD_SRBEXT      SrbExt
> @@ -2159,6 +2159,9 @@ __BlkifRingQueueSrb(
>      ULONG_PTR               LockBit;
>      ULONG_PTR               New;
> 
> +    if (!BlkifRing->Enabled)
> +        goto fail1;
> +
>      ListEntry = &SrbExt->ListEntry;
> 
>      do {
> @@ -2178,17 +2181,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
> @@ -2617,12 +2639,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
> @@ -2634,5 +2654,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®.