Changeset 54457 in vbox
- Timestamp:
- Feb 24, 2015 4:14:50 PM (10 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r54446 r54457 2169 2169 generic/RTLogWriteStdOut-stub-generic.cpp \ 2170 2170 generic/RTMpGetCoreCount-generic.cpp \ 2171 generic/RTMpOnPair-generic.cpp \2172 2171 generic/RTTimerCreate-generic.cpp \ 2173 2172 generic/mppresent-generic.cpp \ -
trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
r54415 r54457 149 149 * Wrapper to Solaris IPI infrastructure. 150 150 * 151 * @returns Solaris error code. 151 152 * @param pCpuSet Pointer to Solaris CPU set. 152 153 * @param pfnSolWorker Function to execute on target CPU(s). 153 154 * @param pArgs Pointer to RTMPARGS to pass to @a pfnSolWorker. 154 *155 * @returns Solaris error code.156 155 */ 157 156 static void rtMpSolCrossCall(PRTSOLCPUSET pCpuSet, PFNRTMPSOLWORKER pfnSolWorker, PRTMPARGS pArgs) … … 296 295 297 296 297 298 /** 299 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 300 * for the RTMpOnPair API. 301 * 302 * @returns Solaris error code. 303 * @param uArgs Pointer to the RTMPARGS package. 304 * @param uIgnored1 Ignored. 305 * @param uIgnored2 Ignored. 306 */ 307 static int rtMpSolOnPairCpuWrapper(void *uArg, void *uIgnored1, void *uIgnored2) 308 { 309 PRTMPARGS pArgs = (PRTMPARGS)(uArg); 310 RTCPUID idCpu = RTMpCpuId(); 311 312 Assert(idCpu == pArgs->idCpu || idCpu == pArgs->idCpu2); 313 pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2); 314 ASMAtomicIncU32(&pArgs->cHits); 315 316 NOREF(uIgnored1); 317 NOREF(uIgnored2); 318 return 0; 319 } 320 321 322 RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 323 { 324 int rc; 325 RTMPARGS Args; 326 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; 327 328 AssertReturn(idCpu1 != idCpu2, VERR_INVALID_PARAMETER); 329 AssertReturn(!(fFlags & RTMPON_F_VALID_MASK), VERR_INVALID_FLAGS); 330 331 Args.pfnWorker = pfnWorker; 332 Args.pvUser1 = pvUser1; 333 Args.pvUser2 = pvUser2; 334 Args.idCpu = idCpu1; 335 Args.idCpu2 = idCpu2; 336 Args.cHits = 0; 337 338 RTSOLCPUSET CpuSet; 339 for (int i = 0; i < IPRT_SOL_SET_WORDS; i++) 340 CpuSet.auCpus[i] = 0; 341 BT_SET(CpuSet.auCpus, idCpu1); 342 BT_SET(CpuSet.auCpus, idCpu2); 343 344 /* 345 * Check that both CPUs are online before doing the broadcast call. 346 */ 347 RTThreadPreemptDisable(&PreemptState); 348 if ( RTMpIsCpuOnline(idCpu1) 349 && RTMpIsCpuOnline(idCpu2)) 350 { 351 rtMpSolCrossCall(&CpuSet, rtMpSolOnPairCpuWrapper, &Args); 352 353 Assert(Args.cHits <= 2); 354 if (Args.cHits == 2) 355 rc = VINF_SUCCESS; 356 else if (Args.cHits == 1) 357 rc = VERR_NOT_ALL_CPUS_SHOWED; 358 else if (Args.cHits == 0) 359 rc = VERR_CPU_OFFLINE; 360 else 361 rc = VERR_CPU_IPE_1; 362 } 363 /* 364 * A CPU must be present to be considered just offline. 365 */ 366 else if ( RTMpIsCpuPresent(idCpu1) 367 && RTMpIsCpuPresent(idCpu2)) 368 rc = VERR_CPU_OFFLINE; 369 else 370 rc = VERR_CPU_NOT_FOUND; 371 372 RTThreadPreemptRestore(&PreemptState);; 373 return rc; 374 } 375 376 377 RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void) 378 { 379 return true; 380 } 381 382 298 383 /** 299 384 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 300 385 * for the RTMpOnSpecific API. 301 386 * 387 * @returns Solaris error code. 302 388 * @param uArgs Pointer to the RTMPARGS package. 303 389 * @param uIgnored1 Ignored. 304 390 * @param uIgnored2 Ignored. 305 *306 * @returns Solaris error code.307 391 */ 308 392 static int rtMpSolOnSpecificCpuWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
Note:
See TracChangeset
for help on using the changeset viewer.