VirtualBox

Changeset 30140 in vbox for trunk/src


Ignore:
Timestamp:
Jun 9, 2010 8:08:25 PM (15 years ago)
Author:
vboxsync
Message:

BusLogic: Fix race leading to I/O hang

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

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

    r29614 r30140  
    2525#include <VBox/pdmdev.h>
    2626#include <VBox/pdmifs.h>
     27#include <VBox/pdmcritsect.h>
    2728#include <VBox/scsi.h>
    2829#include <iprt/asm.h>
     
    365366#endif
    366367
     368    /** Critical section protecting access to the interrupt status register. */
     369    PDMCRITSECT                     CritSectIntr;
     370
    367371    /** Cache for task states. */
    368372    R3PTRTYPE(RTMEMCACHE)           hTaskCache;
     
    920924    pTaskState->MailboxGuest.u.in.uCompletionCode = uMailboxCompletionCode;
    921925
     926    int rc = PDMCritSectEnter(&pBusLogic->CritSectIntr, VINF_SUCCESS);
     927    AssertRC(rc);
    922928    RTGCPHYS GCPhysAddrMailboxIncoming = pBusLogic->GCPhysAddrMailboxIncomingBase + (pBusLogic->uMailboxIncomingPositionCurrent * sizeof(Mailbox));
    923929    RTGCPHYS GCPhysAddrCCB = (RTGCPHYS)pTaskState->MailboxGuest.u32PhysAddrCCB;
     
    939945    if (pBusLogic->fIRQEnabled)
    940946        buslogicSetInterrupt(pBusLogic);
     947
     948    PDMCritSectLeave(&pBusLogic->CritSectIntr);
    941949}
    942950
     
    15441552        case BUSLOGIC_REGISTER_CONTROL:
    15451553        {
     1554            rc = PDMCritSectEnter(&pBusLogic->CritSectIntr, VINF_IOM_HC_IOPORT_WRITE);
     1555            if (rc != VINF_SUCCESS)
     1556                return rc;
     1557
    15461558            if (uVal & BUSLOGIC_REGISTER_CONTROL_INTERRUPT_RESET)
    15471559                buslogicClearInterrupt(pBusLogic);
     1560
     1561            PDMCritSectLeave(&pBusLogic->CritSectIntr);
    15481562
    15491563            if ((uVal & BUSLOGIC_REGISTER_CONTROL_HARD_RESET) || (uVal & BUSLOGIC_REGISTER_CONTROL_SOFT_RESET))
     
    26192633    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
    26202634
     2635    PDMR3CritSectDelete(&pThis->CritSectIntr);
     2636
    26212637    int rc = RTMemCacheDestroy(pThis->hTaskCache);
    26222638    AssertMsgRC(rc, ("Destroying task cache failed rc=%Rrc\n", rc));
     
    27132729    pThis->pNotifierQueueR0 = PDMQueueR0Ptr(pThis->pNotifierQueueR3);
    27142730    pThis->pNotifierQueueRC = PDMQueueRCPtr(pThis->pNotifierQueueR3);
     2731
     2732    rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSectIntr, RT_SRC_POS, "BusLogic-Intr");
     2733    if (RT_FAILURE(rc))
     2734        return PDMDEV_SET_ERROR(pDevIns, rc,
     2735                                N_("BusLogic: cannot create critical section"));
    27152736
    27162737    /* Initialize per device state. */
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r29847 r30140  
    14621462    GEN_CHECK_OFF(BUSLOGIC, pNotifierQueueR0);
    14631463    GEN_CHECK_OFF(BUSLOGIC, pNotifierQueueRC);
     1464    GEN_CHECK_OFF(BUSLOGIC, CritSectIntr);
    14641465    GEN_CHECK_OFF(BUSLOGIC, hTaskCache);
    14651466    GEN_CHECK_OFF(BUSLOGIC, VBoxSCSI);
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