VirtualBox

Changeset 26062 in vbox


Ignore:
Timestamp:
Jan 27, 2010 10:20:01 AM (15 years ago)
Author:
vboxsync
Message:

Handle pending pgm sync operations in the main execution loop (vt-x/amd-v)

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r26018 r26062  
    10261026
    10271027    /* Check for pending actions that force us to go back to ring 3. */
     1028    if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK | VM_FF_REQUEST)
     1029        ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_REQUEST))
     1030    {
     1031        /* Check if a sync operation is pending. */
     1032        if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
     1033        {
     1034            rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
     1035            AssertRC(rc);
     1036            if (rc != VINF_SUCCESS)
     1037            {
     1038                Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
     1039                goto end;
     1040            }
     1041        }
     1042
    10281043#ifdef DEBUG
    1029     /* Intercept X86_XCPT_DB if stepping is enabled */
    1030     if (!DBGFIsStepping(pVCpu))
    1031 #endif
    1032     {
    1033         if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)
    1034             ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK))
    1035         {
    1036             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
    1037             STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     1044        /* Intercept X86_XCPT_DB if stepping is enabled */
     1045        if (!DBGFIsStepping(pVCpu))
     1046#endif
     1047        {
     1048            if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)
     1049                ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK))
     1050            {
     1051                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
     1052                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     1053                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
     1054                rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
     1055                goto end;
     1056            }
     1057        }
     1058
     1059        /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */
     1060        if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST)
     1061            ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
     1062        {
    10381063            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    1039             rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
     1064            rc = VINF_EM_PENDING_REQUEST;
    10401065            goto end;
    10411066        }
    1042     }
    1043 
    1044     /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */
    1045     if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST)
    1046         ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
    1047     {
    1048         STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    1049         rc = VINF_EM_PENDING_REQUEST;
    1050         goto end;
    10511067    }
    10521068
     
    17131729                TRPMResetTrap(pVCpu);
    17141730                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x);
    1715 
    1716                 /* Check if a sync operation is pending. */
    1717                 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    1718                 {
    1719                     rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    1720                     AssertRC(rc);
    1721                     if (rc != VINF_SUCCESS)
    1722                     {
    1723                         Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
    1724                         break;
    1725                     }
    1726                 }                   
    1727 
    17281731                goto ResumeExecution;
    17291732            }
     
    18971900            TRPMResetTrap(pVCpu);
    18981901
    1899             Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL));
    1900 
    19011902            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x);
    19021903            goto ResumeExecution;
     
    20482049        default:
    20492050            AssertFailed();
    2050         }
    2051         /* Check if a sync operation is pending. */
    2052         if (    rc == VINF_SUCCESS /* don't bother if we are going to ring 3 anyway */
    2053             &&  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    2054         {
    2055             rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    2056             AssertRC(rc);
    2057 
    2058             STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBCRxChange);
    2059 
    2060             /* Must be set by PGMSyncCR3 */
    2061             AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 || PGMGetGuestMode(pVCpu) <= PGMMODE_PROTECTED || pVCpu->hwaccm.s.fForceTLBFlush,
    2062                       ("rc=%Rrc mode=%d fForceTLBFlush=%RTbool\n", rc, PGMGetGuestMode(pVCpu), pVCpu->hwaccm.s.fForceTLBFlush));
    20632051        }
    20642052        if (rc == VINF_SUCCESS)
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r26025 r26062  
    24222422
    24232423    /* Check for pending actions that force us to go back to ring 3. */
     2424    if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK | VM_FF_REQUEST)
     2425        ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_REQUEST))
     2426    {
     2427        /* Check if a sync operation is pending. */
     2428        if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
     2429        {
     2430            rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
     2431            AssertRC(rc);
     2432            if (rc != VINF_SUCCESS)
     2433            {
     2434                Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
     2435                goto end;
     2436            }
     2437        }
     2438
    24242439#ifdef DEBUG
    2425     /* Intercept X86_XCPT_DB if stepping is enabled */
    2426     if (!DBGFIsStepping(pVCpu))
    2427 #endif
    2428     {
    2429         if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)
    2430             ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK))
    2431         {
    2432             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
    2433             STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
    2434             rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
     2440        /* Intercept X86_XCPT_DB if stepping is enabled */
     2441        if (!DBGFIsStepping(pVCpu))
     2442#endif
     2443        {
     2444            if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)
     2445                ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK))
     2446            {
     2447                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
     2448                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     2449                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
     2450                rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
     2451                goto end;
     2452            }
     2453        }
     2454
     2455        /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */
     2456        if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST)
     2457            ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
     2458        {
     2459            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
     2460            rc = VINF_EM_PENDING_REQUEST;
    24352461            goto end;
    24362462        }
    2437     }
    2438 
    2439     /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */
    2440     if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST)
    2441         ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
    2442     {
    2443         rc = VINF_EM_PENDING_REQUEST;
    2444         goto end;
    24452463    }
    24462464
     
    29062924                    TRPMResetTrap(pVCpu);
    29072925                    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3);
    2908 
    2909                     /* Check if a sync operation is pending. */
    2910                     if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    2911                     {
    2912                         rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    2913                         AssertRC(rc);
    2914                         if (rc != VINF_SUCCESS)
    2915                         {
    2916                             Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
    2917                             break;
    2918                         }
    2919                     }
    29202926                    goto ResumeExecution;
    29212927                }
     
    34063412
    34073413            TRPMResetTrap(pVCpu);
    3408 
    3409             Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL));
    34103414            goto ResumeExecution;
    34113415        }
     
    35943598                AssertFailed();
    35953599                break;
    3596             }
    3597             /* Check if a sync operation is pending. */
    3598             if (    rc == VINF_SUCCESS /* don't bother if we are going to ring 3 anyway */
    3599                 &&  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    3600             {
    3601                 rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    3602                 AssertRC(rc);
    36033600            }
    36043601            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