VirtualBox

Changeset 55306 in vbox


Ignore:
Timestamp:
Apr 16, 2015 12:56:05 PM (10 years ago)
Author:
vboxsync
Message:

VMM: renamed HM_[DISABLE|RESTORE]_PREEMPT_IF_NEEDED() macro.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/hm.h

    r55248 r55306  
    183183                                                          unsigned uPort, unsigned uAndVal, unsigned cbSize);
    184184#ifdef VBOX_STRICT
    185 # define HM_DISABLE_PREEMPT_IF_NEEDED() \
     185# define HM_DISABLE_PREEMPT() \
    186186    RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
    187187    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD) || VMMR0ThreadCtxHooksAreRegistered(pVCpu)); \
    188188    RTThreadPreemptDisable(&PreemptStateInternal);
    189189#else
    190 # define HM_DISABLE_PREEMPT_IF_NEEDED() \
     190# define HM_DISABLE_PREEMPT() \
    191191    RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
    192192    RTThreadPreemptDisable(&PreemptStateInternal);
    193193#endif /* VBOX_STRICT */
    194 # define HM_RESTORE_PREEMPT_IF_NEEDED() do { RTThreadPreemptRestore(&PreemptStateInternal); } while(0)
     194# define HM_RESTORE_PREEMPT()  do { RTThreadPreemptRestore(&PreemptStateInternal); } while(0)
    195195
    196196
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r55290 r55306  
    21152115static int hmR0SvmLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
    21162116{
    2117     HM_DISABLE_PREEMPT_IF_NEEDED();
     2117    HM_DISABLE_PREEMPT();
    21182118    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
    21192119    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    21382138    int rc = HMR0LeaveCpu(pVCpu);
    21392139
    2140     HM_RESTORE_PREEMPT_IF_NEEDED();
     2140    HM_RESTORE_PREEMPT();
    21412141    return rc;
    21422142}
     
    21802180        VMMRZCallRing3RemoveNotification(pVCpu);
    21812181        VMMRZCallRing3Disable(pVCpu);
    2182         HM_DISABLE_PREEMPT_IF_NEEDED();
     2182        HM_DISABLE_PREEMPT();
    21832183
    21842184        /* Restore host FPU state if necessary and resync on next R0 reentry .*/
     
    21952195        HMR0LeaveCpu(pVCpu);
    21962196
    2197         HM_RESTORE_PREEMPT_IF_NEEDED();
     2197        HM_RESTORE_PREEMPT();
    21982198        return VINF_SUCCESS;
    21992199    }
     
    46644664        /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
    46654665        VMMRZCallRing3Disable(pVCpu);
    4666         HM_DISABLE_PREEMPT_IF_NEEDED();
     4666        HM_DISABLE_PREEMPT();
    46674667
    46684668        /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
     
    46704670        Assert(CPUMIsGuestDebugStateActive(pVCpu) || HC_ARCH_BITS == 32);
    46714671
    4672         HM_RESTORE_PREEMPT_IF_NEEDED();
     4672        HM_RESTORE_PREEMPT();
    46734673        VMMRZCallRing3Enable(pVCpu);
    46744674
     
    48174817            /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
    48184818            VMMRZCallRing3Disable(pVCpu);
    4819             HM_DISABLE_PREEMPT_IF_NEEDED();
     4819            HM_DISABLE_PREEMPT();
    48204820
    48214821            STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIoCheck);
     
    48364836                rcStrict = rcStrict2;
    48374837
    4838             HM_RESTORE_PREEMPT_IF_NEEDED();
     4838            HM_RESTORE_PREEMPT();
    48394839            VMMRZCallRing3Enable(pVCpu);
    48404840        }
     
    52085208    /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
    52095209    VMMRZCallRing3Disable(pVCpu);
    5210     HM_DISABLE_PREEMPT_IF_NEEDED();
     5210    HM_DISABLE_PREEMPT();
    52115211
    52125212    int rc;
     
    52265226    }
    52275227
    5228     HM_RESTORE_PREEMPT_IF_NEEDED();
     5228    HM_RESTORE_PREEMPT();
    52295229    VMMRZCallRing3Enable(pVCpu);
    52305230
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r55292 r55306  
    59815981     */
    59825982    VMMRZCallRing3Disable(pVCpu);
    5983     HM_DISABLE_PREEMPT_IF_NEEDED();
     5983    HM_DISABLE_PREEMPT();
    59845984
    59855985    if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_CR0))
     
    59985998    }
    59995999
    6000     HM_RESTORE_PREEMPT_IF_NEEDED();
     6000    HM_RESTORE_PREEMPT();
    60016001    VMMRZCallRing3Enable(pVCpu);
    60026002    return VINF_SUCCESS;
     
    62756275        /* Since this can be called from our preemption hook it's safer to make the guest-MSRs update non-preemptible. */
    62766276        VMMRZCallRing3Disable(pVCpu);
    6277         HM_DISABLE_PREEMPT_IF_NEEDED();
     6277        HM_DISABLE_PREEMPT();
    62786278
    62796279        /* Doing the check here ensures we don't overwrite already-saved guest MSRs from a preemption hook. */
     
    62846284        }
    62856285
    6286         HM_RESTORE_PREEMPT_IF_NEEDED();
     6286        HM_RESTORE_PREEMPT();
    62876287        VMMRZCallRing3Enable(pVCpu);
    62886288    }
     
    72007200DECLINLINE(int) hmR0VmxLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    72017201{
    7202     HM_DISABLE_PREEMPT_IF_NEEDED();
     7202    HM_DISABLE_PREEMPT();
    72037203    HMVMX_ASSERT_CPU_SAFE();
    72047204    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     
    72107210    {
    72117211        int rc2 = hmR0VmxLeave(pVM, pVCpu, pMixedCtx, true /* fSaveGuestState */);
    7212         AssertRCReturnStmt(rc2, HM_RESTORE_PREEMPT_IF_NEEDED(), rc2);
     7212        AssertRCReturnStmt(rc2, HM_RESTORE_PREEMPT(), rc2);
    72137213        pVCpu->hm.s.fLeaveDone = true;
    72147214    }
     
    72287228    int rc = HMR0LeaveCpu(pVCpu);
    72297229
    7230     HM_RESTORE_PREEMPT_IF_NEEDED();
    7231 
     7230    HM_RESTORE_PREEMPT();
    72327231    return rc;
    72337232}
     
    73597358        VMMRZCallRing3RemoveNotification(pVCpu);
    73607359        VMMRZCallRing3Disable(pVCpu);
    7361         HM_DISABLE_PREEMPT_IF_NEEDED();
     7360        HM_DISABLE_PREEMPT();
    73627361
    73637362        PVM pVM = pVCpu->CTX_SUFF(pVM);
     
    73937392
    73947393        HMR0LeaveCpu(pVCpu);
    7395         HM_RESTORE_PREEMPT_IF_NEEDED();
     7394        HM_RESTORE_PREEMPT();
    73967395        return VINF_SUCCESS;
    73977396    }
     
    1130511304            /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
    1130611305            VMMRZCallRing3Disable(pVCpu);
    11307             HM_DISABLE_PREEMPT_IF_NEEDED();
     11306            HM_DISABLE_PREEMPT();
    1130811307
    1130911308            bool fIsGuestDbgActive = CPUMR0DebugStateMaybeSaveGuest(pVCpu, true /* fDr6 */);
     
    1132511324                rcStrict = rcStrict2;
    1132611325
    11327             HM_RESTORE_PREEMPT_IF_NEEDED();
     11326            HM_RESTORE_PREEMPT();
    1132811327            VMMRZCallRing3Enable(pVCpu);
    1132911328        }
     
    1153311532        /* We're playing with the host CPU state here, make sure we can't preempt or longjmp. */
    1153411533        VMMRZCallRing3Disable(pVCpu);
    11535         HM_DISABLE_PREEMPT_IF_NEEDED();
     11534        HM_DISABLE_PREEMPT();
    1153611535
    1153711536        /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
     
    1153911538        Assert(CPUMIsGuestDebugStateActive(pVCpu) || HC_ARCH_BITS == 32);
    1154011539
    11541         HM_RESTORE_PREEMPT_IF_NEEDED();
     11540        HM_RESTORE_PREEMPT();
    1154211541        VMMRZCallRing3Enable(pVCpu);
    1154311542
     
    1181911818         */
    1182011819        VMMRZCallRing3Disable(pVCpu);
    11821         HM_DISABLE_PREEMPT_IF_NEEDED();
     11820        HM_DISABLE_PREEMPT();
    1182211821
    1182311822        pMixedCtx->dr[6] &= ~X86_DR6_B_MASK;
     
    1182611825            ASMSetDR6(pMixedCtx->dr[6]);
    1182711826
    11828         HM_RESTORE_PREEMPT_IF_NEEDED();
     11827        HM_RESTORE_PREEMPT();
    1182911828        VMMRZCallRing3Enable(pVCpu);
    1183011829
     
    1188611885    /* We're playing with the host CPU state here, have to disable preemption or longjmp. */
    1188711886    VMMRZCallRing3Disable(pVCpu);
    11888     HM_DISABLE_PREEMPT_IF_NEEDED();
     11887    HM_DISABLE_PREEMPT();
    1188911888
    1189011889    /* If the guest FPU was active at the time of the #NM exit, then it's a guest fault. */
     
    1190311902    }
    1190411903
    11905     HM_RESTORE_PREEMPT_IF_NEEDED();
     11904    HM_RESTORE_PREEMPT();
    1190611905    VMMRZCallRing3Enable(pVCpu);
    1190711906
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r54720 r55306  
    565565        case RTTHREADCTXEVENT_RESUMED:
    566566        {
    567             /** @todo Linux may call us with preemption enabled (really!) but technically we
     567            /*
     568             * Linux may call us with preemption enabled (really!) but technically we
    568569             * cannot get preempted here, otherwise we end up in an infinite recursion
    569              * scenario (i.e. preempted in resume hook -> preempt hook -> resume hook... ad
    570              * infinitum). Let's just disable preemption for now...
     570             * scenario (i.e. preempted in resume hook -> preempt hook -> resume hook...
     571             * ad infinitum). Let's just disable preemption for now...
    571572             */
    572             HM_DISABLE_PREEMPT_IF_NEEDED();
     573            HM_DISABLE_PREEMPT();
    573574
    574575            /* We need to update the VCPU <-> host CPU mapping. */
     
    588589
    589590            /* Restore preemption. */
    590             HM_RESTORE_PREEMPT_IF_NEEDED();
     591            HM_RESTORE_PREEMPT();
    591592            break;
    592593        }
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