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

Re: [win-pv-devel] [PATCH 5/9] Dont create Pdo for emulated devices



> -----Original Message-----
> From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
> Behalf Of Owen Smith
> Sent: 22 April 2016 15:16
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith
> Subject: [win-pv-devel] [PATCH 5/9] Dont create Pdo for emulated devices
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

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

> ---
>  src/xenvbd/fdo.c | 29 +++++++++++++++--------------
>  src/xenvbd/pdo.c | 54 +++++++++++++++---------------------------------------
>  src/xenvbd/pdo.h |  3 +--
>  3 files changed, 31 insertions(+), 55 deletions(-)
> 
> diff --git a/src/xenvbd/fdo.c b/src/xenvbd/fdo.c
> index dadf395..dab7ae1 100644
> --- a/src/xenvbd/fdo.c
> +++ b/src/xenvbd/fdo.c
> @@ -583,7 +583,6 @@ __FdoEnumerate(
>      ULONG               TargetId;
>      PCHAR               Device;
>      PXENVBD_PDO         Pdo;
> -    NTSTATUS            Status;
> 
>      *NeedInvalidate = FALSE;
>      *NeedReboot = FALSE;
> @@ -621,7 +620,6 @@ __FdoEnumerate(
> 
>      // add new targets
>      for (Device = Devices; *Device; Device = __NextSz(Device)) {
> -        BOOLEAN     EmulatedUnplugged;
>          XENVBD_DEVICE_TYPE  DeviceType;
> 
>          TargetId = __ParseVbd(Device);
> @@ -639,18 +637,21 @@ __FdoEnumerate(
>              continue;
>          }
> 
> -        EmulatedUnplugged = __FdoIsPdoUnplugged(Fdo,
> -                                                FdoEnum(Fdo),
> -                                                Device,
> -                                                TargetId);
> -        *NeedReboot |= !EmulatedUnplugged;
> -
> -        Status = PdoCreate(Fdo,
> -                           Device,
> -                           TargetId,
> -                           EmulatedUnplugged,
> -                           ThreadGetEvent(Fdo->FrontendThread), DeviceType);
> -        *NeedInvalidate |= (NT_SUCCESS(Status)) ? TRUE : FALSE;
> +        if (!__FdoIsPdoUnplugged(Fdo,
> +                                FdoEnum(Fdo),
> +                                Device,
> +                                TargetId)) {
> +            *NeedReboot = TRUE;
> +            continue;
> +        }
> +
> +        if (PdoCreate(Fdo,
> +                      Device,
> +                      TargetId,
> +                      ThreadGetEvent(Fdo->FrontendThread),
> +                      DeviceType)) {
> +            *NeedInvalidate = TRUE;
> +        }
>      }
>  }
>  static DECLSPEC_NOINLINE VOID
> diff --git a/src/xenvbd/pdo.c b/src/xenvbd/pdo.c
> index 67800e4..c7d8b2b 100644
> --- a/src/xenvbd/pdo.c
> +++ b/src/xenvbd/pdo.c
> @@ -87,7 +87,6 @@ struct _XENVBD_PDO {
>      XENVBD_DEVICE_TYPE          DeviceType;
> 
>      // State
> -    BOOLEAN                     EmulatedUnplugged;
>      LONG                        Paused;
> 
>      // Eject
> @@ -285,8 +284,7 @@ PdoDebugCallback(
>                   "PDO: DevicePowerState %s\n",
>                   PowerDeviceStateName(Pdo->DevicePowerState));
>      XENBUS_DEBUG(Printf, DebugInterface,
> -                 "PDO: %s %s\n",
> -                 Pdo->EmulatedUnplugged ? "PV" : "EMULATED",
> +                 "PDO: %s\n",
>                   Pdo->Missing ? Pdo->Reason : "Not Missing");
> 
>      XENBUS_DEBUG(Printf, DebugInterface,
> @@ -400,15 +398,6 @@ PdoMissingReason(
>      return Reason;
>  }
> 
> -__checkReturn
> -FORCEINLINE BOOLEAN
> -PdoIsEmulatedUnplugged(
> -    __in PXENVBD_PDO             Pdo
> -    )
> -{
> -    return Pdo->EmulatedUnplugged;
> -}
> -
>  FORCEINLINE VOID
>  PdoSetDevicePnpState(
>      __in PXENVBD_PDO             Pdo,
> @@ -2161,13 +2150,6 @@ __ValidateSrbForPdo(
>          return FALSE;
>      }
> 
> -    if (!Pdo->EmulatedUnplugged) {
> -        Error("Target[%d] : Disk is Emulated (%02x:%s)\n",
> -                PdoGetTargetId(Pdo), Operation,
> Cdb_OperationName(Operation));
> -        Srb->SrbStatus = SRB_STATUS_NO_DEVICE;
> -        return FALSE;
> -    }
> -
>      return TRUE;
>  }
> 
> @@ -2498,7 +2480,7 @@ PdoD3ToD0(
>          return STATUS_SUCCESS;
> 
>      Trace("Target[%d] @ (%d) =====>\n", TargetId, KeGetCurrentIrql());
> -    Verbose("Target[%d] : D3->D0 (%s)\n", TargetId, Pdo-
> >EmulatedUnplugged ? "PV" : "Emulated");
> +    Verbose("Target[%d] : D3->D0\n", TargetId);
> 
>      // power up frontend
>      Status = FrontendD3ToD0(Pdo->Frontend);
> @@ -2506,12 +2488,10 @@ PdoD3ToD0(
>          goto fail1;
> 
>      // connect frontend
> -    if (Pdo->EmulatedUnplugged) {
> -        Status = FrontendSetState(Pdo->Frontend, XENVBD_ENABLED);
> -        if (!NT_SUCCESS(Status))
> -            goto fail2;
> -        __PdoUnpauseDataPath(Pdo);
> -    }
> +    Status = FrontendSetState(Pdo->Frontend, XENVBD_ENABLED);
> +    if (!NT_SUCCESS(Status))
> +        goto fail2;
> +    __PdoUnpauseDataPath(Pdo);
> 
>      Trace("Target[%d] @ (%d) <=====\n", TargetId, KeGetCurrentIrql());
>      return STATUS_SUCCESS;
> @@ -2539,14 +2519,12 @@ PdoD0ToD3(
>          return;
> 
>      Trace("Target[%d] @ (%d) =====>\n", TargetId, KeGetCurrentIrql());
> -    Verbose("Target[%d] : D0->D3 (%s)\n", TargetId, Pdo-
> >EmulatedUnplugged ? "PV" : "Emulated");
> +    Verbose("Target[%d] : D0->D3\n", TargetId);
> 
>      // close frontend
> -    if (Pdo->EmulatedUnplugged) {
> -        __PdoPauseDataPath(Pdo, FALSE);
> -        (VOID) FrontendSetState(Pdo->Frontend, XENVBD_CLOSED);
> -        ASSERT3U(QueueCount(&Pdo->SubmittedReqs), ==, 0);
> -    }
> +    __PdoPauseDataPath(Pdo, FALSE);
> +    (VOID) FrontendSetState(Pdo->Frontend, XENVBD_CLOSED);
> +    ASSERT3U(QueueCount(&Pdo->SubmittedReqs), ==, 0);
> 
>      // power down frontend
>      FrontendD0ToD3(Pdo->Frontend);
> @@ -2555,12 +2533,11 @@ PdoD0ToD3(
>  }
> 
>  __checkReturn
> -NTSTATUS
> +BOOLEAN
>  PdoCreate(
>      __in PXENVBD_FDO             Fdo,
>      __in __nullterminated PCHAR  DeviceId,
>      __in ULONG                   TargetId,
> -    __in BOOLEAN                 EmulatedUnplugged,
>      __in PKEVENT                 FrontendEvent,
>      __in XENVBD_DEVICE_TYPE      DeviceType
>      )
> @@ -2576,7 +2553,7 @@ PdoCreate(
>      if (!Pdo)
>          goto fail1;
> 
> -    Verbose("Target[%d] : Creating (%s)\n", TargetId, EmulatedUnplugged ?
> "PV" : "Emulated");
> +    Verbose("Target[%d] : Creating\n", TargetId);
>      Pdo->Signature      = PDO_SIGNATURE;
>      Pdo->Fdo            = Fdo;
>      Pdo->DeviceObject   = NULL; // filled in later
> @@ -2585,7 +2562,6 @@ PdoCreate(
>      Pdo->Paused         = 1; // Paused until D3->D0 transition
>      Pdo->DevicePnpState = Present;
>      Pdo->DevicePowerState = PowerDeviceD3;
> -    Pdo->EmulatedUnplugged = EmulatedUnplugged;
>      Pdo->DeviceType     = DeviceType;
> 
>      KeInitializeSpinLock(&Pdo->Lock);
> @@ -2609,9 +2585,9 @@ PdoCreate(
>      if (!FdoLinkPdo(Fdo, Pdo))
>          goto fail4;
> 
> -    Verbose("Target[%d] : Created (%s)\n", TargetId, EmulatedUnplugged ?
> "PV" : "Emulated");
> +    Verbose("Target[%d] : Created (%s)\n", TargetId);
>      Trace("Target[%d] @ (%d) <=====\n", TargetId, KeGetCurrentIrql());
> -    return STATUS_SUCCESS;
> +    return TRUE;
> 
>  fail4:
>      Error("Fail4\n");
> @@ -2631,7 +2607,7 @@ fail2:
> 
>  fail1:
>      Error("Fail1 (%08x)\n", Status);
> -    return Status;
> +    return FALSE;
>  }
> 
>  VOID
> diff --git a/src/xenvbd/pdo.h b/src/xenvbd/pdo.h
> index 1211174..3bff743 100644
> --- a/src/xenvbd/pdo.h
> +++ b/src/xenvbd/pdo.h
> @@ -50,12 +50,11 @@ PdoDebugCallback(
> 
>  // Creation/Deletion
>  __checkReturn
> -extern NTSTATUS
> +extern BOOLEAN
>  PdoCreate(
>      __in PXENVBD_FDO             Fdo,
>      __in __nullterminated PCHAR  DeviceId,
>      __in ULONG                   TargetId,
> -    __in BOOLEAN                 EmulatedMasked,
>      __in PKEVENT                 FrontendEvent,
>      __in XENVBD_DEVICE_TYPE      DeviceType
>      );
> --
> 1.9.4.msysgit.1
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.