VirtualBox

Changeset 105560 in vbox


Ignore:
Timestamp:
Aug 1, 2024 10:14:06 AM (4 months ago)
Author:
vboxsync
Message:

VMM/IEM: A few more TLB tracing events. bugref:10727

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp

    r105490 r105560  
    10501050
    10511051
     1052#if 0
     1053/**
     1054 * Frees all TBs.
     1055 */
     1056static int iemTbAllocatorFreeAll(PVMCPUCC pVCpu)
     1057{
     1058    PIEMTBALLOCATOR const pTbAllocator = pVCpu->iem.s.pTbAllocatorR3;
     1059    AssertReturn(pTbAllocator, VERR_WRONG_ORDER);
     1060    AssertReturn(pTbAllocator->uMagic == IEMTBALLOCATOR_MAGIC, VERR_INVALID_MAGIC);
     1061
     1062    iemTbAllocatorProcessDelayedFrees(pVCpu, pTbAllocator);
     1063
     1064    uint32_t idxChunk = pTbAllocator->cAllocatedChunks;
     1065    while (idxChunk-- > 0)
     1066    {
     1067        PIEMTB const paTbs = pTbAllocator->aChunks[idxChunk].paTbs;
     1068        uint32_t     idxTb = pTbAllocator->cTbsPerChunk;
     1069        while (idxTb-- > 0)
     1070        {
     1071            PIEMTB const pTb = &paTbs[idxTb];
     1072            if (pTb->fFlags)
     1073                iemTbAllocatorFreeInner(pVCpu, pTbAllocator, pTb, idxChunk, idxTb);
     1074        }
     1075    }
     1076
     1077    pVCpu->iem.s.ppTbLookupEntryR3 = &pVCpu->iem.s.pTbLookupEntryDummyR3;
     1078
     1079# if 1
     1080    /* Reset the free list. */
     1081    pTbAllocator->pTbsFreeHead = NULL;
     1082    idxChunk = pTbAllocator->cAllocatedChunks;
     1083    while (idxChunk-- > 0)
     1084    {
     1085        uint32_t const cTbsPerChunk = pTbAllocator->cTbsPerChunk;
     1086        PIEMTB const   paTbs        = pTbAllocator->aChunks[idxChunk].paTbs;
     1087        RT_BZERO(paTbs, sizeof(paTbs[0]) * cTbsPerChunk);
     1088        for (uint32_t idxTb = 0; idxTb < cTbsPerChunk; idxTb++)
     1089        {
     1090            paTbs[idxTb].idxAllocChunk = idxChunk; /* This is not strictly necessary... */
     1091            paTbs[idxTb].pNext = pTbAllocator->pTbsFreeHead;
     1092            pTbAllocator->pTbsFreeHead = &paTbs[idxTb];
     1093        }
     1094    }
     1095# endif
     1096
     1097# if 1
     1098    /* Completely reset the TB cache. */
     1099    RT_BZERO(pVCpu->iem.s.pTbCacheR3->apHash, sizeof(pVCpu->iem.s.pTbCacheR3->apHash[0]) * pVCpu->iem.s.pTbCacheR3->cHash);
     1100# endif
     1101
     1102    return VINF_SUCCESS;
     1103}
     1104#endif
     1105
     1106
    10521107/**
    10531108 * Grow the translation block allocator with another chunk.
     
    26332688static VBOXSTRICTRC iemThreadedCompile(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysPc, uint32_t fExtraFlags) IEM_NOEXCEPT_MAY_LONGJMP
    26342689{
     2690    IEMTLBTRACE_TB_COMPILE(pVCpu, GCPhysPc);
    26352691    Assert(!(fExtraFlags & IEMTB_F_TYPE_MASK));
    26362692    fExtraFlags |= IEMTB_F_TYPE_THREADED;
     
    28232879    {
    28242880        pVCpu->iem.s.cTbExecNative++;
     2881        IEMTLBTRACE_TB_EXEC_N8VE(pVCpu, pTb);
    28252882# ifdef LOG_ENABLED
    28262883        iemThreadedLogCurInstr(pVCpu, "EXn", 0);
     
    29022959         */
    29032960        pVCpu->iem.s.cTbExecThreaded++;
     2961        IEMTLBTRACE_TB_EXEC_THRD(pVCpu, pTb);
    29042962#ifdef LOG_ENABLED
    29052963        uint64_t             uRipPrev   = UINT64_MAX;
  • trunk/src/VBox/VMM/VMMR3/IEMR3.cpp

    r105465 r105560  
    3636#include <VBox/vmm/dbgf.h>
    3737#include <VBox/vmm/mm.h>
     38#include <VBox/vmm/ssm.h>
    3839#if defined(VBOX_VMM_TARGET_ARMV8)
    3940# include "IEMInternal-armv8.h"
     
    15601561                if (RT_SUCCESS(rc))
    15611562                {
     1563                    /* Add displacement. */
    15621564                    if (offDisp)
    15631565                    {
     
    15691571                        else
    15701572                            RTStrPrintf(pszEndName, cbLeft, "-%#1RGv", -offDisp);
    1571                         char *pszName = uBuf.Symbol.szName;
    1572                         *--pszName = ' ';   /* padding */
    1573                         pszSymbol = pszName;
    15741573                    }
     1574
     1575                    /* Put a space before it. */
     1576                    AssertCompile(RTASSERT_OFFSET_OF(RTDBGSYMBOL, szName) > 0);
     1577                    char *pszName = uBuf.Symbol.szName;
     1578                    *--pszName = ' ';
     1579                    pszSymbol = pszName;
    15751580                }
    15761581            }
     
    16011606                                    pCur->u64Param, (uint32_t)IEMTLB_ADDR_TO_EVEN_INDEX(pCur->u64Param), pszSymbol);
    16021607                    break;
     1608
    16031609                case kIemTlbTraceType_Load_Cr0:
    16041610                    pHlp->pfnPrintf(pHlp, "%u: %016RX64 load cr0 %08RX64 (was %08RX64)%s\n",
     
    16171623                                    idx, pCur->rip, pCur->u64Param, pCur->u64Param2, pszSymbol);
    16181624                    break;
     1625
    16191626                case kIemTlbTraceType_Irq:
    16201627                    pHlp->pfnPrintf(pHlp, "%u: %016RX64 irq %#04x flags=%#x eflboth=%#RX64%s\n",
     
    16381645                                    idx, pCur->rip, pCur->u32Param, pCur->u64Param, (uint32_t)pCur->u64Param2, pszSymbol);
    16391646                    break;
     1647
     1648                case kIemTlbTraceType_Tb_Compile:
     1649                    pHlp->pfnPrintf(pHlp, "%u: %016RX64 tb comp GCPhysPc=%012RX64%s\n",
     1650                                    idx, pCur->rip, pCur->u64Param, pszSymbol);
     1651                    break;
     1652                case kIemTlbTraceType_Tb_Exec_Threaded:
     1653                    pHlp->pfnPrintf(pHlp, "%u: %016RX64 tb thrd GCPhysPc=%012RX64 tb=%p used=%u%s\n",
     1654                                    idx, pCur->rip, pCur->u64Param, (uintptr_t)pCur->u64Param2, pCur->u32Param, pszSymbol);
     1655                    break;
     1656                case kIemTlbTraceType_Tb_Exec_Native:
     1657                    pHlp->pfnPrintf(pHlp, "%u: %016RX64 tb n8ve GCPhysPc=%012RX64 tb=%p used=%u%s\n",
     1658                                    idx, pCur->rip, pCur->u64Param, (uintptr_t)pCur->u64Param2, pCur->u32Param, pszSymbol);
     1659                    break;
     1660
    16401661                case kIemTlbTraceType_Invalid:
    16411662                    pHlp->pfnPrintf(pHlp, "%u: Invalid!\n");
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r105490 r105560  
    748748    kIemTlbTraceType_Irq,
    749749    kIemTlbTraceType_Xcpt,
    750     kIemTlbTraceType_IRet
     750    kIemTlbTraceType_IRet,
     751    kIemTlbTraceType_Tb_Compile,
     752    kIemTlbTraceType_Tb_Exec_Threaded,
     753    kIemTlbTraceType_Tb_Exec_Native
    751754} IEMTLBTRACETYPE;
    752755
     
    784787# define IEMTLBTRACE_LOAD_GLOBAL(a_pVCpu, a_GCPtr, a_fDataTlb) \
    785788    iemTlbTrace(a_pVCpu, kIemTlbTraceType_LoadGlobal, a_GCPtr, 0, a_fDataTlb)
     789#else
     790# define IEMTLBTRACE_INVLPG(a_pVCpu, a_GCPtr)                           do { } while (0)
     791# define IEMTLBTRACE_FLUSH(a_pVCpu, a_uRev, a_fDataTlb)                 do { } while (0)
     792# define IEMTLBTRACE_FLUSH_GLOBAL(a_pVCpu, a_uRev, a_uGRev, a_fDataTlb) do { } while (0)
     793# define IEMTLBTRACE_LOAD(a_pVCpu, a_GCPtr, a_fDataTlb)                 do { } while (0)
     794# define IEMTLBTRACE_LOAD_GLOBAL(a_pVCpu, a_GCPtr, a_fDataTlb)          do { } while (0)
     795#endif
     796
     797#if defined(IEM_WITH_TLB_TRACE) && defined(IN_RING3) && 1
    786798# define IEMTLBTRACE_LOAD_CR0(a_pVCpu, a_uNew, a_uOld)      iemTlbTrace(a_pVCpu, kIemTlbTraceType_Load_Cr0, a_uNew, a_uOld)
    787799# define IEMTLBTRACE_LOAD_CR3(a_pVCpu, a_uNew, a_uOld)      iemTlbTrace(a_pVCpu, kIemTlbTraceType_Load_Cr3, a_uNew, a_uOld)
    788800# define IEMTLBTRACE_LOAD_CR4(a_pVCpu, a_uNew, a_uOld)      iemTlbTrace(a_pVCpu, kIemTlbTraceType_Load_Cr4, a_uNew, a_uOld)
    789801# define IEMTLBTRACE_LOAD_EFER(a_pVCpu, a_uNew, a_uOld)     iemTlbTrace(a_pVCpu, kIemTlbTraceType_Load_Efer, a_uNew, a_uOld)
     802#else
     803# define IEMTLBTRACE_LOAD_CR0(a_pVCpu, a_uNew, a_uOld)      do { } while (0)
     804# define IEMTLBTRACE_LOAD_CR3(a_pVCpu, a_uNew, a_uOld)      do { } while (0)
     805# define IEMTLBTRACE_LOAD_CR4(a_pVCpu, a_uNew, a_uOld)      do { } while (0)
     806# define IEMTLBTRACE_LOAD_EFER(a_pVCpu, a_uNew, a_uOld)     do { } while (0)
     807#endif
     808
     809#if defined(IEM_WITH_TLB_TRACE) && defined(IN_RING3) && 1
    790810# define IEMTLBTRACE_IRQ(a_pVCpu, a_uVector, a_fFlags, a_fEFlags) \
    791811    iemTlbTrace(a_pVCpu, kIemTlbTraceType_Irq, a_fEFlags, 0, a_uVector, a_fFlags)
     
    795815    iemTlbTrace(a_pVCpu, kIemTlbTraceType_IRet, a_uRetRip, a_fEFlags, 0, a_uRetCs)
    796816#else
    797 # define IEMTLBTRACE_INVLPG(a_pVCpu, a_GCPtr)                           do { } while (0)
    798 # define IEMTLBTRACE_FLUSH(a_pVCpu, a_uRev, a_fDataTlb)                 do { } while (0)
    799 # define IEMTLBTRACE_FLUSH_GLOBAL(a_pVCpu, a_uRev, a_uGRev, a_fDataTlb) do { } while (0)
    800 # define IEMTLBTRACE_LOAD(a_pVCpu, a_GCPtr, a_fDataTlb)                 do { } while (0)
    801 # define IEMTLBTRACE_LOAD_GLOBAL(a_pVCpu, a_GCPtr, a_fDataTlb)          do { } while (0)
    802 # define IEMTLBTRACE_LOAD_CR0(a_pVCpu, a_uNew, a_uOld)                  do { } while (0)
    803 # define IEMTLBTRACE_LOAD_CR3(a_pVCpu, a_uNew, a_uOld)                  do { } while (0)
    804 # define IEMTLBTRACE_LOAD_CR4(a_pVCpu, a_uNew, a_uOld)                  do { } while (0)
    805 # define IEMTLBTRACE_LOAD_EFER(a_pVCpu, a_uNew, a_uOld)                 do { } while (0)
    806817# define IEMTLBTRACE_IRQ(a_pVCpu, a_uVector, a_fFlags, a_fEFlags)       do { } while (0)
    807818# define IEMTLBTRACE_XCPT(a_pVCpu, a_uVector, a_uErr, a_uCr2, a_fFlags) do { } while (0)
    808819# define IEMTLBTRACE_IRET(a_pVCpu, a_uRetCs, a_uRetRip, a_fEFlags)      do { } while (0)
     820#endif
     821
     822#if defined(IEM_WITH_TLB_TRACE) && defined(IN_RING3) && 1
     823# define IEMTLBTRACE_TB_COMPILE(a_pVCpu, a_GCPhysPc) \
     824    iemTlbTrace(a_pVCpu, kIemTlbTraceType_Tb_Compile, a_GCPhysPc)
     825# define IEMTLBTRACE_TB_EXEC_THRD(a_pVCpu, a_pTb) \
     826    iemTlbTrace(a_pVCpu, kIemTlbTraceType_Tb_Exec_Threaded, (a_pTb)->GCPhysPc, (uintptr_t)a_pTb, 0, (a_pTb)->cUsed)
     827# define IEMTLBTRACE_TB_EXEC_N8VE(a_pVCpu, a_pTb) \
     828    iemTlbTrace(a_pVCpu, kIemTlbTraceType_Tb_Exec_Native,   (a_pTb)->GCPhysPc, (uintptr_t)a_pTb, 0, (a_pTb)->cUsed)
     829#else
     830# define IEMTLBTRACE_TB_COMPILE(a_pVCpu, a_GCPhysPc)                    do { } while (0)
     831# define IEMTLBTRACE_TB_EXEC_THRD(a_pVCpu, a_pTb)                       do { } while (0)
     832# define IEMTLBTRACE_TB_EXEC_N8VE(a_pVCpu, a_pTb)                       do { } while (0)
    809833#endif
    810834
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