Changeset 9429 in vbox
- Timestamp:
- Jun 5, 2008 3:22:37 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 1 moved
-
include/iprt/mp.h (modified) (2 diffs)
-
src/VBox/HostDrivers/Support/SUPDRVIOC.h (modified) (1 diff)
-
src/VBox/HostDrivers/Support/SUPDRVShared.c (modified) (1 diff)
-
src/VBox/Runtime/Makefile.kmk (modified) (5 diffs)
-
src/VBox/Runtime/generic/RTMpGetSet-generic.cpp (modified) (1 diff)
-
src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp (moved) (moved from trunk/src/VBox/Runtime/generic/RTMpDoesCpuExist-generic.cpp ) (2 diffs)
-
src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c (modified) (4 diffs)
-
src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp (modified) (8 diffs)
-
src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c (modified) (3 diffs)
-
src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c (modified) (2 diffs)
-
src/VBox/Runtime/r3/os2/mp-os2.cpp (modified) (2 diffs)
-
src/VBox/Runtime/r3/win/mp-win.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mp.h
r9309 r9429 67 67 * 68 68 * This may or may not validate the precense of the CPU, so, use 69 * RTMp DoesCpuExistfor that.69 * RTMpIsCpuPossible for that. 70 70 * 71 71 * @returns The corresponding CPU identifier, NIL_RTCPUID on failure. … … 85 85 86 86 /** 87 * Checks if a CPU is online or not.87 * Checks if a CPU exists in the system or may possibly be hotplugged later. 88 88 * 89 89 * @returns true/false accordingly. 90 90 * @param idCpu The identifier of the CPU. 91 91 */ 92 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu); 93 94 /** 95 * Checks if a CPU exist or not / validates a CPU id. 92 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu); 93 94 /** 95 * Gets set of the CPUs present in the system pluss any that may 96 * possibly be hotplugged later. 97 * 98 * @returns pSet. 99 * @param pSet Where to put the set. 100 */ 101 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet); 102 103 /** 104 * Get the count of CPUs present in the system plus any that may 105 * possibly be hotplugged later. 106 * 107 * @return The count. 108 */ 109 RTDECL(RTCPUID) RTMpGetCount(void); 110 111 /** 112 * Gets set of the CPUs present that are currently online. 113 * 114 * @returns pSet. 115 * @param pSet Where to put the set. 116 */ 117 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet); 118 119 /** 120 * Get the count of CPUs that are currently online. 121 * 122 * @return The count. 123 */ 124 RTDECL(RTCPUID) RTMpGetOnlineCount(void); 125 126 /** 127 * Checks if a CPU is online or not. 96 128 * 97 129 * @returns true/false accordingly. 98 130 * @param idCpu The identifier of the CPU. 99 131 */ 100 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu); 101 102 /** 103 * Gets set of the CPUs present in the system. 104 * 105 * This may or may not validate the precense of the CPU, so, use 106 * RTMpDoesCpuExist for that. 107 * 108 * @returns pSet. 109 * @param pSet Where to put the set. 110 */ 111 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet); 112 113 /** 114 * Get the count of CPUs presetn in the system. 115 * 116 * @return The count. 117 */ 118 RTDECL(RTCPUID) RTMpGetCount(void); 119 120 /** 121 * Gets set of the CPUs present that are currently online. 122 * 123 * @returns pSet. 124 * @param pSet Where to put the set. 125 */ 126 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet); 127 128 /** 129 * Get the count of CPUs that are currently online. 130 * 131 * @return The count. 132 */ 133 RTDECL(RTCPUID) RTMpGetOnlineCount(void); 132 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu); 134 133 135 134 -
trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h
r8890 r9429 182 182 * The upper 16-bit is the major version, the the lower the minor version. 183 183 * When incompatible changes are made, the upper major number has to be changed. */ 184 #define SUPDRVIOC_VERSION 0x0007000 2184 #define SUPDRVIOC_VERSION 0x00070003 185 185 186 186 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c
r9212 r9429 202 202 { "RTMpCpuIdFromSetIndex", (void *)RTMpCpuIdFromSetIndex }, 203 203 { "RTMpCpuIdToSetIndex", (void *)RTMpCpuIdToSetIndex }, 204 { "RTMp DoesCpuExist", (void *)RTMpDoesCpuExist},204 { "RTMpIsCpuPossible", (void *)RTMpIsCpuPossible }, 205 205 { "RTMpGetCount", (void *)RTMpGetCount }, 206 206 { "RTMpGetMaxCpuId", (void *)RTMpGetMaxCpuId }, -
trunk/src/VBox/Runtime/Makefile.kmk
r9366 r9429 978 978 generic/RTMpCpuIdFromSetIndex-generic.cpp \ 979 979 generic/RTMpCpuIdToSetIndex-generic.cpp \ 980 generic/RTMp DoesCpuExist-generic.cpp \980 generic/RTMpIsCpuPossible-generic.cpp \ 981 981 generic/RTMpGetCount-generic.cpp \ 982 982 generic/RTMpGetMaxCpuId-generic.cpp \ … … 1022 1022 generic/RTMpCpuIdFromSetIndex-generic.cpp \ 1023 1023 generic/RTMpCpuIdToSetIndex-generic.cpp \ 1024 generic/RTMp DoesCpuExist-generic.cpp \1024 generic/RTMpIsCpuPossible-generic.cpp \ 1025 1025 generic/RTMpGetCount-generic.cpp \ 1026 1026 generic/RTMpGetMaxCpuId-generic.cpp \ … … 1069 1069 generic/RTMpCpuIdFromSetIndex-generic.cpp \ 1070 1070 generic/RTMpCpuIdToSetIndex-generic.cpp \ 1071 generic/RTMp DoesCpuExist-generic.cpp \1071 generic/RTMpIsCpuPossible-generic.cpp \ 1072 1072 generic/RTMpGetCount-generic.cpp \ 1073 1073 generic/RTMpGetMaxCpuId-generic.cpp \ … … 1126 1126 generic/RTMpCpuIdFromSetIndex-generic.cpp \ 1127 1127 generic/RTMpCpuIdToSetIndex-generic.cpp \ 1128 generic/RTMp DoesCpuExist-generic.cpp \1128 generic/RTMpIsCpuPossible-generic.cpp \ 1129 1129 generic/RTMpGetCount-generic.cpp \ 1130 1130 generic/RTMpGetMaxCpuId-generic.cpp \ … … 1195 1195 generic/RTMpCpuIdFromSetIndex-generic.cpp \ 1196 1196 generic/RTMpCpuIdToSetIndex-generic.cpp \ 1197 generic/RTMp DoesCpuExist-generic.cpp \1197 generic/RTMpIsCpuPossible-generic.cpp \ 1198 1198 generic/RTMpGetCount-generic.cpp \ 1199 1199 generic/RTMpGetMaxCpuId-generic.cpp \ -
trunk/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp
r8245 r9429 45 45 do 46 46 { 47 if (RTMp DoesCpuExist(idCpu))47 if (RTMpIsCpuPossible(idCpu)) 48 48 RTCpuSetAdd(pSet, idCpu); 49 49 } while (idCpu-- > 0); -
trunk/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp
r9407 r9429 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Multiprocessor, Generic RTMp DoesCpuExist.3 * IPRT - Multiprocessor, Generic RTMpIsCpuPossible. 4 4 */ 5 5 … … 36 36 37 37 38 RTDECL(bool) RTMp DoesCpuExist(RTCPUID idCpu)38 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 39 39 { 40 40 return RTMpCpuId() == idCpu; -
trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
r8245 r9429 66 66 67 67 68 RTDECL(bool) RTMpIsCpu Online(RTCPUID idCpu)69 { 70 #if def CONFIG_SMP68 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 69 { 70 #if defined(CONFIG_SMP) 71 71 if (RT_UNLIKELY(idCpu >= NR_CPUS)) 72 72 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) 92 75 return cpu_possible(idCpu); 93 # else /* 2.4:*/76 # else /* < 2.5.29 */ 94 77 return idCpu < (RTCPUID)smp_num_cpus; 95 78 # endif … … 108 91 do 109 92 { 110 if (RTMp DoesCpuExist(idCpu))93 if (RTMpIsCpuPossible(idCpu)) 111 94 RTCpuSetAdd(pSet, idCpu); 112 95 } while (idCpu-- > 0); … … 135 118 136 119 120 RTDECL(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 137 136 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 138 137 { … … 272 271 Args.cHits = 0; 273 272 274 if (!RTMp DoesCpuExist(idCpu))273 if (!RTMpIsCpuPossible(idCpu)) 275 274 return VERR_CPU_NOT_FOUND; 276 275 -
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r8840 r9429 95 95 return false; 96 96 97 /** @todo this must be done at init time as it's not safe under all circumstances (braindead OS design). */ 97 98 KAFFINITY Mask = KeQueryActiveProcessors(); 98 99 return !!(Mask & RT_BIT_64(idCpu)); … … 100 101 101 102 102 RTDECL(bool) RTMp DoesCpuExist(RTCPUID idCpu)103 RTDECL(bool) RTMpIsCpuPresent(RTCPUID idCpu) 103 104 { 104 105 /* Cannot easily distinguish between online and offline cpus. */ 106 /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */ 105 107 return RTMpIsCpuOnline(idCpu); 106 108 } … … 109 111 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet) 110 112 { 113 /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */ 111 114 return RTMpGetOnlineSet(pSet); 112 115 } … … 115 118 RTDECL(RTCPUID) RTMpGetCount(void) 116 119 { 120 /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */ 117 121 return RTMpGetOnlineCount(); 118 122 } … … 167 171 #if 0 168 172 /* 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... 170 174 */ 171 175 AssertMsg(KeGetCurrentIrql() == PASSIVE_LEVEL, ("%d != %d (PASSIVE_LEVEL)\n", KeGetCurrentIrql(), PASSIVE_LEVEL)); … … 173 177 174 178 KAFFINITY Mask = KeQueryActiveProcessors(); 175 176 if ( enmCpuid == RT_NT_CPUID_SPECIFIC177 && ( idCpu >= 64178 || !(Mask & RT_BIT_64(idCpu))))179 return VERR_CPU_NOT_FOUND; /* can't distinguish between cpu not present or offline */180 179 181 180 /* KeFlushQueuedDpcs is not present in Windows 2000; import it dynamically so we can just fail this call. */ … … 244 243 } 245 244 if (enmCpuid != RT_NT_CPUID_OTHERS) 246 {247 245 pfnWorker(iSelf, pvUser1, pvUser2); 248 }249 246 } 250 247 … … 270 267 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 271 268 { 269 if (RTMpIsCpuOnline(idCpu); 270 return !RTMpIsCpuPossible(idCpu) ? VERR_CPU_NOT_FOUND : VERR_CPU_OFFLINE; 271 272 272 return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_SPECIFIC, idCpu); 273 273 } -
trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
r8245 r9429 66 66 67 67 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) 68 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 77 69 { 78 70 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; … … 89 81 do 90 82 { 91 if (RTMp DoesCpuExist(idCpu))83 if (RTMpIsCpuPossible(idCpu)) 92 84 RTCpuSetAdd(pSet, idCpu); 93 85 } while (idCpu-- > 0); … … 100 92 { 101 93 return ncpus; 94 } 95 96 97 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 98 { 99 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; 100 return pCpu 101 && cpu_is_online(pCpu); 102 102 } 103 103 -
trunk/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c
r9149 r9429 72 72 73 73 74 RTDECL(bool) RTMp DoesCpuExist(RTCPUID idCpu)74 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 75 75 { 76 76 return idCpu < vbi_cpu_count(); … … 86 86 do 87 87 { 88 if (RTMp DoesCpuExist(idCpu))88 if (RTMpIsCpuPossible(idCpu)) 89 89 RTCpuSetAdd(pSet, idCpu); 90 90 } while (idCpu-- > 0); -
trunk/src/VBox/Runtime/r3/os2/mp-os2.cpp
r8245 r9429 62 62 63 63 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) 64 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 72 65 { 73 66 RTCPUSET Set; … … 96 89 97 90 91 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 92 { 93 RTCPUSET Set; 94 return RTCpuSetIsMember(RTMpGetOnlineSet(&Set), idCpu); 95 } 96 97 98 98 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 99 99 { -
trunk/src/VBox/Runtime/r3/win/mp-win.cpp
r8245 r9429 67 67 68 68 69 RTDECL(bool) RTMp DoesCpuExist(RTCPUID idCpu)69 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 70 70 { 71 71 RTCPUSET Set;
Note:
See TracChangeset
for help on using the changeset viewer.

