VirtualBox

Changeset 82033 in vbox


Ignore:
Timestamp:
Nov 20, 2019 4:34:13 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134837
Message:

APIC: Select the NOP critsect in ring-0 so we can set the new-style flag. Use standard stats prefix. Don't fail when if info items or statistics fail to register. bugref:9218

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

Legend:

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

    r82031 r82033  
    35123512    pVM->apicr0.s.pDevInsR0 = pDevIns;
    35133513
    3514     int rc = PDMDevHlpMmioSetUpContext(pDevIns, pThis->hMmio, apicWriteMmio, apicReadMmio, NULL /*pvUser*/);
     3514    int rc = PDMDevHlpSetDeviceCritSect(pDevIns, PDMDevHlpCritSectGetNop(pDevIns));
     3515    AssertRCReturn(rc, rc);
     3516
     3517    rc = PDMDevHlpMmioSetUpContext(pDevIns, pThis->hMmio, apicWriteMmio, apicReadMmio, NULL /*pvUser*/);
    35153518    AssertRCReturn(rc, rc);
    35163519
     
    35273530    /* .uReserved0 = */             0,
    35283531    /* .szName = */                 "apic",
    3529     /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ,
     3532    /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE,
    35303533    /* .fClass = */                 PDM_DEVREG_CLASS_PIC,
    35313534    /* .cMaxInstances = */          1,
  • trunk/src/VBox/VMM/VMMR3/APIC.cpp

    r82031 r82033  
    11021102
    11031103/**
    1104  * The timer callback.
    1105  *
    1106  * @param   pDevIns      The device instance.
    1107  * @param   pTimer       The timer handle.
    1108  * @param   pvUser       Opaque pointer to the VMCPU.
    1109  *
    1110  * @thread  Any.
     1104 * @callback_method_impl{FNTMTIMERDEV}
     1105 *
     1106 * @note    pvUser points to the VMCPU.
     1107 *
    11111108 * @remarks Currently this function is invoked on the last EMT, see @c
    11121109 *          idTimerCpu in tmR3TimerCallback().  However, the code does -not-
     
    11211118    Assert(pVCpu);
    11221119    LogFlow(("APIC%u: apicR3TimerCallback\n", pVCpu->idCpu));
    1123     RT_NOREF2(pDevIns, pTimer);
     1120    RT_NOREF(pDevIns, pTimer, pApicCpu);
    11241121
    11251122    PXAPICPAGE     pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
     
    15011498     * Register saved state callbacks.
    15021499     */
    1503     rc = PDMDevHlpSSMRegister3(pDevIns, APIC_SAVED_STATE_VERSION, sizeof(*pApicDev),
    1504                                NULL /*pfnLiveExec*/, apicR3SaveExec, apicR3LoadExec);
    1505     if (RT_FAILURE(rc))
    1506         return rc;
     1500    rc = PDMDevHlpSSMRegister(pDevIns, APIC_SAVED_STATE_VERSION, sizeof(*pApicDev), apicR3SaveExec, apicR3LoadExec);
     1501    AssertRCReturn(rc, rc);
    15071502
    15081503    /*
     
    15131508     * not just used during live debugging via the VM debugger.
    15141509     */
    1515     rc  = DBGFR3InfoRegisterInternalEx(pVM, "apic",      "Dumps APIC basic information.", apicR3Info,      DBGFINFO_FLAGS_ALL_EMTS);
    1516     rc |= DBGFR3InfoRegisterInternalEx(pVM, "apiclvt",   "Dumps APIC LVT information.",   apicR3InfoLvt,   DBGFINFO_FLAGS_ALL_EMTS);
    1517     rc |= DBGFR3InfoRegisterInternalEx(pVM, "apictimer", "Dumps APIC timer information.", apicR3InfoTimer, DBGFINFO_FLAGS_ALL_EMTS);
    1518     AssertRCReturn(rc, rc);
     1510    DBGFR3InfoRegisterInternalEx(pVM, "apic",      "Dumps APIC basic information.", apicR3Info,      DBGFINFO_FLAGS_ALL_EMTS);
     1511    DBGFR3InfoRegisterInternalEx(pVM, "apiclvt",   "Dumps APIC LVT information.",   apicR3InfoLvt,   DBGFINFO_FLAGS_ALL_EMTS);
     1512    DBGFR3InfoRegisterInternalEx(pVM, "apictimer", "Dumps APIC timer information.", apicR3InfoTimer, DBGFINFO_FLAGS_ALL_EMTS);
    15191513
    15201514#ifdef VBOX_WITH_STATISTICS
     
    15221516     * Statistics.
    15231517     */
    1524 #define APIC_REG_COUNTER(a_Reg, a_Desc, a_Key) \
    1525     do { \
    1526         rc = STAMR3RegisterF(pVM, a_Reg, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, a_Desc, a_Key, idCpu); \
    1527         AssertRCReturn(rc, rc); \
    1528     } while(0)
    1529 
    1530 #define APIC_PROF_COUNTER(a_Reg, a_Desc, a_Key) \
    1531     do { \
    1532         rc = STAMR3RegisterF(pVM, a_Reg, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, a_Desc, a_Key, \
    1533                              idCpu); \
    1534         AssertRCReturn(rc, rc); \
    1535     } while(0)
     1518#define APIC_REG_COUNTER(a_pvReg, a_pszNameFmt, a_pszDesc) \
     1519        PDMDevHlpSTAMRegisterF(pDevIns, a_pvReg, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, \
     1520                               STAMUNIT_OCCURENCES, a_pszDesc, a_pszNameFmt, idCpu)
     1521# define APIC_PROF_COUNTER(a_pvReg, a_pszNameFmt, a_pszDesc) \
     1522        PDMDevHlpSTAMRegisterF(pDevIns, a_pvReg, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, \
     1523                               STAMUNIT_TICKS_PER_CALL, a_pszDesc, a_pszNameFmt, idCpu)
    15361524
    15371525    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     
    15401528        PAPICCPU pApicCpu  = VMCPU_TO_APICCPU(pVCpu);
    15411529
    1542         APIC_REG_COUNTER(&pApicCpu->StatMmioReadRZ,  "Number of APIC MMIO reads in RZ.",  "/Devices/APIC/%u/RZ/MmioRead");
    1543         APIC_REG_COUNTER(&pApicCpu->StatMmioWriteRZ, "Number of APIC MMIO writes in RZ.", "/Devices/APIC/%u/RZ/MmioWrite");
    1544         APIC_REG_COUNTER(&pApicCpu->StatMsrReadRZ,   "Number of APIC MSR reads in RZ.",   "/Devices/APIC/%u/RZ/MsrRead");
    1545         APIC_REG_COUNTER(&pApicCpu->StatMsrWriteRZ,  "Number of APIC MSR writes in RZ.",  "/Devices/APIC/%u/RZ/MsrWrite");
    1546 
    1547         APIC_REG_COUNTER(&pApicCpu->StatMmioReadR3,  "Number of APIC MMIO reads in R3.",  "/Devices/APIC/%u/R3/MmioReadR3");
    1548         APIC_REG_COUNTER(&pApicCpu->StatMmioWriteR3, "Number of APIC MMIO writes in R3.", "/Devices/APIC/%u/R3/MmioWriteR3");
    1549         APIC_REG_COUNTER(&pApicCpu->StatMsrReadR3,   "Number of APIC MSR reads in R3.",   "/Devices/APIC/%u/R3/MsrReadR3");
    1550         APIC_REG_COUNTER(&pApicCpu->StatMsrWriteR3,  "Number of APIC MSR writes in R3.",  "/Devices/APIC/%u/R3/MsrWriteR3");
    1551 
    1552         APIC_PROF_COUNTER(&pApicCpu->StatUpdatePendingIntrs, "Profiling of APICUpdatePendingInterrupts",
    1553                           "/PROF/CPU%d/APIC/UpdatePendingInterrupts");
    1554         APIC_PROF_COUNTER(&pApicCpu->StatPostIntr, "Profiling of APICPostInterrupt", "/PROF/CPU%d/APIC/PostInterrupt");
    1555 
    1556         APIC_REG_COUNTER(&pApicCpu->StatPostIntrAlreadyPending,  "Number of times an interrupt is already pending.",
    1557                          "/Devices/APIC/%u/PostInterruptAlreadyPending");
    1558         APIC_REG_COUNTER(&pApicCpu->StatTimerCallback,  "Number of times the timer callback is invoked.",
    1559                          "/Devices/APIC/%u/TimerCallback");
    1560 
    1561         APIC_REG_COUNTER(&pApicCpu->StatTprWrite,      "Number of TPR writes.", "/Devices/APIC/%u/TprWrite");
    1562         APIC_REG_COUNTER(&pApicCpu->StatTprRead,       "Number of TPR reads.",  "/Devices/APIC/%u/TprRead");
    1563         APIC_REG_COUNTER(&pApicCpu->StatEoiWrite,      "Number of EOI writes.", "/Devices/APIC/%u/EoiWrite");
    1564         APIC_REG_COUNTER(&pApicCpu->StatMaskedByTpr,   "Number of times TPR masks an interrupt in apicGetInterrupt.",
    1565                          "/Devices/APIC/%u/MaskedByTpr");
    1566         APIC_REG_COUNTER(&pApicCpu->StatMaskedByPpr,   "Number of times PPR masks an interrupt in apicGetInterrupt.",
    1567                          "/Devices/APIC/%u/MaskedByPpr");
    1568         APIC_REG_COUNTER(&pApicCpu->StatTimerIcrWrite, "Number of times the timer ICR is written.",
    1569                          "/Devices/APIC/%u/TimerIcrWrite");
    1570         APIC_REG_COUNTER(&pApicCpu->StatIcrLoWrite,    "Number of times the ICR Lo (send IPI) is written.",
    1571                          "/Devices/APIC/%u/IcrLoWrite");
    1572         APIC_REG_COUNTER(&pApicCpu->StatIcrHiWrite,    "Number of times the ICR Hi is written.",
    1573                          "/Devices/APIC/%u/IcrHiWrite");
    1574         APIC_REG_COUNTER(&pApicCpu->StatIcrFullWrite,  "Number of times the ICR full (send IPI, x2APIC) is written.",
    1575                          "/Devices/APIC/%u/IcrFullWrite");
    1576     }
     1530        APIC_REG_COUNTER(&pApicCpu->StatMmioReadRZ,    "%u/RZ/MmioRead",    "Number of APIC MMIO reads in RZ.");
     1531        APIC_REG_COUNTER(&pApicCpu->StatMmioWriteRZ,   "%u/RZ/MmioWrite",   "Number of APIC MMIO writes in RZ.");
     1532        APIC_REG_COUNTER(&pApicCpu->StatMsrReadRZ,     "%u/RZ/MsrRead",     "Number of APIC MSR reads in RZ.");
     1533        APIC_REG_COUNTER(&pApicCpu->StatMsrWriteRZ,    "%u/RZ/MsrWrite",    "Number of APIC MSR writes in RZ.");
     1534
     1535        APIC_REG_COUNTER(&pApicCpu->StatMmioReadR3,    "%u/R3/MmioReadR3",  "Number of APIC MMIO reads in R3.");
     1536        APIC_REG_COUNTER(&pApicCpu->StatMmioWriteR3,   "%u/R3/MmioWriteR3", "Number of APIC MMIO writes in R3.");
     1537        APIC_REG_COUNTER(&pApicCpu->StatMsrReadR3,     "%u/R3/MsrReadR3",   "Number of APIC MSR reads in R3.");
     1538        APIC_REG_COUNTER(&pApicCpu->StatMsrWriteR3,    "%u/R3/MsrWriteR3",  "Number of APIC MSR writes in R3.");
     1539
     1540        APIC_REG_COUNTER(&pApicCpu->StatPostIntrAlreadyPending,
     1541                                                       "%u/PostInterruptAlreadyPending", "Number of times an interrupt is already pending.");
     1542        APIC_REG_COUNTER(&pApicCpu->StatTimerCallback, "%u/TimerCallback",  "Number of times the timer callback is invoked.");
     1543
     1544        APIC_REG_COUNTER(&pApicCpu->StatTprWrite,      "%u/TprWrite",       "Number of TPR writes.");
     1545        APIC_REG_COUNTER(&pApicCpu->StatTprRead,       "%u/TprRead",        "Number of TPR reads.");
     1546        APIC_REG_COUNTER(&pApicCpu->StatEoiWrite,      "%u/EoiWrite",       "Number of EOI writes.");
     1547        APIC_REG_COUNTER(&pApicCpu->StatMaskedByTpr,   "%u/MaskedByTpr",    "Number of times TPR masks an interrupt in apicGetInterrupt.");
     1548        APIC_REG_COUNTER(&pApicCpu->StatMaskedByPpr,   "%u/MaskedByPpr",    "Number of times PPR masks an interrupt in apicGetInterrupt.");
     1549        APIC_REG_COUNTER(&pApicCpu->StatTimerIcrWrite, "%u/TimerIcrWrite",  "Number of times the timer ICR is written.");
     1550        APIC_REG_COUNTER(&pApicCpu->StatIcrLoWrite,    "%u/IcrLoWrite",     "Number of times the ICR Lo (send IPI) is written.");
     1551        APIC_REG_COUNTER(&pApicCpu->StatIcrHiWrite,    "%u/IcrHiWrite",     "Number of times the ICR Hi is written.");
     1552        APIC_REG_COUNTER(&pApicCpu->StatIcrFullWrite,  "%u/IcrFullWrite",   "Number of times the ICR full (send IPI, x2APIC) is written.");
     1553
     1554        APIC_PROF_COUNTER(&pApicCpu->StatUpdatePendingIntrs,
     1555                                                       "/PROF/CPU%d/APIC/UpdatePendingInterrupts", "Profiling of APICUpdatePendingInterrupts");
     1556        APIC_PROF_COUNTER(&pApicCpu->StatPostIntr,     "/PROF/CPU%d/APIC/PostInterrupt",  "Profiling of APICPostInterrupt");
     1557    }
     1558
    15771559# undef APIC_PROF_COUNTER
    15781560# undef APIC_REG_ACCESS_COUNTER
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