VirtualBox

Changeset 72642 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jun 21, 2018 3:41:14 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123148
Message:

EM,IEM,VMX: Working on configuring exit history optimziations. Currently enabled in ring-0 for NEM but disabled for HM. bugref:9198

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

Legend:

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

    r72634 r72642  
    149149    }
    150150
    151     /**
    152      * @cfgm{/EM/ExitOptimizationEnabled, bool, true for NEM otherwise false}
    153      * Whether to try correlate exit history, detect hot spots and try optimize
    154      * these using IEM if there are other exits close by.
    155      * @todo enable for HM too.
    156      */
     151    LogRel(("EMR3Init: fRecompileUser=%RTbool fRecompileSupervisor=%RTbool fRawRing1Enabled=%RTbool fIemExecutesAll=%RTbool fGuruOnTripleFault=%RTbool\n",
     152            pVM->fRecompileUser, pVM->fRecompileSupervisor, pVM->fRawRing1Enabled, pVM->em.s.fIemExecutesAll, pVM->em.s.fGuruOnTripleFault));
     153
     154    /** @cfgm{/EM/ExitOptimizationEnabled, bool, true}
     155     * Whether to try correlate exit history in any context, detect hot spots and
     156     * try optimize these using IEM if there are other exits close by.  This
     157     * overrides the context specific settings. */
    157158    bool fExitOptimizationEnabled = true;
    158     rc = CFGMR3QueryBoolDef(pCfgEM, "ExitOptimizationEnabled", &fExitOptimizationEnabled, VM_IS_NEM_ENABLED(pVM));
     159    rc = CFGMR3QueryBoolDef(pCfgEM, "ExitOptimizationEnabled", &fExitOptimizationEnabled, true);
    159160    AssertLogRelRCReturn(rc, rc);
    160161
     162    /** @cfgm{/EM/ExitOptimizationEnabledR0, bool, true}
     163     * Whether to optimize exits in ring-0.  Setting this to false will also disable
     164     * the /EM/ExitOptimizationEnabledR0PreemptDisabled setting.  Depending on preemption
     165     * capabilities of the host kernel, this optimization may be unavailable. */
     166    bool fExitOptimizationEnabledR0 = true;
     167    rc = CFGMR3QueryBoolDef(pCfgEM, "ExitOptimizationEnabledR0", &fExitOptimizationEnabledR0, true);
     168    AssertLogRelRCReturn(rc, rc);
     169    fExitOptimizationEnabledR0 &= fExitOptimizationEnabled;
     170
     171    /** @cfgm{/EM/ExitOptimizationEnabledR0PreemptDisabled, bool, false}
     172     * Whether to optimize exits in ring-0 when preemption is disable (or preemption
     173     * hooks are in effect). */
     174    /** @todo change the default to true here */
     175    bool fExitOptimizationEnabledR0PreemptDisabled = true;
     176    rc = CFGMR3QueryBoolDef(pCfgEM, "ExitOptimizationEnabledR0PreemptDisabled", &fExitOptimizationEnabledR0PreemptDisabled, false);
     177    AssertLogRelRCReturn(rc, rc);
     178    fExitOptimizationEnabledR0PreemptDisabled &= fExitOptimizationEnabledR0;
     179
    161180    for (VMCPUID i = 0; i < pVM->cCpus; i++)
    162         pVM->aCpus[i].em.s.fExitOptimizationEnabled = fExitOptimizationEnabled;
    163 
    164     LogRel(("EMR3Init: fRecompileUser=%RTbool fRecompileSupervisor=%RTbool fRawRing1Enabled=%RTbool fIemExecutesAll=%RTbool fGuruOnTripleFault=%RTbool fExitOptimizationEnabled=%RTbool\n",
    165             pVM->fRecompileUser, pVM->fRecompileSupervisor, pVM->fRawRing1Enabled, pVM->em.s.fIemExecutesAll, pVM->em.s.fGuruOnTripleFault, fExitOptimizationEnabled));
     181    {
     182        pVM->aCpus[i].em.s.fExitOptimizationEnabled                  = fExitOptimizationEnabled;
     183        pVM->aCpus[i].em.s.fExitOptimizationEnabledR0                = fExitOptimizationEnabledR0;
     184        pVM->aCpus[i].em.s.fExitOptimizationEnabledR0PreemptDisabled = fExitOptimizationEnabledR0PreemptDisabled;
     185    }
    166186
    167187#ifdef VBOX_WITH_REM
     
    502522
    503523/**
     524 * Called when a VM initialization stage is completed.
     525 *
     526 * @returns VBox status code.
     527 * @param   pVM             The cross context VM structure.
     528 * @param   enmWhat         The initialization state that was completed.
     529 */
     530VMMR3_INT_DECL(int) EMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat)
     531{
     532    if (enmWhat == VMINITCOMPLETED_RING0)
     533        LogRel(("EM: Exit history optimizations: enabled=%RTbool enabled-r0=%RTbool enabled-r0-no-preemption=%RTbool\n",
     534                pVM->aCpus[0].em.s.fExitOptimizationEnabled, pVM->aCpus[0].em.s.fExitOptimizationEnabledR0,
     535                pVM->aCpus[0].em.s.fExitOptimizationEnabledR0PreemptDisabled));
     536    return VINF_SUCCESS;
     537}
     538
     539
     540/**
    504541 * Applies relocations to data and code managed by this
    505542 * component. This function will be called at init and
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r72343 r72642  
    11971197    if (RT_SUCCESS(rc))
    11981198        rc = CPUMR3InitCompleted(pVM, enmWhat);
     1199    if (RT_SUCCESS(rc))
     1200        rc = EMR3InitCompleted(pVM, enmWhat);
    11991201    if (enmWhat == VMINITCOMPLETED_RING3)
    12001202    {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette