Changeset 7352 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Mar 7, 2008 12:12:31 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
r7347 r7352 176 176 PRTMPARGS pArgs = (PRTMPARGS)pvInfo; 177 177 ASMAtomicIncU32(&pArgs->cHits); 178 pArgs->pfnWorker( smp_processor_id(), pArgs->pvUser1, pArgs->pvUser2);178 pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2); 179 179 } 180 180 … … 184 184 int rc; 185 185 RTMPARGS Args; 186 186 187 Args.pfnWorker = pfnWorker; 187 188 Args.pvUser1 = pvUser1; … … 215 216 int rc; 216 217 RTMPARGS Args; 218 217 219 Args.pfnWorker = pfnWorker; 218 220 Args.pvUser1 = pvUser1; … … 234 236 235 237 238 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) 239 /** 240 * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER 241 * employed by RTMpOnSpecific on older kernels that lacks smp_call_function_single. 242 * 243 * @param pvInfo Pointer to the RTMPARGS package. 244 */ 245 static void rtmpOnSpecificLinuxWrapper(void *pvInfo) 246 { 247 PRTMPARGS pArgs = (PRTMPARGS)pvInfo; 248 RTCPUID idCpu = RTMpCpuId(); 249 250 if (idCpu == pArgs->idCpu) 251 { 252 pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2); 253 ASMAtomicIncU32(&pArgs->cHits); 254 } 255 } 256 #endif 257 258 236 259 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 237 260 { 238 261 int rc; 239 262 RTMPARGS Args; 263 240 264 Args.pfnWorker = pfnWorker; 241 265 Args.pvUser1 = pvUser1; … … 244 268 Args.cHits = 0; 245 269 246 /** @todo validate idCpu . */ 270 if (!RTMpDoesCpuExist(idCpu)) 271 return VERR_CPU_NOT_FOUND; 247 272 248 273 # ifdef preempt_disable … … 250 275 # endif 251 276 if (idCpu != RTMpCpuId()) 252 rc = smp_call_function_single(idCpu, rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); 277 { 278 if (RTMpIsCpuOnline(idCpu)) 279 { 280 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) 281 rc = smp_call_function_single(idCpu, rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); 282 #else 283 rc = smp_call_function(rtmpOnSpecificLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); 284 #endif 285 Assert(rc == 0); 286 rc = Args.cHits ? VINF_SUCCESS : VERR_CPU_OFFLINE; 287 } 288 else 289 rc = VERR_CPU_OFFLINE; 290 } 253 291 else 254 292 { 255 293 rtmpLinuxWrapper(&Args); 256 rc = 0;294 rc = VINF_SUCCESS; 257 295 } 258 296 # ifdef preempt_enable … … 260 298 # endif 261 299 262 Assert(rc == 0);NOREF(rc);263 return VINF_SUCCESS;264 } 265 300 NOREF(rc); 301 return rc; 302 } 303
Note:
See TracChangeset
for help on using the changeset viewer.