VirtualBox

Ignore:
Timestamp:
Apr 1, 2015 2:50:42 PM (10 years ago)
Author:
vboxsync
Message:

5.0.0 Beta 1 (and backed out r99347 as it might have caused a regression)

Location:
trunk/src/VBox/HostDrivers/VBoxUSB/win
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxDrvTool.cpp

    r55058 r55078  
    188188    Interval.QuadPart = -(int64_t) 2 /* ms */ * 10000;
    189189    uint32_t cRefs;
    190     size_t loops = 0;
    191     KTIMER kTimer;
    192     NTSTATUS status = STATUS_SUCCESS;
    193 
    194     KeInitializeTimer(&kTimer);
    195    
    196     while ((cRefs = ASMAtomicReadU32(&pRef->cRefs)) > u32Val && loops < 256)
     190
     191    while ((cRefs = ASMAtomicReadU32(&pRef->cRefs)) != u32Val)
    197192    {
    198193        Assert(cRefs >= u32Val);
    199194        Assert(cRefs < UINT32_MAX/2);
    200195
    201         KeSetTimer(&kTimer, Interval, NULL);
    202         status = KeWaitForSingleObject(&kTimer, Executive, KernelMode, false, NULL);
    203         Assert(NT_SUCCESS(status));
    204         loops++;
     196        KeDelayExecutionThread(KernelMode, FALSE, &Interval);
    205197    }
    206198}
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.h

    r55058 r55078  
    190190}
    191191
     192static DECLHIDDEN(VOID) vboxUsbDdiStateWaitOtherCompleted(PVBOXUSBDEV_EXT pDevExt)
     193{
     194    /* Earlier we assumed that 1 request will be pending while we service
     195       Device Power IRP which was leading to host hang when USB is connected
     196       to VM.
     197       With debugging found that at the point when host goes to sleep
     198       state and USB is connected to VM,  two Power IRP requests are pending :
     199       One for SYSTEM and other for DEVICE.
     200    */
     201    VBoxDrvToolRefWaitEqual(&pDevExt->DdiState.Ref, 3);
     202}
     203
    192204#endif /* #ifndef ___VBoxUsbDev_h___ */
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbPnP.cpp

    r55058 r55078  
    7070    ENMVBOXUSB_PNPSTATE enmState = vboxUsbPnPStateGet(pDevExt);
    7171    NTSTATUS Status = STATUS_SUCCESS;
    72    
    73     IoCopyCurrentIrpStackLocationToNext(pIrp);
    74     Status = VBoxDrvToolIoPostSync(pDevExt->pLowerDO, pIrp);
    75     if (NT_SUCCESS(Status) && enmState == ENMVBOXUSB_PNPSTATE_STOP_PENDING)
    76     {
    77         vboxUsbPnPStateRestore(pDevExt);
    78     }
    79    
    80     Status = STATUS_SUCCESS;
     72    if (enmState == ENMVBOXUSB_PNPSTATE_STOP_PENDING)
     73    {
     74        IoCopyCurrentIrpStackLocationToNext(pIrp);
     75        Status = VBoxDrvToolIoPostSync(pDevExt->pLowerDO, pIrp);
     76        if (NT_SUCCESS(Status))
     77        {
     78            vboxUsbPnPStateRestore(pDevExt);
     79        }
     80    }
     81    else
     82    {
     83        Assert(0);
     84        Assert(enmState == ENMVBOXUSB_PNPSTATE_STARTED);
     85    }
     86
    8187    VBoxDrvToolIoComplete(pIrp, Status, 0);
    8288    vboxUsbDdiStateRelease(pDevExt);
     
    138144    ENMVBOXUSB_PNPSTATE enmState = vboxUsbPnPStateGet(pDevExt);
    139145    NTSTATUS Status = STATUS_SUCCESS;
    140     IoCopyCurrentIrpStackLocationToNext(pIrp);
    141    
    142     Status = VBoxDrvToolIoPostSync(pDevExt->pLowerDO, pIrp);
    143 
    144     if (NT_SUCCESS(Status) &&
    145         enmState == ENMVBOXUSB_PNPSTATE_REMOVE_PENDING)
    146     {
    147         vboxUsbPnPStateRestore(pDevExt);
    148     }
    149    
    150     Status = STATUS_SUCCESS;
     146    if (enmState == ENMVBOXUSB_PNPSTATE_REMOVE_PENDING)
     147    {
     148        IoCopyCurrentIrpStackLocationToNext(pIrp);
     149        Status = VBoxDrvToolIoPostSync(pDevExt->pLowerDO, pIrp);
     150        if (NT_SUCCESS(Status))
     151        {
     152            vboxUsbPnPStateRestore(pDevExt);
     153        }
     154    }
     155    else
     156    {
     157        Assert(0);
     158        Assert(enmState == ENMVBOXUSB_PNPSTATE_STARTED);
     159    }
     160
    151161    VBoxDrvToolIoComplete(pIrp, Status, 0);
    152162    vboxUsbDdiStateRelease(pDevExt);
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbPwr.cpp

    r55058 r55078  
    210210    PIRP pIrp = pCtx->pIrp;
    211211
     212    vboxUsbDdiStateWaitOtherCompleted(pDevExt);
     213
    212214    vboxUsbPwrIoPostDev(pDevExt, pIrp);
    213215
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette