VirtualBox

Changeset 9429 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 5, 2008 3:22:37 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
31680
Message:

RTMpDoesCpuExist -> RTMpIsCpuPossible. Changed the RTMpGetCount and RTMpGetSet specification to include all possible cpus.

Location:
trunk/src/VBox
Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h

    r8890 r9429  
    182182 * The upper 16-bit is the major version, the the lower the minor version.
    183183 * When incompatible changes are made, the upper major number has to be changed. */
    184 #define SUPDRVIOC_VERSION                               0x00070002
     184#define SUPDRVIOC_VERSION                               0x00070003
    185185
    186186/** SUP_IOCTL_COOKIE. */
  • trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c

    r9212 r9429  
    202202    { "RTMpCpuIdFromSetIndex",                  (void *)RTMpCpuIdFromSetIndex },
    203203    { "RTMpCpuIdToSetIndex",                    (void *)RTMpCpuIdToSetIndex },
    204     { "RTMpDoesCpuExist",                       (void *)RTMpDoesCpuExist },
     204    { "RTMpIsCpuPossible",                      (void *)RTMpIsCpuPossible },
    205205    { "RTMpGetCount",                           (void *)RTMpGetCount },
    206206    { "RTMpGetMaxCpuId",                        (void *)RTMpGetMaxCpuId },
  • trunk/src/VBox/Runtime/Makefile.kmk

    r9366 r9429  
    978978        generic/RTMpCpuIdFromSetIndex-generic.cpp \
    979979        generic/RTMpCpuIdToSetIndex-generic.cpp \
    980         generic/RTMpDoesCpuExist-generic.cpp \
     980        generic/RTMpIsCpuPossible-generic.cpp \
    981981        generic/RTMpGetCount-generic.cpp \
    982982        generic/RTMpGetMaxCpuId-generic.cpp \
     
    10221022        generic/RTMpCpuIdFromSetIndex-generic.cpp \
    10231023        generic/RTMpCpuIdToSetIndex-generic.cpp \
    1024         generic/RTMpDoesCpuExist-generic.cpp \
     1024        generic/RTMpIsCpuPossible-generic.cpp \
    10251025        generic/RTMpGetCount-generic.cpp \
    10261026        generic/RTMpGetMaxCpuId-generic.cpp \
     
    10691069        generic/RTMpCpuIdFromSetIndex-generic.cpp \
    10701070        generic/RTMpCpuIdToSetIndex-generic.cpp \
    1071         generic/RTMpDoesCpuExist-generic.cpp \
     1071        generic/RTMpIsCpuPossible-generic.cpp \
    10721072        generic/RTMpGetCount-generic.cpp \
    10731073        generic/RTMpGetMaxCpuId-generic.cpp \
     
    11261126        generic/RTMpCpuIdFromSetIndex-generic.cpp \
    11271127        generic/RTMpCpuIdToSetIndex-generic.cpp \
    1128         generic/RTMpDoesCpuExist-generic.cpp \
     1128        generic/RTMpIsCpuPossible-generic.cpp \
    11291129        generic/RTMpGetCount-generic.cpp \
    11301130        generic/RTMpGetMaxCpuId-generic.cpp \
     
    11951195        generic/RTMpCpuIdFromSetIndex-generic.cpp \
    11961196        generic/RTMpCpuIdToSetIndex-generic.cpp \
    1197         generic/RTMpDoesCpuExist-generic.cpp \
     1197        generic/RTMpIsCpuPossible-generic.cpp \
    11981198        generic/RTMpGetCount-generic.cpp \
    11991199        generic/RTMpGetMaxCpuId-generic.cpp \
  • trunk/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp

    r8245 r9429  
    4545    do
    4646    {
    47         if (RTMpDoesCpuExist(idCpu))
     47        if (RTMpIsCpuPossible(idCpu))
    4848            RTCpuSetAdd(pSet, idCpu);
    4949    } while (idCpu-- > 0);
  • trunk/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp

    r9407 r9429  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Multiprocessor, Generic RTMpDoesCpuExist.
     3 * IPRT - Multiprocessor, Generic RTMpIsCpuPossible.
    44 */
    55
     
    3636
    3737
    38 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
     38RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
    3939{
    4040    return RTMpCpuId() == idCpu;
  • trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c

    r8245 r9429  
    6666
    6767
    68 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
    69 {
    70 #ifdef CONFIG_SMP
     68RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
     69{
     70#if defined(CONFIG_SMP)
    7171    if (RT_UNLIKELY(idCpu >= NR_CPUS))
    7272        return false;
    73 # ifdef cpu_online
    74     return cpu_online(idCpu);
    75 # else /* 2.4: */
    76     return cpu_online_map & RT_BIT_64(idCpu);
    77 # endif
    78 #else
    79     return idCpu == RTMpCpuId();
    80 #endif
    81 }
    82 
    83 
    84 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
    85 {
    86 #ifdef CONFIG_SMP
    87     if (RT_UNLIKELY(idCpu >= NR_CPUS))
    88         return false;
    89 # ifdef CONFIG_HOTPLUG_CPU /* introduced & uses cpu_present */
    90     return cpu_present(idCpu);
    91 # elif defined(cpu_possible)
     73
     74# if defined(cpu_possible)
    9275    return cpu_possible(idCpu);
    93 # else /* 2.4: */
     76# else /* < 2.5.29 */
    9477    return idCpu < (RTCPUID)smp_num_cpus;
    9578# endif
     
    10891    do
    10992    {
    110         if (RTMpDoesCpuExist(idCpu))
     93        if (RTMpIsCpuPossible(idCpu))
    11194            RTCpuSetAdd(pSet, idCpu);
    11295    } while (idCpu-- > 0);
     
    135118
    136119
     120RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
     121{
     122#ifdef CONFIG_SMP
     123    if (RT_UNLIKELY(idCpu >= NR_CPUS))
     124        return false;
     125# ifdef cpu_online
     126    return cpu_online(idCpu);
     127# else /* 2.4: */
     128    return cpu_online_map & RT_BIT_64(idCpu);
     129# endif
     130#else
     131    return idCpu == RTMpCpuId();
     132#endif
     133}
     134
     135
    137136RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
    138137{
     
    272271    Args.cHits = 0;
    273272
    274     if (!RTMpDoesCpuExist(idCpu))
     273    if (!RTMpIsCpuPossible(idCpu))
    275274        return VERR_CPU_NOT_FOUND;
    276275
  • trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp

    r8840 r9429  
    9595        return false;
    9696
     97    /** @todo this must be done at init time as it's not safe under all circumstances (braindead OS design). */
    9798    KAFFINITY Mask = KeQueryActiveProcessors();
    9899    return !!(Mask & RT_BIT_64(idCpu));
     
    100101
    101102
    102 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
     103RTDECL(bool) RTMpIsCpuPresent(RTCPUID idCpu)
    103104{
    104105    /* Cannot easily distinguish between online and offline cpus. */
     106    /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */
    105107    return RTMpIsCpuOnline(idCpu);
    106108}
     
    109111RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet)
    110112{
     113    /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */
    111114    return RTMpGetOnlineSet(pSet);
    112115}
     
    115118RTDECL(RTCPUID) RTMpGetCount(void)
    116119{
     120    /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */
    117121    return RTMpGetOnlineCount();
    118122}
     
    167171#if 0
    168172    /* KeFlushQueuedDpcs must be run at IRQL PASSIVE_LEVEL according to MSDN, but the
    169      * driver verifier doesn't complain... 
     173     * driver verifier doesn't complain...
    170174     */
    171175    AssertMsg(KeGetCurrentIrql() == PASSIVE_LEVEL, ("%d != %d (PASSIVE_LEVEL)\n", KeGetCurrentIrql(), PASSIVE_LEVEL));
     
    173177
    174178    KAFFINITY Mask = KeQueryActiveProcessors();
    175 
    176     if (    enmCpuid == RT_NT_CPUID_SPECIFIC
    177         &&  (   idCpu >= 64
    178              || !(Mask & RT_BIT_64(idCpu))))
    179         return VERR_CPU_NOT_FOUND;  /* can't distinguish between cpu not present or offline */
    180179
    181180    /* KeFlushQueuedDpcs is not present in Windows 2000; import it dynamically so we can just fail this call. */
     
    244243        }
    245244        if (enmCpuid != RT_NT_CPUID_OTHERS)
    246         {
    247245            pfnWorker(iSelf, pvUser1, pvUser2);
    248         }
    249246    }
    250247
     
    270267RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
    271268{
     269    if (RTMpIsCpuOnline(idCpu);
     270        return !RTMpIsCpuPossible(idCpu) ? VERR_CPU_NOT_FOUND : VERR_CPU_OFFLINE;
     271
    272272    return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_SPECIFIC, idCpu);
    273273}
  • trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c

    r8245 r9429  
    6666
    6767
    68 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
    69 {
    70     cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL;
    71     return pCpu
    72         && cpu_is_online(pCpu);
    73 }
    74 
    75 
    76 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
     68RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
    7769{
    7870    cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL;
     
    8981    do
    9082    {
    91         if (RTMpDoesCpuExist(idCpu))
     83        if (RTMpIsCpuPossible(idCpu))
    9284            RTCpuSetAdd(pSet, idCpu);
    9385    } while (idCpu-- > 0);
     
    10092{
    10193    return ncpus;
     94}
     95
     96
     97RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
     98{
     99    cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL;
     100    return pCpu
     101        && cpu_is_online(pCpu);
    102102}
    103103
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c

    r9149 r9429  
    7272
    7373
    74 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
     74RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
    7575{
    7676    return idCpu < vbi_cpu_count();
     
    8686    do
    8787    {
    88         if (RTMpDoesCpuExist(idCpu))
     88        if (RTMpIsCpuPossible(idCpu))
    8989            RTCpuSetAdd(pSet, idCpu);
    9090    } while (idCpu-- > 0);
  • trunk/src/VBox/Runtime/r3/os2/mp-os2.cpp

    r8245 r9429  
    6262
    6363
    64 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
    65 {
    66     RTCPUSET Set;
    67     return RTCpuSetIsMember(RTMpGetOnlineSet(&Set), idCpu);
    68 }
    69 
    70 
    71 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
     64RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
    7265{
    7366    RTCPUSET Set;
     
    9689
    9790
     91RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
     92{
     93    RTCPUSET Set;
     94    return RTCpuSetIsMember(RTMpGetOnlineSet(&Set), idCpu);
     95}
     96
     97
    9898RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
    9999{
  • trunk/src/VBox/Runtime/r3/win/mp-win.cpp

    r8245 r9429  
    6767
    6868
    69 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
     69RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
    7070{
    7171    RTCPUSET Set;
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