VirtualBox

Changeset 90468 in vbox for trunk


Ignore:
Timestamp:
Aug 2, 2021 10:58:26 AM (4 years ago)
Author:
vboxsync
Message:

VMM/PDM: Fixed the VERR_INTERRUPTED w/ rcBusy=VINF_SUCCESS case. More stats. bugref:6695

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r90449 r90468  
    172172    uint64_t const          cNsMaxRetry = RT_NS_15SEC;
    173173    uint32_t                cMsMaxOne   = RT_MS_5SEC;
     174    bool                    fNonInterruptible = false;
    174175# endif
    175176    for (;;)
     
    202203        RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_CRITSECT);
    203204# else  /* IN_RING0 */
    204         int const rc = SUPSemEventWaitNoResume(pSession, hEvent, cMsMaxOne);
     205        int const rc = !fNonInterruptible
     206                     ? SUPSemEventWaitNoResume(pSession, hEvent, cMsMaxOne)
     207                     : SUPSemEventWait(pSession, hEvent, cMsMaxOne);
    205208# endif /* IN_RING0 */
    206209
     
    248251                /* Try return get out of here with a non-VINF_SUCCESS status if
    249252                   the thread is terminating or if the timeout has been exceeded. */
     253                STAM_REL_COUNTER_INC(&pVM->pdm.s.StatCritSectVerrTimeout);
    250254                if (   rcTerm != VINF_THREAD_IS_TERMINATING
    251255                    && cNsElapsed <= cNsMaxTotal)
     
    254258            else
    255259            {
    256                 /* For interrupt cases, we must return if we can.  Only if we */
     260                /* For interrupt cases, we must return if we can.  If rcBusy is VINF_SUCCESS,
     261                   we will try non-interruptible sleep for a while to help resolve the issue
     262                   w/o guru'ing. */
     263                STAM_REL_COUNTER_INC(&pVM->pdm.s.StatCritSectVerrInterrupted);
    257264                if (   rcTerm != VINF_THREAD_IS_TERMINATING
    258265                    && rcBusy == VINF_SUCCESS
    259266                    && pVCpu != NULL
    260267                    && cNsElapsed <= cNsMaxTotal)
     268                {
     269                    if (!fNonInterruptible)
     270                    {
     271                        STAM_REL_COUNTER_INC(&pVM->pdm.s.StatCritSectNonInterruptibleWaits);
     272                        fNonInterruptible   = true;
     273                        cMsMaxOne           = 32;
     274                        uint64_t cNsLeft = cNsMaxTotal - cNsElapsed;
     275                        if (cNsLeft > RT_NS_10SEC)
     276                            cNsMaxTotal = cNsElapsed + RT_NS_10SEC;
     277                    }
    261278                    continue;
     279                }
    262280            }
    263281
  • trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp

    r90437 r90468  
    5555{
    5656    RT_NOREF_PV(pVM);
    57     STAM_REL_REG(pVM, &pVM->pdm.s.StatQueuedCritSectLeaves, STAMTYPE_COUNTER, "/PDM/QueuedCritSectLeaves", STAMUNIT_OCCURENCES,
     57    STAM_REL_REG(pVM, &pVM->pdm.s.StatQueuedCritSectLeaves, STAMTYPE_COUNTER, "/PDM/CritSects/00-QueuedLeaves", STAMUNIT_OCCURENCES,
    5858                 "Number of times a critical section leave request needed to be queued for ring-3 execution.");
    59     STAM_REL_REG(pVM, &pVM->pdm.s.StatAbortedCritSectEnters, STAMTYPE_COUNTER, "/PDM/AbortedCritSectEnters", STAMUNIT_OCCURENCES,
     59    STAM_REL_REG(pVM, &pVM->pdm.s.StatAbortedCritSectEnters, STAMTYPE_COUNTER, "/PDM/CritSects/00-AbortedEnters", STAMUNIT_OCCURENCES,
    6060                 "Number of times we've successfully aborted a wait in ring-0.");
    61     STAM_REL_REG(pVM, &pVM->pdm.s.StatCritSectEntersWhileAborting, STAMTYPE_COUNTER, "/PDM/CritSectEntersWhileAborting", STAMUNIT_OCCURENCES,
     61    STAM_REL_REG(pVM, &pVM->pdm.s.StatCritSectEntersWhileAborting, STAMTYPE_COUNTER, "/PDM/CritSects/00-EntersWhileAborting", STAMUNIT_OCCURENCES,
    6262                 "Number of times we've got the critical section ownership while trying to abort a wait due to VERR_INTERRUPTED.");
     63    STAM_REL_REG(pVM, &pVM->pdm.s.StatCritSectVerrInterrupted, STAMTYPE_COUNTER, "/PDM/CritSects/00-VERR_INTERRUPTED", STAMUNIT_OCCURENCES,
     64                 "Number of VERR_INTERRUPTED returns.");
     65    STAM_REL_REG(pVM, &pVM->pdm.s.StatCritSectVerrTimeout, STAMTYPE_COUNTER, "/PDM/CritSects/00-VERR_TIMEOUT", STAMUNIT_OCCURENCES,
     66                 "Number of VERR_TIMEOUT returns.");
     67    STAM_REL_REG(pVM, &pVM->pdm.s.StatCritSectNonInterruptibleWaits, STAMTYPE_COUNTER, "/PDM/CritSects/00-Non-interruptible-Waits-VINF_SUCCESS",
     68                 STAMUNIT_OCCURENCES, "Number of non-interruptible waits for rcBusy=VINF_SUCCESS");
    6369    return VINF_SUCCESS;
    6470}
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r90436 r90468  
    14771477     * abort a wait due to VERR_INTERRUPTED. */
    14781478    STAMCOUNTER                     StatCritSectEntersWhileAborting;
     1479    STAMCOUNTER                     StatCritSectVerrTimeout;
     1480    STAMCOUNTER                     StatCritSectVerrInterrupted;
     1481    STAMCOUNTER                     StatCritSectNonInterruptibleWaits;
    14791482} PDM;
    14801483AssertCompileMemberAlignment(PDM, CritSect, 8);
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