VirtualBox

Changeset 79485 in vbox


Ignore:
Timestamp:
Jul 3, 2019 5:10:33 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Safer to flag host-context change while interrupts are still disabled, though I think in theory it should work even if RTMpCpuId is called when preemptible as the hook should cover it. Comments. Renamed StatSwitchExportHostState to StatExportHostState.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r79478 r79485  
    13741374    }
    13751375
     1376    /*
     1377     * Disable interrupts to prevent being preempted while we switch the current VMCS as the
     1378     * preemption hook code path acquires the current VMCS.
     1379     */
    13761380    RTCCUINTREG const fEFlags = ASMIntDisableFlags();
     1381
    13771382    int rc = hmR0VmxSwitchVmcs(pVmcsInfoFrom, pVmcsInfoTo);
    13781383    if (RT_SUCCESS(rc))
    13791384    {
    13801385        pVCpu->hm.s.vmx.fSwitchedToNstGstVmcs = fSwitchToNstGstVmcs;
    1381         ASMSetFlags(fEFlags);
    13821386
    13831387        /*
     
    13901394        else
    13911395            ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_VMX_HOST_GUEST_SHARED_STATE);
     1396
     1397        ASMSetFlags(fEFlags);
    13921398
    13931399        /*
     
    91479153    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
    91489154
    9149     RTCPUID idCpu = RTMpCpuId();
     9155    RTCPUID const idCpu = RTMpCpuId();
    91509156    Log4Func(("HostCpuId=%u\n", idCpu));
    91519157
     
    1166011666    if (pVCpu->hm.s.fCtxChanged & HM_CHANGED_HOST_CONTEXT)
    1166111667    {
    11662         int rc = hmR0VmxExportHostState(pVCpu);
    11663         AssertRC(rc);
    11664         STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchExportHostState);
     11668        hmR0VmxExportHostState(pVCpu);
     11669        STAM_COUNTER_INC(&pVCpu->hm.s.StatExportHostState);
    1166511670    }
    1166611671    Assert(!(pVCpu->hm.s.fCtxChanged & HM_CHANGED_HOST_CONTEXT));
     
    1206612071
    1206712072    /*
    12068      * Switch to the nested-guest VMCS as we may have transitioned to executing the
    12069      * nested-guest without leaving ring-0. Otherwise, if we came from ring-3 we would have
     12073     * Switch to the nested-guest VMCS as we may have transitioned from executing the
     12074     * guest without leaving ring-0. Otherwise, if we came from ring-3 we would have
    1207012075     * loaded the nested-guest VMCS while entering the VMX ring-0 session.
    1207112076     */
     
    1207712082        else
    1207812083        {
    12079             LogRelFunc(("Failed to switch to the guest VMCS. rc=%Rrc\n", rc));
     12084            LogRelFunc(("Failed to switch to the nested-guest VMCS. rc=%Rrc\n", rc));
    1208012085            return rc;
    1208112086        }
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r79462 r79485  
    802802        HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchPreempt,          "/HM/CPU%d/Switch/Preempting", "EMT has been preempted while in HM context.");
    803803#ifdef VBOX_WITH_STATISTICS
    804         HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchExportHostState,  "/HM/CPU%d/Switch/ExportHostState", "Preemption or entering with nested-guest VMCS caused re-exporting of host state.");
    805804        HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchNstGstVmexit,     "/HM/CPU%d/Switch/NstGstVmexit", "Nested-guest VM-exit occurred.");
    806805
     
    836835        HM_REG_COUNTER(&pVCpu->hm.s.StatExportFull,             "/HM/CPU%d/Export/Full", "VM-entry exporting the full guest-state.");
    837836        HM_REG_COUNTER(&pVCpu->hm.s.StatLoadGuestFpu,           "/HM/CPU%d/Export/GuestFpu", "VM-entry loading the guest-FPU state.");
     837        HM_REG_COUNTER(&pVCpu->hm.s.StatExportHostState,        "/HM/CPU%d/Export/HostState", "VM-entry exporting host-state.");
    838838
    839839        HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadRmSelBase,   "/HM/CPU%d/VMXCheck/RMSelBase", "Could not use VMX due to unsuitable real-mode selector base.");
  • trunk/src/VBox/VMM/include/HMInternal.h

    r79477 r79485  
    12021202    STAMCOUNTER             StatSwitchApicAccessToR3;
    12031203    STAMCOUNTER             StatSwitchPreempt;
    1204     STAMCOUNTER             StatSwitchExportHostState;
    12051204    STAMCOUNTER             StatSwitchNstGstVmexit;
    12061205
     
    12161215    STAMCOUNTER             StatExportFull;
    12171216    STAMCOUNTER             StatLoadGuestFpu;
     1217    STAMCOUNTER             StatExportHostState;
    12181218
    12191219    STAMCOUNTER             StatVmxCheckBadRmSelBase;
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