VirtualBox

Changeset 70778 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jan 28, 2018 10:09:24 PM (7 years ago)
Author:
vboxsync
Message:

VMM/PDMBlkCache: Commit some debug code for tracing I/O requests I had lying around for debug purposes (disabled by default)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDMBlkCache.cpp

    r69111 r70778  
    3030#include <iprt/path.h>
    3131#include <iprt/string.h>
     32#include <iprt/trace.h>
    3233#include <VBox/log.h>
    3334#include <VBox/vmm/stam.h>
     
    6768#define PDM_BLK_CACHE_SAVED_STATE_VERSION 1
    6869
     70/* Enable to enable some tracing in the block cache code for investigating issues. */
     71/*#define VBOX_BLKCACHE_TRACING 1*/
    6972
    7073/*********************************************************************************************************************************
     
    7578                                               uint64_t off, size_t cbData, uint8_t *pbBuffer);
    7679static bool pdmBlkCacheAddDirtyEntry(PPDMBLKCACHE pBlkCache, PPDMBLKCACHEENTRY pEntry);
     80
     81
     82/**
     83 * Add message to the VM trace buffer.
     84 *
     85 * @returns nothing.
     86 * @param   pBlkCache     The block cache.
     87 * @param   pszFmt        The format string.
     88 * @param   ...           Additional parameters for the string formatter.
     89 */
     90DECLINLINE(void) pdmBlkCacheR3TraceMsgF(PPDMBLKCACHE pBlkCache, const char *pszFmt, ...)
     91{
     92#if defined(VBOX_BLKCACHE_TRACING)
     93    va_list va;
     94    va_start(va, pszFmt);
     95    RTTraceBufAddMsgV(pBlkCache->pCache->pVM->CTX_SUFF(hTraceBuf), pszFmt, va);
     96    va_end(va);
     97#else
     98    RT_NOREF2(pBlkCache, pszFmt);
     99#endif
     100}
    77101
    78102/**
     
    492516                 __FUNCTION__, pIoXfer, pIoXfer->enmXferDir));
    493517
     518    ASMAtomicIncU32(&pBlkCache->cIoXfersActive);
     519    pdmBlkCacheR3TraceMsgF(pBlkCache, "BlkCache: I/O req %#p (%RTbool , %d) queued (%u now active)",
     520                           pIoXfer, pIoXfer->fIoCache, pIoXfer->enmXferDir, pBlkCache->cIoXfersActive);
     521
    494522    switch (pBlkCache->enmType)
    495523    {
     
    528556        default:
    529557            AssertMsgFailed(("Unknown block cache type!\n"));
     558    }
     559
     560    if (RT_FAILURE(rc))
     561    {
     562        pdmBlkCacheR3TraceMsgF(pBlkCache, "BlkCache: Queueing I/O req %#p failed %Rrc", pIoXfer, rc);
     563        ASMAtomicDecU32(&pBlkCache->cIoXfersActive);
    530564    }
    531565
     
    12181252        {
    12191253            pBlkCache->fSuspended = false;
     1254            pBlkCache->cIoXfersActive = 0;
    12201255            pBlkCache->pCache = pBlkCacheGlobal;
    12211256            RTListInit(&pBlkCache->ListDirtyNotCommitted);
     
    26762711    else
    26772712        pdmBlkCacheReqUpdate(pBlkCache, hIoXfer->pReq, rcIoXfer, true);
     2713
     2714    ASMAtomicDecU32(&pBlkCache->cIoXfersActive);
     2715    pdmBlkCacheR3TraceMsgF(pBlkCache, "BlkCache: I/O req %#p (%RTbool) completed (%u now active)",
     2716                           hIoXfer, hIoXfer->fIoCache, pBlkCache->cIoXfersActive);
    26782717    RTMemFree(hIoXfer);
    26792718}
  • trunk/src/VBox/VMM/include/PDMBlkCacheInternal.h

    r69111 r70778  
    263263    /** Flag whether the cache was suspended. */
    264264    volatile bool                 fSuspended;
     265    /** Number of outstanding I/O transfers. */
     266    volatile uint32_t             cIoXfersActive;
    265267
    266268} PDMBLKCACHE, *PPDMBLKCACHE;
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