VirtualBox

Changeset 25158 in vbox for trunk/src


Ignore:
Timestamp:
Dec 3, 2009 9:43:03 AM (15 years ago)
Author:
vboxsync
Message:

#4507: Virtio: csRx removed, cs moved out of GC.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r25148 r25158  
    114114    VPCISTATE               VPCI;
    115115
    116     PDMCRITSECT             csRx;                           /**< Protects RX queue. */
     116//    PDMCRITSECT             csRx;                           /**< Protects RX queue. */
    117117
    118118    PDMINETWORKPORT         INetworkPort;
     
    187187    STAMCOUNTER             StatTransmitBytes;
    188188#if defined(VBOX_WITH_STATISTICS)
    189     STAMPROFILEADV          StatReceive;
     189    STAMPROFILE             StatReceive;
     190    STAMPROFILE             StatReceiveStore;
    190191    STAMPROFILEADV          StatTransmit;
    191     STAMPROFILEADV          StatTransmitSend;
     192    STAMPROFILE             StatTransmitSend;
    192193    STAMPROFILE             StatRxOverflow;
    193194    STAMCOUNTER             StatRxOverflowWakeup;
     
    254255DECLINLINE(int) vnetCsRxEnter(PVNETSTATE pState, int rcBusy)
    255256{
    256     return PDMCritSectEnter(&pState->csRx, rcBusy);
     257    // STAM_PROFILE_START(&pState->CTXSUFF(StatCsRx), a);
     258    // int rc = PDMCritSectEnter(&pState->csRx, rcBusy);
     259    // STAM_PROFILE_STOP(&pState->CTXSUFF(StatCsRx), a);
     260    // return rc;
     261    return VINF_SUCCESS;
    257262}
    258263
    259264DECLINLINE(void) vnetCsRxLeave(PVNETSTATE pState)
    260265{
    261     PDMCritSectLeave(&pState->csRx);
     266    // PDMCritSectLeave(&pState->csRx);
    262267}
    263268
     
    683688            uElemSize += uSize;
    684689        }
     690        STAM_PROFILE_START(&pState->StatReceiveStore, a);
    685691        vqueuePut(&pState->VPCI, pState->pRxQueue, &elem, uElemSize);
     692        STAM_PROFILE_STOP(&pState->StatReceiveStore, a);
    686693    }
    687694    vqueueSync(&pState->VPCI, pState->pRxQueue);
     
    715722        return VINF_SUCCESS;
    716723
    717     STAM_PROFILE_ADV_START(&pState->StatReceive, a);
     724    STAM_PROFILE_START(&pState->StatReceive, a);
    718725    vpciSetReadLed(&pState->VPCI, true);
    719726    if (vnetAddressFilter(pState, pvBuf, cb))
     
    728735    }
    729736    vpciSetReadLed(&pState->VPCI, false);
    730     STAM_PROFILE_ADV_STOP(&pState->StatReceive, a);
     737    STAM_PROFILE_STOP(&pState->StatReceive, a);
    731738    return rc;
    732739}
     
    840847                uOffset += uSize;
    841848            }
    842             STAM_PROFILE_ADV_START(&pState->StatTransmitSend, a);
     849            STAM_PROFILE_START(&pState->StatTransmitSend, a);
    843850            int rc = pState->pDrv->pfnSend(pState->pDrv, pState->pTxBuf, uOffset);
    844             STAM_PROFILE_ADV_STOP(&pState->StatTransmitSend, a);
     851            STAM_PROFILE_STOP(&pState->StatTransmitSend, a);
    845852            STAM_REL_COUNTER_ADD(&pState->StatTransmitBytes, uOffset);
    846853        }
     
    860867    {
    861868        int rc = TMTimerStop(pState->CTX_SUFF(pTxTimer));
    862         vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, true);
    863869        Log3(("%s vnetQueueTransmit: Got kicked with notification disabled, "
    864870              "re-enable notification and flush TX queue\n", INSTANCE(pState)));
    865871        vnetTransmitPendingPackets(pState, pQueue);
     872        vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, true);
    866873    }
    867874    else
    868875    {
     876        vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, false);
    869877        TMTimerSetMicro(pState->CTX_SUFF(pTxTimer), VNET_TX_DELAY);
    870         vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, false);
    871878    }
    872879}
     
    14301437
    14311438    /* Initialize critical section. */
    1432     char szTmp[sizeof(pState->VPCI.szInstance) + 2];
    1433     RTStrPrintf(szTmp, sizeof(szTmp), "%sRX", pState->VPCI.szInstance);
    1434     rc = PDMDevHlpCritSectInit(pDevIns, &pState->csRx, szTmp);
    1435     if (RT_FAILURE(rc))
    1436         return rc;
     1439    // char szTmp[sizeof(pState->VPCI.szInstance) + 2];
     1440    // RTStrPrintf(szTmp, sizeof(szTmp), "%sRX", pState->VPCI.szInstance);
     1441    // rc = PDMDevHlpCritSectInit(pDevIns, &pState->csRx, szTmp);
     1442    // if (RT_FAILURE(rc))
     1443    //     return rc;
    14371444
    14381445    /* Map our ports to IO space. */
     
    15111518#if defined(VBOX_WITH_STATISTICS)
    15121519    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatReceive,            STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive",                  "/Devices/VNet%d/Receive/Total", iInstance);
     1520    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatReceiveStore,       STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive storing",          "/Devices/VNet%d/Receive/Store", iInstance);
    15131521    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatRxOverflow,         STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows",        "/Devices/VNet%d/RxOverflow", iInstance);
    15141522    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatRxOverflowWakeup,   STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Nr of RX overflow wakeups",          "/Devices/VNet%d/RxOverflowWakeup", iInstance);
     
    15461554        pState->pTxBuf = NULL;
    15471555    }
    1548     if (PDMCritSectIsInitialized(&pState->csRx))
    1549         PDMR3CritSectDelete(&pState->csRx);
     1556    // if (PDMCritSectIsInitialized(&pState->csRx))
     1557    //     PDMR3CritSectDelete(&pState->csRx);
    15501558
    15511559    return vpciDestruct(&pState->VPCI);
  • trunk/src/VBox/Devices/VirtIO/Virtio.cpp

    r25148 r25158  
    422422    bool        fHasBecomeReady;
    423423    STAM_PROFILE_ADV_START(&pState->CTXSUFF(StatIOWrite), a);
    424 
    425     rc = vpciCsEnter(pState, VINF_IOM_HC_IOPORT_WRITE);
    426     if (RT_UNLIKELY(rc != VINF_SUCCESS))
    427     {
    428         STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIOWrite), a);
    429         return rc;
    430     }
    431 
    432424
    433425    port -= pState->addrIOPort;
     
    487479            if (u32 < pState->nQueues)
    488480                if (pState->Queues[u32].VRing.addrDescriptors)
    489                     pState->Queues[u32].pfnCallback(pState, &pState->Queues[u32]);
     481                {
     482                    rc = vpciCsEnter(pState, VERR_SEM_BUSY);
     483                    if (RT_LIKELY(rc == VINF_SUCCESS))
     484                    {
     485                        pState->Queues[u32].pfnCallback(pState, &pState->Queues[u32]);
     486                        vpciCsLeave(pState);
     487                    }
     488                }
    490489                else
    491490                    Log(("%s The queue (#%d) being notified has not been initialized.\n",
     
    519518
    520519    STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIOWrite), a);
    521     vpciCsLeave(pState);
    522520    return rc;
    523521}
     
    857855    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIntsRaised,         STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Number of raised interrupts",   vpciCounter(pcszNameFmt, "Interrupts/Raised"), iInstance);
    858856    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIntsSkipped,        STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Number of skipped interrupts",   vpciCounter(pcszNameFmt, "Interrupts/Skipped"), iInstance);
     857    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsGC,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in GC",      vpciCounter(pcszNameFmt, "Cs/CsGC"), iInstance);
     858    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsHC,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in HC",      vpciCounter(pcszNameFmt, "Cs/CsHC"), iInstance);
    859859#endif /* VBOX_WITH_STATISTICS */
    860860
  • trunk/src/VBox/Devices/VirtIO/Virtio.h

    r25007 r25158  
    212212    STAMCOUNTER            StatIntsRaised;
    213213    STAMCOUNTER            StatIntsSkipped;
     214    STAMPROFILE            StatCsGC;
     215    STAMPROFILE            StatCsHC;
    214216#endif /* VBOX_WITH_STATISTICS */
    215217};
     
    267269                     const char *pcszName);
    268270
    269 
     271#define VPCI_CS
    270272DECLINLINE(int) vpciCsEnter(VPCISTATE *pState, int iBusyRc)
    271273{
    272     return PDMCritSectEnter(&pState->cs, iBusyRc);
     274#ifdef VPCI_CS
     275    STAM_PROFILE_START(&pState->CTXSUFF(StatCs), a);
     276    int rc = PDMCritSectEnter(&pState->cs, iBusyRc);
     277    STAM_PROFILE_STOP(&pState->CTXSUFF(StatCs), a);
     278    return rc;
     279#else
     280    return VINF_SUCCESS;
     281#endif
    273282}
    274283
    275284DECLINLINE(void) vpciCsLeave(VPCISTATE *pState)
    276285{
     286#ifdef VPCI_CS
    277287    PDMCritSectLeave(&pState->cs);
     288#endif
    278289}
    279290
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