VirtualBox

Changeset 43399 in vbox


Ignore:
Timestamp:
Sep 21, 2012 2:05:51 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80882
Message:

AHCI: Fix release assertion when cancelling requests and disabled async I/O

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r43397 r43399  
    56065606 * and notifying the guest.
    56075607 *
    5608  * @returns VBox status code
     5608 * @returns Flag whether the given request was canceled inbetween;
    56095609 *
    56105610 * @param pAhciPort    Pointer to the port where to request completed.
     
    56135613 * @param fFreeReq     Flag whether to free the request if it was canceled.
    56145614 */
    5615 static int ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcReq, bool fFreeReq)
     5615static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcReq, bool fFreeReq)
    56165616{
    56175617    bool fXchg = false;
    56185618    bool fRedo = false;
     5619    bool fCanceled = false;
    56195620    uint64_t tsNow = RTTimeMilliTS();
    56205621
     
    57705771                  ("Task is not active but wasn't canceled!\n"));
    57715772
     5773        fCanceled = true;
     5774        ASMAtomicXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_FREE);
     5775
    57725776        if (pAhciReq->enmTxDir == AHCITXDIR_TRIM)
    57735777            ahciTrimRangesDestroy(pAhciReq);
     
    57805784            if (pAhciReq->enmTxDir == AHCITXDIR_FLUSH)
    57815785                LogRel(("AHCI#%u: Canceled flush returned rc=%Rrc\n",
     5786                        pAhciPort->iLUN, rcReq));
     5787            else if (pAhciReq->enmTxDir == AHCITXDIR_TRIM)
     5788                LogRel(("AHCI#%u: Canceled trim returned rc=%Rrc\n",
    57825789                        pAhciPort->iLUN, rcReq));
    57835790            else
     
    57965803    }
    57975804
    5798     return VINF_SUCCESS;
     5805    return fCanceled;
    57995806}
    58005807
     
    64326439               && RT_LIKELY(!pAhciPort->fPortReset))
    64336440        {
     6441            bool fReqCanceled = false;
    64346442            AHCITXDIR enmTxDir;
    64356443
     
    64506458            /* Set current command slot */
    64516459            ASMAtomicWriteU32(&pAhciPort->u32CurrentCommandSlot, pAhciReq->uTag);
     6460            pAhciPort->aCachedTasks[0] = pAhciReq; /* Make cancelling the request possible. */
    64526461
    64536462            /* Mark the task as processed by the HBA if this is a queued task so that it doesn't occur in the CI register anymore. */
     
    65476556                }
    65486557
    6549                 ahciTransferComplete(pAhciPort, pAhciReq, rc, false /* fFreeReq */);
     6558                fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, rc, false /* fFreeReq */);
    65506559                uIORequestsProcessed++;
    65516560                STAM_PROFILE_STOP(&pAhciPort->StatProfileProcessTime, a);
     
    65636572#endif
    65646573            }
     6574
     6575            /*
     6576             * Don't process other requests if the last one was canceled,
     6577             * the others are not valid anymore.
     6578             */
     6579            if (fReqCanceled)
     6580                break;
    65656581            fTasksToProcess &= ~(1 << idx);
    65666582            idx = ASMBitFirstSetU32(fTasksToProcess);
Note: See TracChangeset for help on using the changeset viewer.

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