VirtualBox

Changeset 54256 in vbox


Ignore:
Timestamp:
Feb 17, 2015 11:20:44 PM (10 years ago)
Author:
vboxsync
Message:

VMCPU: Added a iHostCpuSet field to go with the idHostCpu one. This allows for better GIP time & TSC code in raw-mode context.

Location:
trunk
Files:
3 edited

Legend:

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

    r53795 r54256  
    117117     * Only valid when in RC or HMR0 with scheduling disabled. */
    118118    RTCPUID volatile        idHostCpu;                              /* 56 / 36 */
     119    /** The CPU set index corresponding to idHostCpu, UINT32_MAX if not valid.
     120     * @remarks Best to make sure iHostCpuSet shares cache line with idHostCpu! */
     121    uint32_t volatile       iHostCpuSet;                            /* 60 / 40 */
    119122
    120123    /** Trace groups enable flags.  */
    121     uint32_t                fTraceGroups;                           /* 60 / 40 */
     124    uint32_t                fTraceGroups;                           /* 64 / 44 */
    122125    /** Align the structures below bit on a 64-byte boundary and make sure it starts
    123126     * at the same offset in both 64-bit and 32-bit builds.
     
    128131     *          following it (to grow into and align the struct size).
    129132     *   */
    130     uint8_t                 abAlignment1[HC_ARCH_BITS == 64 ? 60 : 16+64];
     133    uint8_t                 abAlignment1[HC_ARCH_BITS == 64 ? 56 : 12+64];
    131134    /** State data for use by ad hoc profiling. */
    132135    uint32_t                uAdHoc;
  • trunk/include/VBox/vmm/vm.mac

    r53094 r54256  
    123123    .hNativeThreadR0        RTR0PTR_RES 1
    124124    .idHostCpu              resd 1
     125    .iHostCpuSet            resd 1
    125126    .fTraceGroups           resd 1
    126127%if HC_ARCH_BITS == 32
    127     .abAlignment1           resb 16+64
     128    .abAlignment1           resb 12+64
    128129%else
    129     .abAlignment1           resb 60
     130    .abAlignment1           resb 56
    130131%endif
    131132    .uAdHoc                 resd 1
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r53632 r54256  
    566566
    567567            /* We need to update the VCPU <-> host CPU mapping. */
    568             RTCPUID idHostCpu = RTMpCpuId();
     568            RTCPUID idHostCpu  = RTMpCpuId();
     569            pVCpu->iHostCpuSet = RTMpCpuIdToSetIndex(idHostCpu);
    569570            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
    570571
     
    586587             * have the same host CPU associated with it.
    587588             */
     589            pVCpu->iHostCpuSet = UINT32_MAX;
    588590            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
    589591            break;
     
    867869            CPUMR0SetLApic(pVCpu, idHostCpu);
    868870#endif
     871            pVCpu->iHostCpuSet = RTMpCpuIdToSetIndex(idHostCpu);
    869872            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
    870873            if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
     
    911914            else
    912915                pVCpu->vmm.s.iLastGZRc = rc;
     916            pVCpu->iHostCpuSet = UINT32_MAX;
    913917            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
    914918            RTThreadPreemptRestore(&PreemptState);
     
    926930
    927931            /* Update the VCPU <-> host CPU mapping before doing anything else. */
    928             ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
     932            RTCPUID  idHostCpu = RTMpCpuId();
     933            pVCpu->iHostCpuSet = RTMpCpuIdToSetIndex(idHostCpu);
     934            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
     935
    929936            if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
    930937                GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
     
    10001007
    10011008            /* Clear the VCPU <-> host CPU mapping as we've left HM context. */
     1009            pVCpu->iHostCpuSet = UINT32_MAX;
    10021010            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
    10031011
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