- Timestamp:
- Dec 3, 2009 9:43:03 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r25148 r25158 114 114 VPCISTATE VPCI; 115 115 116 PDMCRITSECT csRx; /**< Protects RX queue. */116 // PDMCRITSECT csRx; /**< Protects RX queue. */ 117 117 118 118 PDMINETWORKPORT INetworkPort; … … 187 187 STAMCOUNTER StatTransmitBytes; 188 188 #if defined(VBOX_WITH_STATISTICS) 189 STAMPROFILEADV StatReceive; 189 STAMPROFILE StatReceive; 190 STAMPROFILE StatReceiveStore; 190 191 STAMPROFILEADV StatTransmit; 191 STAMPROFILE ADVStatTransmitSend;192 STAMPROFILE StatTransmitSend; 192 193 STAMPROFILE StatRxOverflow; 193 194 STAMCOUNTER StatRxOverflowWakeup; … … 254 255 DECLINLINE(int) vnetCsRxEnter(PVNETSTATE pState, int rcBusy) 255 256 { 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; 257 262 } 258 263 259 264 DECLINLINE(void) vnetCsRxLeave(PVNETSTATE pState) 260 265 { 261 PDMCritSectLeave(&pState->csRx);266 // PDMCritSectLeave(&pState->csRx); 262 267 } 263 268 … … 683 688 uElemSize += uSize; 684 689 } 690 STAM_PROFILE_START(&pState->StatReceiveStore, a); 685 691 vqueuePut(&pState->VPCI, pState->pRxQueue, &elem, uElemSize); 692 STAM_PROFILE_STOP(&pState->StatReceiveStore, a); 686 693 } 687 694 vqueueSync(&pState->VPCI, pState->pRxQueue); … … 715 722 return VINF_SUCCESS; 716 723 717 STAM_PROFILE_ ADV_START(&pState->StatReceive, a);724 STAM_PROFILE_START(&pState->StatReceive, a); 718 725 vpciSetReadLed(&pState->VPCI, true); 719 726 if (vnetAddressFilter(pState, pvBuf, cb)) … … 728 735 } 729 736 vpciSetReadLed(&pState->VPCI, false); 730 STAM_PROFILE_ ADV_STOP(&pState->StatReceive, a);737 STAM_PROFILE_STOP(&pState->StatReceive, a); 731 738 return rc; 732 739 } … … 840 847 uOffset += uSize; 841 848 } 842 STAM_PROFILE_ ADV_START(&pState->StatTransmitSend, a);849 STAM_PROFILE_START(&pState->StatTransmitSend, a); 843 850 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); 845 852 STAM_REL_COUNTER_ADD(&pState->StatTransmitBytes, uOffset); 846 853 } … … 860 867 { 861 868 int rc = TMTimerStop(pState->CTX_SUFF(pTxTimer)); 862 vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, true);863 869 Log3(("%s vnetQueueTransmit: Got kicked with notification disabled, " 864 870 "re-enable notification and flush TX queue\n", INSTANCE(pState))); 865 871 vnetTransmitPendingPackets(pState, pQueue); 872 vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, true); 866 873 } 867 874 else 868 875 { 876 vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, false); 869 877 TMTimerSetMicro(pState->CTX_SUFF(pTxTimer), VNET_TX_DELAY); 870 vringSetNotification(&pState->VPCI, &pState->pTxQueue->VRing, false);871 878 } 872 879 } … … 1430 1437 1431 1438 /* 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; 1437 1444 1438 1445 /* Map our ports to IO space. */ … … 1511 1518 #if defined(VBOX_WITH_STATISTICS) 1512 1519 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); 1513 1521 PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatRxOverflow, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows", "/Devices/VNet%d/RxOverflow", iInstance); 1514 1522 PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatRxOverflowWakeup, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of RX overflow wakeups", "/Devices/VNet%d/RxOverflowWakeup", iInstance); … … 1546 1554 pState->pTxBuf = NULL; 1547 1555 } 1548 if (PDMCritSectIsInitialized(&pState->csRx))1549 PDMR3CritSectDelete(&pState->csRx);1556 // if (PDMCritSectIsInitialized(&pState->csRx)) 1557 // PDMR3CritSectDelete(&pState->csRx); 1550 1558 1551 1559 return vpciDestruct(&pState->VPCI); -
trunk/src/VBox/Devices/VirtIO/Virtio.cpp
r25148 r25158 422 422 bool fHasBecomeReady; 423 423 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 432 424 433 425 port -= pState->addrIOPort; … … 487 479 if (u32 < pState->nQueues) 488 480 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 } 490 489 else 491 490 Log(("%s The queue (#%d) being notified has not been initialized.\n", … … 519 518 520 519 STAM_PROFILE_ADV_STOP(&pState->CTXSUFF(StatIOWrite), a); 521 vpciCsLeave(pState);522 520 return rc; 523 521 } … … 857 855 PDMDevHlpSTAMRegisterF(pDevIns, &pState->StatIntsRaised, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of raised interrupts", vpciCounter(pcszNameFmt, "Interrupts/Raised"), iInstance); 858 856 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); 859 859 #endif /* VBOX_WITH_STATISTICS */ 860 860 -
trunk/src/VBox/Devices/VirtIO/Virtio.h
r25007 r25158 212 212 STAMCOUNTER StatIntsRaised; 213 213 STAMCOUNTER StatIntsSkipped; 214 STAMPROFILE StatCsGC; 215 STAMPROFILE StatCsHC; 214 216 #endif /* VBOX_WITH_STATISTICS */ 215 217 }; … … 267 269 const char *pcszName); 268 270 269 271 #define VPCI_CS 270 272 DECLINLINE(int) vpciCsEnter(VPCISTATE *pState, int iBusyRc) 271 273 { 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 273 282 } 274 283 275 284 DECLINLINE(void) vpciCsLeave(VPCISTATE *pState) 276 285 { 286 #ifdef VPCI_CS 277 287 PDMCritSectLeave(&pState->cs); 288 #endif 278 289 } 279 290
Note:
See TracChangeset
for help on using the changeset viewer.