vbox的更動 61960 路徑 trunk/src/VBox/Runtime
- 時間撮記:
- 2016-6-30 下午03:19:54 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r3/solaris/mp-solaris.cpp
r57358 r61960 92 92 for (RTCPUID idCpu = 0; idCpu < g_capCpuInfo; idCpu++) 93 93 { 94 if (kstat_read(g_pKsCtl, g_papCpuInfo[idCpu], 0) != -1) 94 /* 95 * It is possible that the number of cores don't match the maximum number 96 * of cores possible on the system. Hence check if we have a valid cpu_info 97 * object. We don't want to break out if it's NULL, the array may be sparse 98 * in theory, see @bugref{8469}. 99 */ 100 if (g_papCpuInfo[idCpu]) 95 101 { 96 /* Strands/Hyperthreads share the same core ID. */ 97 uint64_t u64CoreId = rtMpSolarisGetCoreId(idCpu); 98 bool fAddedCore = false; 99 for (RTCPUID i = 0; i < g_cCores; i++) 102 if (kstat_read(g_pKsCtl, g_papCpuInfo[idCpu], 0) != -1) 100 103 { 101 if (g_pu64CoreIds[i] == u64CoreId) 104 /* Strands/Hyperthreads share the same core ID. */ 105 uint64_t u64CoreId = rtMpSolarisGetCoreId(idCpu); 106 bool fAddedCore = false; 107 for (RTCPUID i = 0; i < g_cCores; i++) 102 108 { 103 fAddedCore = true; 104 break; 109 if (g_pu64CoreIds[i] == u64CoreId) 110 { 111 fAddedCore = true; 112 break; 113 } 114 } 115 116 if (!fAddedCore) 117 { 118 g_pu64CoreIds[g_cCores] = u64CoreId; 119 ++g_cCores; 105 120 } 106 121 } 107 108 if (!fAddedCore) 109 { 110 g_pu64CoreIds[g_cCores] = u64CoreId; 111 ++g_cCores; 112 } 122 else 123 return VERR_INTERNAL_ERROR_2; 113 124 } 114 else115 return VERR_INTERNAL_ERROR_2;116 125 } 117 126 … … 138 147 { 139 148 g_capCpuInfo = RTMpGetCount(); 140 g_papCpuInfo = (kstat_t **)RTMemAllocZ(g_capCpuInfo * sizeof(kstat_t *)); 141 if (g_papCpuInfo) 149 if (RT_LIKELY(g_capCpuInfo > 0)) 142 150 { 143 g_cu64CoreIds = g_capCpuInfo; 144 g_pu64CoreIds = (uint64_t *)RTMemAllocZ(g_cu64CoreIds * sizeof(uint64_t)); 145 if (g_pu64CoreIds) 151 g_papCpuInfo = (kstat_t **)RTMemAllocZ(g_capCpuInfo * sizeof(kstat_t *)); 152 if (g_papCpuInfo) 146 153 { 147 rc = RTCritSectInit(&g_MpSolarisCritSect); 148 if (RT_SUCCESS(rc)) 154 g_cu64CoreIds = g_capCpuInfo; 155 g_pu64CoreIds = (uint64_t *)RTMemAllocZ(g_cu64CoreIds * sizeof(uint64_t)); 156 if (g_pu64CoreIds) 149 157 { 150 RTCPUID i = 0;151 for (kstat_t *pKsp = g_pKsCtl->kc_chain; pKsp != NULL; pKsp = pKsp->ks_next)158 rc = RTCritSectInit(&g_MpSolarisCritSect); 159 if (RT_SUCCESS(rc)) 152 160 { 153 if (!RTStrCmp(pKsp->ks_module, "cpu_info")) 161 RTCPUID i = 0; 162 for (kstat_t *pKsp = g_pKsCtl->kc_chain; pKsp != NULL; pKsp = pKsp->ks_next) 154 163 { 155 AssertBreak(i < g_capCpuInfo); 156 g_papCpuInfo[i++] = pKsp; 157 /** @todo ks_instance == cpu_id (/usr/src/uts/common/os/cpu.c)? Check this and fix it ASAP. */ 164 if (!RTStrCmp(pKsp->ks_module, "cpu_info")) 165 { 166 AssertBreak(i < g_capCpuInfo); 167 g_papCpuInfo[i++] = pKsp; 168 /** @todo ks_instance == cpu_id (/usr/src/uts/common/os/cpu.c)? Check this and fix it ASAP. */ 169 } 158 170 } 171 172 rc = rtMpSolarisGetCoreIds(); 173 if (RT_SUCCESS(rc)) 174 return VINF_SUCCESS; 175 else 176 Log(("rtMpSolarisGetCoreIds failed. rc=%Rrc\n", rc)); 159 177 } 160 178 161 rc = rtMpSolarisGetCoreIds(); 162 if (RT_SUCCESS(rc)) 163 return VINF_SUCCESS; 164 else 165 Log(("rtMpSolarisGetCoreIds failed. rc=%Rrc\n", rc)); 179 RTMemFree(g_pu64CoreIds); 180 g_pu64CoreIds = NULL; 166 181 } 167 168 RTMemFree(g_pu64CoreIds); 169 g_pu64CoreIds = NULL; 182 else 183 rc = VERR_NO_MEMORY; 184 185 /* bail out, we failed. */ 186 RTMemFree(g_papCpuInfo); 187 g_papCpuInfo = NULL; 170 188 } 171 189 else 172 190 rc = VERR_NO_MEMORY; 173 174 /* bail out, we failed. */175 RTMemFree(g_papCpuInfo);176 g_papCpuInfo = NULL;177 191 } 178 192 else 179 rc = VERR_ NO_MEMORY;193 rc = VERR_CPU_IPE_1; 180 194 kstat_close(g_pKsCtl); 181 195 g_pKsCtl = NULL;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器