VirtualBox

Changeset 67989 in vbox


Ignore:
Timestamp:
Jul 17, 2017 12:13:28 PM (7 years ago)
Author:
vboxsync
Message:

GVMMR0Sched*: pass pGVM along when we've got it.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/gvmm.h

    r67987 r67989  
    171171GVMMR0DECL(PVM)     GVMMR0GetVMByHandle(uint32_t hGVM);
    172172GVMMR0DECL(PVM)     GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT);
    173 GVMMR0DECL(int)     GVMMR0SchedHalt(PVM pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime);
    174 GVMMR0DECL(int)     GVMMR0SchedWakeUp(PVM pVM, VMCPUID idCpu);
    175 GVMMR0DECL(int)     GVMMR0SchedWakeUpEx(PVM pVM, VMCPUID idCpu, bool fTakeUsedLock);
    176 GVMMR0DECL(int)     GVMMR0SchedPoke(PVM pVM, VMCPUID idCpu);
    177 GVMMR0DECL(int)     GVMMR0SchedPokeEx(PVM pVM, VMCPUID idCpu, bool fTakeUsedLock);
     173GVMMR0DECL(int)     GVMMR0SchedHalt(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime);
     174GVMMR0DECL(int)     GVMMR0SchedWakeUp(PGVM pGVM, PVM pVM, VMCPUID idCpu);
     175GVMMR0DECL(int)     GVMMR0SchedWakeUpEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fTakeUsedLock);
     176GVMMR0DECL(int)     GVMMR0SchedWakeUpNoGVMNoLock(PVM pVM, VMCPUID idCpu);
     177GVMMR0DECL(int)     GVMMR0SchedPoke(PGVM pGVM, PVM pVM, VMCPUID idCpu);
     178GVMMR0DECL(int)     GVMMR0SchedPokeEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fTakeUsedLock);
     179GVMMR0DECL(int)     GVMMR0SchedPokeNoGVMNoLock(PVM pVM, VMCPUID idCpu);
    178180GVMMR0DECL(int)     GVMMR0SchedWakeUpAndPokeCpus(PVM pVM, PCVMCPUSET pSleepSet, PCVMCPUSET pPokeSet);
    179181GVMMR0DECL(int)     GVMMR0SchedPoll(PVM pVM, VMCPUID idCpu, bool fYield);
  • trunk/src/VBox/VMM/VMMAll/APICAll.cpp

    r67051 r67989  
    28272827        {
    28282828            case VMCPUSTATE_STARTED_EXEC:
    2829                 GVMMR0SchedPokeEx(pVM, idCpu, false /* fTakeUsedLock */);
     2829                GVMMR0SchedPokeNoGVMNoLock(pVM, idCpu);
    28302830                break;
    28312831
    28322832            case VMCPUSTATE_STARTED_HALTED:
    2833                 GVMMR0SchedWakeUpEx(pVM, idCpu, false /* fTakeUsedLock */);
     2833                GVMMR0SchedWakeUpNoGVMNoLock(pVM, idCpu);
    28342834                break;
    28352835
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r67131 r67989  
    304304       thread-context hooks being used), so don't try obtaining the GVMMR0 used
    305305       lock here. See @bugref{7270#c148}. */
    306     int rc = GVMMR0SchedWakeUpEx(pVM, pVCpuDst->idCpu, false /* fTakeUsedLock */);
     306    int rc = GVMMR0SchedWakeUpNoGVMNoLock(pVM, pVCpuDst->idCpu);
    307307    AssertRC(rc);
    308308
  • trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp

    r67988 r67989  
    21232123 * @returns VINF_SUCCESS normal wakeup (timeout or kicked by other thread).
    21242124 *          VERR_INTERRUPTED if a signal was scheduled for the thread.
     2125 * @param   pGVM                The global (ring-0) VM structure.
    21252126 * @param   pVM                 The cross context VM structure.
    21262127 * @param   idCpu               The Virtual CPU ID of the calling EMT.
     
    21282129 * @thread  EMT(idCpu).
    21292130 */
    2130 GVMMR0DECL(int) GVMMR0SchedHalt(PVM pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime)
    2131 {
    2132     LogFlow(("GVMMR0SchedHalt: pVM=%p\n", pVM));
     2131GVMMR0DECL(int) GVMMR0SchedHalt(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime)
     2132{
     2133    LogFlow(("GVMMR0SchedHalt: pGVM=%p pVM=%p idCpu=%#x u64ExpireGipTime=%#RX64\n", pGVM, pVM, idCpu, u64ExpireGipTime));
    21332134    GVMM_CHECK_SMAP_SETUP();
    21342135    GVMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
     
    21372138     * Validate the VM structure, state and handle.
    21382139     */
    2139     PGVM pGVM;
    21402140    PGVMM pGVMM;
    2141     int rc = gvmmR0ByVMAndEMT(pVM, idCpu, &pGVM, &pGVMM);
     2141    int rc = gvmmR0ByGVMandVMandEMT(pGVM, pVM, idCpu, &pGVMM);
    21422142    if (RT_FAILURE(rc))
    21432143        return rc;
     
    22822282 * @retval  VINF_GVM_NOT_BLOCKED if the EMT wasn't blocked.
    22832283 *
     2284 * @param   pGVM                The global (ring-0) VM structure.
    22842285 * @param   pVM                 The cross context VM structure.
    22852286 * @param   idCpu               The Virtual CPU ID of the EMT to wake up.
    22862287 * @param   fTakeUsedLock       Take the used lock or not
    2287  * @thread  Any but EMT.
    2288  */
    2289 GVMMR0DECL(int) GVMMR0SchedWakeUpEx(PVM pVM, VMCPUID idCpu, bool fTakeUsedLock)
     2288 * @thread  Any but EMT(idCpu).
     2289 */
     2290GVMMR0DECL(int) GVMMR0SchedWakeUpEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fTakeUsedLock)
    22902291{
    22912292    GVMM_CHECK_SMAP_SETUP();
     
    22952296     * Validate input and take the UsedLock.
    22962297     */
    2297     PGVM pGVM;
    22982298    PGVMM pGVMM;
    2299     int rc = gvmmR0ByVM(pVM, &pGVM, &pGVMM, fTakeUsedLock);
     2299    int rc = gvmmR0ByGVMandVM(pGVM, pVM, &pGVMM, fTakeUsedLock);
    23002300    GVMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    23012301    if (RT_SUCCESS(rc))
     
    23312331    }
    23322332
    2333     LogFlow(("GVMMR0SchedWakeUp: returns %Rrc\n", rc));
     2333    LogFlow(("GVMMR0SchedWakeUpEx: returns %Rrc\n", rc));
    23342334    return rc;
    23352335}
     
    23432343 * @retval  VINF_GVM_NOT_BLOCKED if the EMT wasn't blocked.
    23442344 *
     2345 * @param   pGVM                The global (ring-0) VM structure.
    23452346 * @param   pVM                 The cross context VM structure.
    23462347 * @param   idCpu               The Virtual CPU ID of the EMT to wake up.
    2347  * @thread  Any but EMT.
    2348  */
    2349 GVMMR0DECL(int) GVMMR0SchedWakeUp(PVM pVM, VMCPUID idCpu)
    2350 {
    2351     return GVMMR0SchedWakeUpEx(pVM, idCpu, true /* fTakeUsedLock */);
    2352 }
     2348 * @thread  Any but EMT(idCpu).
     2349 */
     2350GVMMR0DECL(int) GVMMR0SchedWakeUp(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2351{
     2352    return GVMMR0SchedWakeUpEx(pGVM, pVM, idCpu, true /* fTakeUsedLock */);
     2353}
     2354
     2355
     2356/**
     2357 * Wakes up the halted EMT thread so it can service a pending request, no GVM
     2358 * parameter and no used locking.
     2359 *
     2360 * @returns VBox status code.
     2361 * @retval  VINF_SUCCESS if successfully woken up.
     2362 * @retval  VINF_GVM_NOT_BLOCKED if the EMT wasn't blocked.
     2363 *
     2364 * @param   pVM                 The cross context VM structure.
     2365 * @param   idCpu               The Virtual CPU ID of the EMT to wake up.
     2366 * @param   fTakeUsedLock       Take the used lock or not
     2367 * @thread  Any but EMT(idCpu).
     2368 * @deprecated  Don't use in new code if possible!  Use the GVM variant.
     2369 */
     2370GVMMR0DECL(int) GVMMR0SchedWakeUpNoGVMNoLock(PVM pVM, VMCPUID idCpu)
     2371{
     2372    GVMM_CHECK_SMAP_SETUP();
     2373    GVMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
     2374    PGVM pGVM;
     2375    PGVMM pGVMM;
     2376    int rc = gvmmR0ByVM(pVM, &pGVM, &pGVMM, false /*fTakeUsedLock*/);
     2377    GVMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
     2378    if (RT_SUCCESS(rc))
     2379        rc = GVMMR0SchedWakeUpEx(pGVM, pVM, idCpu, false /*fTakeUsedLock*/);
     2380    return rc;
     2381}
     2382
    23532383
    23542384/**
     
    23802410}
    23812411
     2412
    23822413/**
    23832414 * Pokes an EMT if it's still busy running guest code.
     
    23872418 * @retval  VINF_GVM_NOT_BUSY_IN_GC if the EMT wasn't busy in GC.
    23882419 *
     2420 * @param   pGVM                The global (ring-0) VM structure.
    23892421 * @param   pVM                 The cross context VM structure.
    23902422 * @param   idCpu               The ID of the virtual CPU to poke.
    23912423 * @param   fTakeUsedLock       Take the used lock or not
    23922424 */
    2393 GVMMR0DECL(int) GVMMR0SchedPokeEx(PVM pVM, VMCPUID idCpu, bool fTakeUsedLock)
     2425GVMMR0DECL(int) GVMMR0SchedPokeEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fTakeUsedLock)
    23942426{
    23952427    /*
    23962428     * Validate input and take the UsedLock.
    23972429     */
    2398     PGVM pGVM;
    23992430    PGVMM pGVMM;
    2400     int rc = gvmmR0ByVM(pVM, &pGVM, &pGVMM, fTakeUsedLock);
     2431    int rc = gvmmR0ByGVMandVM(pGVM, pVM, &pGVMM, fTakeUsedLock);
    24012432    if (RT_SUCCESS(rc))
    24022433    {
     
    24252456 * @retval  VINF_GVM_NOT_BUSY_IN_GC if the EMT wasn't busy in GC.
    24262457 *
     2458 * @param   pGVM                The global (ring-0) VM structure.
    24272459 * @param   pVM                 The cross context VM structure.
    24282460 * @param   idCpu               The ID of the virtual CPU to poke.
    24292461 */
    2430 GVMMR0DECL(int) GVMMR0SchedPoke(PVM pVM, VMCPUID idCpu)
    2431 {
    2432     return GVMMR0SchedPokeEx(pVM, idCpu, true /* fTakeUsedLock */);
     2462GVMMR0DECL(int) GVMMR0SchedPoke(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2463{
     2464    return GVMMR0SchedPokeEx(pGVM, pVM, idCpu, true /* fTakeUsedLock */);
     2465}
     2466
     2467
     2468/**
     2469 * Pokes an EMT if it's still busy running guest code, no GVM parameter and no
     2470 * used locking.
     2471 *
     2472 * @returns VBox status code.
     2473 * @retval  VINF_SUCCESS if poked successfully.
     2474 * @retval  VINF_GVM_NOT_BUSY_IN_GC if the EMT wasn't busy in GC.
     2475 *
     2476 * @param   pVM                 The cross context VM structure.
     2477 * @param   idCpu               The ID of the virtual CPU to poke.
     2478 *
     2479 * @deprecated  Don't use in new code if possible!  Use the GVM variant.
     2480 */
     2481GVMMR0DECL(int) GVMMR0SchedPokeNoGVMNoLock(PVM pVM, VMCPUID idCpu)
     2482{
     2483    PGVM pGVM;
     2484    PGVMM pGVMM;
     2485    int rc = gvmmR0ByVM(pVM, &pGVM, &pGVMM, false /*fTakeUsedLock*/);
     2486    if (RT_SUCCESS(rc))
     2487    {
     2488        if (idCpu < pGVM->cCpus)
     2489            rc = gvmmR0SchedPokeOne(pGVM, &pVM->aCpus[idCpu]);
     2490        else
     2491            rc = VERR_INVALID_CPU_ID;
     2492    }
     2493    return rc;
    24332494}
    24342495
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r67987 r67989  
    14561456                return VERR_INVALID_PARAMETER;
    14571457            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    1458             rc = GVMMR0SchedHalt(pVM, idCpu, u64Arg);
     1458            rc = GVMMR0SchedHalt(pGVM, pVM, idCpu, u64Arg);
    14591459            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    14601460            break;
     
    14641464                return VERR_INVALID_PARAMETER;
    14651465            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    1466             rc = GVMMR0SchedWakeUp(pVM, idCpu);
     1466            rc = GVMMR0SchedWakeUp(pGVM, pVM, idCpu);
    14671467            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    14681468            break;
     
    14711471            if (pReqHdr || u64Arg)
    14721472                return VERR_INVALID_PARAMETER;
    1473             rc = GVMMR0SchedPoke(pVM, idCpu);
     1473            rc = GVMMR0SchedPoke(pGVM, pVM, idCpu);
    14741474            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    14751475            break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette