VirtualBox

Changeset 83594 in vbox for trunk/src


Ignore:
Timestamp:
Apr 6, 2020 6:06:54 PM (5 years ago)
Author:
vboxsync
Message:

DevVirtioSCSI.cpp: Saved state fixes. bugref:9440

File:
1 edited

Legend:

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

    r83587 r83594  
    19851985    pHlp->pfnSSMGetU32(pSSM,  &pThis->fResetting);
    19861986
    1987     pHlp->pfnSSMGetU32(pSSM, &pThis->cTargets);
     1987    uint32_t cTargets;
     1988    int rc = pHlp->pfnSSMGetU32(pSSM, &cTargets);
     1989    AssertRCReturn(rc, rc);
     1990    AssertReturn(cTargets == pThis->cTargets,
     1991                 pHlp->pfnSSMSetLoadError(pSSM, VERR_SSM_LOAD_CONFIG_MISMATCH, RT_SRC_POS,
     1992                                          N_("target count has changed: %u saved, %u configured now"),
     1993                                          cTargets, pThis->cTargets));
    19881994
    19891995    for (uint16_t uTarget = 0; uTarget < pThis->cTargets; uTarget++)
    19901996    {
    19911997        uint16_t cReqsRedo;
    1992         pHlp->pfnSSMGetU16(pSSM, &cReqsRedo);
    1993         if (cReqsRedo >= VIRTQ_MAX_SIZE)
    1994         {
    1995             LogFunc(("Bad count of I/O transactions to re-do in SSM state data. Skipping\n"));
    1996             continue;
    1997         }
     1998        rc = pHlp->pfnSSMGetU16(pSSM, &cReqsRedo);
     1999        AssertRCReturn(rc, rc);
     2000        AssertReturn(cReqsRedo < VIRTQ_MAX_SIZE,
     2001                     pHlp->pfnSSMSetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
     2002                                              N_("Bad count of I/O transactions to re-do in saved state (%#x, max %#x - 1)"),
     2003                                              cReqsRedo, VIRTQ_MAX_SIZE));
    19982004
    19992005        for (uint16_t qIdx = VIRTQ_REQ_BASE; qIdx < VIRTIOSCSI_QUEUE_CNT; qIdx++)
     
    20052011        for (int i = 0; i < cReqsRedo; i++)
    20062012        {
    2007             uint16_t qIdx, uHeadIdx;
    2008 
    2009             pHlp->pfnSSMGetU16(pSSM, &qIdx);
    2010             pHlp->pfnSSMGetU16(pSSM, &uHeadIdx);
    2011 
    2012             if (qIdx >= VIRTIOSCSI_QUEUE_CNT)
    2013             {
    2014                 LogFunc(("Bad queue index in SSM state data. Skipping\n"));
    2015                 continue;
    2016             }
    2017             if (uHeadIdx >= VIRTQ_MAX_SIZE)
    2018             {
    2019                 LogFunc(("Bad queue elem index in SSM state data. Skipping\n"));
    2020                 continue;
    2021             }
     2013            uint16_t qIdx;
     2014            rc = pHlp->pfnSSMGetU16(pSSM, &qIdx);
     2015            AssertRCReturn(rc, rc);
     2016            AssertReturn(qIdx < VIRTIOSCSI_QUEUE_CNT,
     2017                         pHlp->pfnSSMSetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
     2018                                                  N_("Bad queue index for re-do in saved state (%#x, max %#x)"),
     2019                                                  qIdx, VIRTIOSCSI_QUEUE_CNT - 1));
     2020
     2021            uint16_t idxHead;
     2022            rc = pHlp->pfnSSMGetU16(pSSM, &idxHead);
     2023            AssertRCReturn(rc, rc);
     2024            AssertReturn(idxHead < VIRTQ_MAX_SIZE,
     2025                         pHlp->pfnSSMSetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
     2026                                                  N_("Bad queue element index for re-do in saved state (%#x, max %#x)"),
     2027                                                  idxHead, VIRTQ_MAX_SIZE - 1));
     2028
    20222029            PVIRTIOSCSIWORKERR3 pWorkerR3 = &pThisCC->aWorkers[qIdx];
    2023             pWorkerR3->auRedoDescs[pWorkerR3->cRedoDescs++] = uHeadIdx;
     2030            pWorkerR3->auRedoDescs[pWorkerR3->cRedoDescs++] = idxHead;
    20242031            pWorkerR3->cRedoDescs %= VIRTQ_MAX_SIZE;
    20252032        }
     
    20292036     * Call the virtio core to let it load its state.
    20302037     */
    2031     int rc = virtioCoreR3LoadExec(&pThis->Virtio, pDevIns->pHlpR3, pSSM);
     2038    rc = virtioCoreR3LoadExec(&pThis->Virtio, pDevIns->pHlpR3, pSSM);
    20322039
    20332040    /*
     
    20392046        {
    20402047            LogFunc(("Waking %s worker.\n", VIRTQNAME(qIdx)));
    2041             rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[qIdx].hEvtProcess);
    2042             AssertRCReturn(rc, rc);
     2048            int rc2 = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->aWorkers[qIdx].hEvtProcess);
     2049            AssertRCReturn(rc, rc2);
    20432050        }
    20442051    }
     2052
    20452053    return rc;
    20462054}
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