VirtualBox

Changeset 29588 in vbox


Ignore:
Timestamp:
May 17, 2010 10:32:29 PM (15 years ago)
Author:
vboxsync
Message:

LsiLogic: The request queue should have the same size as the reply queue or we risk overwriting completed requests by others causing timeouts in the guest

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

Legend:

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

    r29326 r29588  
    550550{
    551551    int rc;
     552
     553    LogFlowFunc(("pLsiLogic=%#p u32MessageContext=%#x\n", pLsiLogic, u32MessageContext));
     554
    552555    AssertMsg(!pLsiLogic->fDoorbellInProgress, ("We are in a doorbell function\n"));
    553556
     
    734737        {
    735738            PMptSCSITaskManagementRequest pTaskMgmtReq = (PMptSCSITaskManagementRequest)pMessageHdr;
     739
     740            LogFlow(("u8TaskType=%u\n", pTaskMgmtReq->u8TaskType));
     741            LogFlow(("u32TaskMessageContext=%#x\n", pTaskMgmtReq->u32TaskMessageContext));
    736742
    737743            pReply->SCSITaskManagement.u8MessageLength     = 6;     /* 6 32bit dwords. */
     
    37573763}
    37583764
     3765/**
     3766 * Allocate the queues.
     3767 *
     3768 * @returns VBox status code.
     3769 *
     3770 * @param   pThis     The LsiLogic device instance.
     3771 */
     3772static int lsilogicQueuesAlloc(PLSILOGICSCSI pThis)
     3773{
     3774    PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3);
     3775    uint32_t cbQueues;
     3776
     3777    Assert(!pThis->pReplyFreeQueueBaseR3);
     3778
     3779    cbQueues  = 2*pThis->cReplyQueueEntries * sizeof(uint32_t);
     3780    cbQueues += pThis->cRequestQueueEntries * sizeof(uint32_t);
     3781    int rc = MMHyperAlloc(pVM, cbQueues, 1, MM_TAG_PDM_DEVICE_USER,
     3782                          (void **)&pThis->pReplyFreeQueueBaseR3);
     3783    if (RT_FAILURE(rc))
     3784        return VERR_NO_MEMORY;
     3785    pThis->pReplyFreeQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pReplyFreeQueueBaseR3);
     3786    pThis->pReplyFreeQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pReplyFreeQueueBaseR3);
     3787
     3788    pThis->pReplyPostQueueBaseR3 = pThis->pReplyFreeQueueBaseR3 + pThis->cReplyQueueEntries;
     3789    pThis->pReplyPostQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pReplyPostQueueBaseR3);
     3790    pThis->pReplyPostQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pReplyPostQueueBaseR3);
     3791
     3792    pThis->pRequestQueueBaseR3   = pThis->pReplyPostQueueBaseR3 + pThis->cReplyQueueEntries;
     3793    pThis->pRequestQueueBaseR0   = MMHyperR3ToR0(pVM, (void *)pThis->pRequestQueueBaseR3);
     3794    pThis->pRequestQueueBaseRC   = MMHyperR3ToRC(pVM, (void *)pThis->pRequestQueueBaseR3);
     3795
     3796    return VINF_SUCCESS;
     3797}
     3798
     3799/**
     3800 * Free the hyper memory used or the queues.
     3801 *
     3802 * @returns nothing.
     3803 *
     3804 * @param   pThis     The LsiLogic device instance.
     3805 */
     3806static void lsilogicQueuesFree(PLSILOGICSCSI pThis)
     3807{
     3808    PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3);
     3809    int rc = VINF_SUCCESS;
     3810
     3811    AssertPtr(pThis->pReplyFreeQueueBaseR3);
     3812
     3813    rc = MMHyperFree(pVM, (void *)pThis->pReplyFreeQueueBaseR3);
     3814    AssertRC(rc);
     3815
     3816    pThis->pReplyFreeQueueBaseR3 = NULL;
     3817    pThis->pReplyPostQueueBaseR3 = NULL;
     3818    pThis->pRequestQueueBaseR3   = NULL;
     3819}
     3820
    37593821static DECLCALLBACK(int) lsilogicLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
    37603822{
     
    40074069    SSMR3GetU16   (pSSM, &pLsiLogic->cbReplyFrame);
    40084070    SSMR3GetU32   (pSSM, &pLsiLogic->iDiagnosticAccess);
    4009     SSMR3GetU32   (pSSM, &pLsiLogic->cReplyQueueEntries);
    4010     SSMR3GetU32   (pSSM, &pLsiLogic->cRequestQueueEntries);
     4071
     4072    uint32_t cReplyQueueEntries, cRequestQueueEntries;
     4073    SSMR3GetU32   (pSSM, &cReplyQueueEntries);
     4074    SSMR3GetU32   (pSSM, &cRequestQueueEntries);
     4075
     4076    if (   cReplyQueueEntries != pLsiLogic->cReplyQueueEntries
     4077        || cRequestQueueEntries != pLsiLogic->cRequestQueueEntries)
     4078    {
     4079        LogFlow(("Reallocating queues cReplyQueueEntries=%u cRequestQueuEntries=%u\n",
     4080                 cReplyQueueEntries, cRequestQueueEntries));
     4081        lsilogicQueuesFree(pLsiLogic);
     4082        pLsiLogic->cReplyQueueEntries = cReplyQueueEntries;
     4083        pLsiLogic->cRequestQueueEntries = cRequestQueueEntries;
     4084        rc = lsilogicQueuesAlloc(pLsiLogic);
     4085        if (RT_FAILURE(rc))
     4086            return rc;
     4087    }
     4088
    40114089    SSMR3GetU32   (pSSM, (uint32_t *)&pLsiLogic->uReplyFreeQueueNextEntryFreeWrite);
    40124090    SSMR3GetU32   (pSSM, (uint32_t *)&pLsiLogic->uReplyFreeQueueNextAddressRead);
     
    44084486    int rc = VINF_SUCCESS;
    44094487    char *pszCtrlType = NULL;
    4410     PVM pVM = PDMDevHlpGetVM(pDevIns);
    44114488    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    44124489
     
    45494626     * Allocate memory for the queues.
    45504627     */
    4551     uint32_t cbQueues;
    4552 
    4553     cbQueues  = 2*pThis->cReplyQueueEntries * sizeof(uint32_t);
    4554     cbQueues += pThis->cRequestQueueEntries * sizeof(uint32_t);
    4555     rc = MMHyperAlloc(pVM, cbQueues, 1, MM_TAG_PDM_DEVICE_USER,
    4556                       (void **)&pThis->pReplyFreeQueueBaseR3);
     4628    rc = lsilogicQueuesAlloc(pThis);
    45574629    if (RT_FAILURE(rc))
    4558         return VERR_NO_MEMORY;
    4559     pThis->pReplyFreeQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pReplyFreeQueueBaseR3);
    4560     pThis->pReplyFreeQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pReplyFreeQueueBaseR3);
    4561 
    4562     pThis->pReplyPostQueueBaseR3 = pThis->pReplyFreeQueueBaseR3 + pThis->cReplyQueueEntries;
    4563     pThis->pReplyPostQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pReplyPostQueueBaseR3);
    4564     pThis->pReplyPostQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pReplyPostQueueBaseR3);
    4565 
    4566     pThis->pRequestQueueBaseR3   = pThis->pReplyPostQueueBaseR3 + pThis->cReplyQueueEntries;
    4567     pThis->pRequestQueueBaseR0   = MMHyperR3ToR0(pVM, (void *)pThis->pRequestQueueBaseR3);
    4568     pThis->pRequestQueueBaseRC   = MMHyperR3ToRC(pVM, (void *)pThis->pRequestQueueBaseR3);
     4630        return rc;
    45694631
    45704632    /*
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.h

    r29326 r29588  
    2727#define LSILOGIC_SAS_ISA_IO_PORT 0x350
    2828
    29 #define LSILOGICSCSI_REQUEST_QUEUE_DEPTH_DEFAULT 1024
    30 #define LSILOGICSCSI_REPLY_QUEUE_DEPTH_DEFAULT   128
     29#define LSILOGICSCSI_REQUEST_QUEUE_DEPTH_DEFAULT 256
     30#define LSILOGICSCSI_REPLY_QUEUE_DEPTH_DEFAULT   256
    3131
    3232#define LSILOGICSCSI_MAXIMUM_CHAIN_DEPTH 3
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