VirtualBox

Changeset 73410 in vbox for trunk/src


Ignore:
Timestamp:
Jul 31, 2018 12:36:41 PM (6 years ago)
Author:
vboxsync
Message:

Network/Virtio: TX queue notification flag race fix. TX event stat counters. Existing counters updated to use CTX_SUFF.

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

Legend:

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

    r72474 r73410  
    219219    STAMPROFILE             StatRxOverflow;
    220220    STAMCOUNTER             StatRxOverflowWakeup;
     221    STAMCOUNTER             StatTransmitByNetwork;
     222    STAMCOUNTER             StatTransmitByThread;
    221223#endif /* VBOX_WITH_STATISTICS */
    222224    /** @}  */
     
    14201422{
    14211423    PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkDown);
     1424    STAM_REL_COUNTER_INC(&pThis->StatTransmitByNetwork);
    14221425    vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/);
    14231426}
     
    15111514        if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))
    15121515            break;
    1513         vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); /// @todo shouldn't it be true instead?
    1514         Log(("vnetTxThread: enable kicking and get to sleep\n"));
    1515         vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true);
     1516        STAM_REL_COUNTER_INC(&pThis->StatTransmitByThread);
     1517        while (true)
     1518        {
     1519            vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); /// @todo shouldn't it be true instead?
     1520            Log(("vnetTxThread: enable kicking and get to sleep\n"));
     1521            vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true);
     1522            if (vqueueIsEmpty(&pThis->VPCI, pThis->pTxQueue))
     1523                break;
     1524            vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, false);
     1525        }
    15161526    }
    15171527
     
    23212331    PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmit,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling transmits in HC",          "/Devices/VNet%d/Transmit/Total", iInstance);
    23222332    PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitSend,       STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling send transmit in HC",      "/Devices/VNet%d/Transmit/Send", iInstance);
     2333    PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitByNetwork,  STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Network-initiated transmissions",    "/Devices/VNet%d/Transmit/ByNetwork", iInstance);
     2334    PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitByThread,   STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,          "Thread-initiated transmissions",     "/Devices/VNet%d/Transmit/ByThread", iInstance);
    23232335#endif /* VBOX_WITH_STATISTICS */
    23242336
  • trunk/src/VBox/Devices/VirtIO/Virtio.cpp

    r73097 r73410  
    385385    VPCISTATE  *pState = PDMINS_2_DATA(pDevIns, VPCISTATE *);
    386386    int         rc     = VINF_SUCCESS;
    387     STAM_PROFILE_ADV_START(&pState->CTXSUFF(StatIORead), a);
     387    STAM_PROFILE_ADV_START(&pState->CTX_SUFF(StatIORead), a);
    388388    RT_NOREF_PV(pvUser);
    389389
     
    400400    if (RT_UNLIKELY(rc != VINF_SUCCESS))
    401401    {
    402         STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIORead), a);
     402        STAM_PROFILE_ADV_STOP(&pState->CTX_SUFF(StatIORead), a);
    403403        return rc;
    404404        }*/
     
    455455    }
    456456    Log3(("%s vpciIOPortIn:  At %RTiop in  %0*x\n", INSTANCE(pState), Port, cb*2, *pu32));
    457     STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIORead), a);
     457    STAM_PROFILE_ADV_STOP(&pState->CTX_SUFF(StatIORead), a);
    458458    //vpciCsLeave(pState);
    459459    return rc;
     
    484484    int         rc     = VINF_SUCCESS;
    485485    bool        fHasBecomeReady;
    486     STAM_PROFILE_ADV_START(&pState->CTXSUFF(StatIOWrite), a);
     486    STAM_PROFILE_ADV_START(&pState->CTX_SUFF(StatIOWrite), a);
    487487    RT_NOREF_PV(pvUser);
    488488
     
    604604    }
    605605
    606     STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIOWrite), a);
     606    STAM_PROFILE_ADV_STOP(&pState->CTX_SUFF(StatIOWrite), a);
    607607    return rc;
    608608}
     
    932932
    933933#if defined(VBOX_WITH_STATISTICS)
    934     PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOReadGC,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO reads in GC",      vpciCounter(pcszNameFmt, "IO/ReadGC"), iInstance);
    935     PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOReadHC,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO reads in HC",      vpciCounter(pcszNameFmt, "IO/ReadHC"), iInstance);
    936     PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOWriteGC,          STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO writes in GC",     vpciCounter(pcszNameFmt, "IO/WriteGC"), iInstance);
    937     PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOWriteHC,          STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO writes in HC",     vpciCounter(pcszNameFmt, "IO/WriteHC"), iInstance);
     934    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOReadR3,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO reads in R3",      vpciCounter(pcszNameFmt, "IO/ReadR3"), iInstance);
     935    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOReadR0,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO reads in R0",      vpciCounter(pcszNameFmt, "IO/ReadR0"), iInstance);
     936    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOReadRC,           STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO reads in RC",      vpciCounter(pcszNameFmt, "IO/ReadRC"), iInstance);
     937    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOWriteR3,          STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO writes in R3",     vpciCounter(pcszNameFmt, "IO/WriteR3"), iInstance);
     938    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOWriteR0,          STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO writes in R0",     vpciCounter(pcszNameFmt, "IO/WriteR0"), iInstance);
     939    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIOWriteRC,          STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling IO writes in RC",     vpciCounter(pcszNameFmt, "IO/WriteRC"), iInstance);
    938940    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIntsRaised,         STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Number of raised interrupts",   vpciCounter(pcszNameFmt, "Interrupts/Raised"), iInstance);
    939941    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIntsSkipped,        STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,     "Number of skipped interrupts",   vpciCounter(pcszNameFmt, "Interrupts/Skipped"), iInstance);
    940     PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsGC,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in GC",      vpciCounter(pcszNameFmt, "Cs/CsGC"), iInstance);
    941     PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsHC,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in HC",      vpciCounter(pcszNameFmt, "Cs/CsHC"), iInstance);
     942    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsR3,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in R3",      vpciCounter(pcszNameFmt, "Cs/CsR3"), iInstance);
     943    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsR0,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in R0",      vpciCounter(pcszNameFmt, "Cs/CsR0"), iInstance);
     944    PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatCsRC,               STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling CS wait in RC",      vpciCounter(pcszNameFmt, "Cs/CsRC"), iInstance);
    942945#endif /* VBOX_WITH_STATISTICS */
    943946
  • trunk/src/VBox/Devices/VirtIO/Virtio.h

    r73097 r73410  
    213213
    214214#if defined(VBOX_WITH_STATISTICS)
    215     STAMPROFILEADV         StatIOReadGC;
    216     STAMPROFILEADV         StatIOReadHC;
    217     STAMPROFILEADV         StatIOWriteGC;
    218     STAMPROFILEADV         StatIOWriteHC;
     215    STAMPROFILEADV         StatIOReadR3;
     216    STAMPROFILEADV         StatIOReadR0;
     217    STAMPROFILEADV         StatIOReadRC;
     218    STAMPROFILEADV         StatIOWriteR3;
     219    STAMPROFILEADV         StatIOWriteR0;
     220    STAMPROFILEADV         StatIOWriteRC;
    219221    STAMCOUNTER            StatIntsRaised;
    220222    STAMCOUNTER            StatIntsSkipped;
    221     STAMPROFILE            StatCsGC;
    222     STAMPROFILE            StatCsHC;
     223    STAMPROFILE            StatCsR3;
     224    STAMPROFILE            StatCsR0;
     225    STAMPROFILE            StatCsRC;
    223226#endif /* VBOX_WITH_STATISTICS */
    224227} VPCISTATE;
     
    276279{
    277280#ifdef VPCI_CS
    278     STAM_PROFILE_START(&pState->CTXSUFF(StatCs), a);
     281    STAM_PROFILE_START(&pState->CTX_SUFF(StatCs), a);
    279282    int rc = PDMCritSectEnter(&pState->cs, rcBusy);
    280     STAM_PROFILE_STOP(&pState->CTXSUFF(StatCs), a);
     283    STAM_PROFILE_STOP(&pState->CTX_SUFF(StatCs), a);
    281284    return rc;
    282285#else
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