VirtualBox

Changeset 31359 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Aug 4, 2010 3:31:04 PM (15 years ago)
Author:
vboxsync
Message:

Keep track of the native R0 thread handle for each EMT too. Use that to find the right VCPU

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/VMMAll.cpp

    r31356 r31359  
    6161        return 0;
    6262
    63     /* Search first by host cpu id (most common case)
    64      * and then by native thread id (page fusion case).
    65      */
    66     /* RTMpCpuId had better be cheap. */
    67     RTCPUID idHostCpu = RTMpCpuId();
    68 
    69     /** @todo optimize for large number of VCPUs when that becomes more common. */
    70     for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    71     {
    72         PVMCPU pVCpu = &pVM->aCpus[idCpu];
    73 
    74         if (pVCpu->idHostCpu == idHostCpu)
    75             return pVCpu->idCpu;
    76     }
    77 
    7863    /* RTThreadGetNativeSelf had better be cheap. */
    7964    RTNATIVETHREAD hThread = RTThreadNativeSelf();
     
    8469        PVMCPU pVCpu = &pVM->aCpus[idCpu];
    8570
    86         if (pVCpu->hNativeThread == hThread)
     71        if (pVCpu->hNativeThreadR0 == hThread)
    8772            return pVCpu->idCpu;
    8873    }
     
    115100        return &pVM->aCpus[0];
    116101
    117     /* Search first by host cpu id (most common case)
    118      * and then by native thread id (page fusion case).
    119      */
    120 
    121     /* RTMpCpuId had better be cheap. */
    122     RTCPUID idHostCpu = RTMpCpuId();
    123 
    124     /** @todo optimize for large number of VCPUs when that becomes more common. */
    125     for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    126     {
    127         PVMCPU pVCpu = &pVM->aCpus[idCpu];
    128 
    129         if (pVCpu->idHostCpu == idHostCpu)
    130             return pVCpu;
    131     }
    132 
    133102    /* RTThreadGetNativeSelf had better be cheap. */
    134103    RTNATIVETHREAD hThread = RTThreadNativeSelf();
     
    139108        PVMCPU pVCpu = &pVM->aCpus[idCpu];
    140109
    141         if (pVCpu->hNativeThread == hThread)
     110        if (pVCpu->hNativeThreadR0 == hThread)
    142111            return pVCpu;
    143112    }
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