VirtualBox

Changeset 72659 in vbox for trunk


Ignore:
Timestamp:
Jun 22, 2018 11:34:07 AM (7 years ago)
Author:
vboxsync
Message:

EM: Made the EMHistoryExec parameters settable via CFGM. bugref:9198

File:
1 edited

Legend:

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

    r72658 r72659  
    174174    /** @todo change the default to true here */
    175175    bool fExitOptimizationEnabledR0PreemptDisabled = true;
    176     rc = CFGMR3QueryBoolDef(pCfgEM, "ExitOptimizationEnabledR0PreemptDisabled", &fExitOptimizationEnabledR0PreemptDisabled, false);
     176    rc = CFGMR3QueryBoolDef(pCfgEM, "ExitOptimizationEnabledR0PreemptDisabled", &fExitOptimizationEnabledR0PreemptDisabled, true);
    177177    AssertLogRelRCReturn(rc, rc);
    178178    fExitOptimizationEnabledR0PreemptDisabled &= fExitOptimizationEnabledR0;
     179
     180    /** @cfgm{/EM/HistoryExecMaxInstructions, integer, 16, 65535, 8192}
     181     * Maximum number of instruction to let EMHistoryExec execute in one go. */
     182    uint16_t cHistoryExecMaxInstructions = 8192;
     183    rc = CFGMR3QueryU16Def(pCfgEM, "HistoryExecMaxInstructions", &cHistoryExecMaxInstructions, cHistoryExecMaxInstructions);
     184    AssertLogRelRCReturn(rc, rc);
     185    if (cHistoryExecMaxInstructions < 16)
     186        return VMSetError(pVM, VERR_OUT_OF_RANGE, RT_SRC_POS, "/EM/HistoryExecMaxInstructions value is too small, min 16");
     187
     188    /** @cfgm{/EM/HistoryProbeMaxInstructionsWithoutExit, integer, 2, 65535, 24 for HM, 32 for NEM}
     189     * Maximum number of instruction between exits during probing. */
     190    uint16_t cHistoryProbeMaxInstructionsWithoutExit = 24;
     191#ifdef RT_OS_WINDOWS
     192    if (VM_IS_NEM_ENABLED(pVM))
     193        cHistoryProbeMaxInstructionsWithoutExit = 32;
     194#endif
     195    rc = CFGMR3QueryU16Def(pCfgEM, "HistoryProbeMaxInstructionsWithoutExit", &cHistoryProbeMaxInstructionsWithoutExit,
     196                           cHistoryProbeMaxInstructionsWithoutExit);
     197    AssertLogRelRCReturn(rc, rc);
     198    if (cHistoryProbeMaxInstructionsWithoutExit < 2)
     199        return VMSetError(pVM, VERR_OUT_OF_RANGE, RT_SRC_POS,
     200                          "/EM/HistoryProbeMaxInstructionsWithoutExit value is too small, min 16");
     201
     202    /** @cfgm{/EM/HistoryProbMinInstructions, integer, 0, 65535, depends}
     203     * The default is (/EM/HistoryProbeMaxInstructionsWithoutExit + 1) * 3. */
     204    uint16_t cHistoryProbeMinInstructions = cHistoryProbeMaxInstructionsWithoutExit < 0x5554
     205                                          ? (cHistoryProbeMaxInstructionsWithoutExit + 1) * 3 : 0xffff;
     206    rc = CFGMR3QueryU16Def(pCfgEM, "HistoryProbMinInstructions", &cHistoryProbeMinInstructions,
     207                           cHistoryProbeMinInstructions);
     208    AssertLogRelRCReturn(rc, rc);
    179209
    180210    for (VMCPUID i = 0; i < pVM->cCpus; i++)
     
    184214        pVM->aCpus[i].em.s.fExitOptimizationEnabledR0PreemptDisabled = fExitOptimizationEnabledR0PreemptDisabled;
    185215
    186         pVM->aCpus[i].em.s.cHistoryExecMaxInstructions               = 8192;
    187         pVM->aCpus[i].em.s.cHistoryProbeMinInstructions              = 75;
    188         pVM->aCpus[i].em.s.cHistoryProbeMaxInstructionsWithoutExit   = 24;
    189 #ifdef RT_OS_WINDOWS
    190         if (VM_IS_NEM_ENABLED(pVM))
    191         {
    192             pVM->aCpus[i].em.s.cHistoryProbeMaxInstructionsWithoutExit = 32;
    193             pVM->aCpus[i].em.s.cHistoryProbeMinInstructions            = 99;
    194         }
    195 #endif
     216        pVM->aCpus[i].em.s.cHistoryExecMaxInstructions               = cHistoryExecMaxInstructions;
     217        pVM->aCpus[i].em.s.cHistoryProbeMinInstructions              = cHistoryProbeMinInstructions;
     218        pVM->aCpus[i].em.s.cHistoryProbeMaxInstructionsWithoutExit   = cHistoryProbeMaxInstructionsWithoutExit;
    196219    }
    197220
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