VirtualBox

Changeset 54448 in vbox


Ignore:
Timestamp:
Feb 24, 2015 2:06:20 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
98551
Message:

SUPDrv: Register a power manage notification callback so we can cancel the invariant TSC frequency refinement timer.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrvGip.cpp

    r54447 r54448  
    773773
    774774    /*
     775     * If we got a power event, stop the refinement process.
     776     */
     777    if (pDevExt->fInvTscRefinePowerEvent)
     778    {
     779        int rc = RTTimerStop(pTimer); AssertRC(rc);
     780        return;
     781    }
     782
     783    /*
    775784     * Try get close to the next clock tick as usual.
    776785     *
     
    846855            SUPR0Printf("vboxdrv: start: %u, %u, %#llx  stop: %u, %u, %#llx\n",
    847856                        iStartCpuSet, iStartGipCpu, iStartTscDelta, iStopCpuSet, iStopGipCpu, iStopTscDelta);
    848             int rc = RTTimerStop(pTimer);
    849             AssertRC(rc);
     857            int rc = RTTimerStop(pTimer); AssertRC(rc);
    850858            return;
    851859        }
     
    882890
    883891/**
     892 * @callback_method_impl{FNRTPOWERNOTIFICATION}
     893 */
     894static DECLCALLBACK(void) supdrvGipPowerNotificationCallback(RTPOWEREVENT enmEvent, void *pvUser)
     895{
     896    PSUPDRVDEVEXT pDevExt = (PSUPDRVDEVEXT)pvUser;
     897
     898    /*
     899     * If the TSC frequency refinement timer we need to cancel it so it doesn't screw
     900     * up the frequency after a long suspend.
     901     */
     902    if (   enmEvent == RTPOWEREVENT_SUSPEND
     903        || enmEvent == RTPOWEREVENT_RESUME)
     904        ASMAtomicWriteBool(&pDevExt->fInvTscRefinePowerEvent, true);
     905}
     906
     907
     908/**
    884909 * Start the TSC-frequency refinment timer for the invariant TSC GIP mode.
    885910 *
     
    896921    RTCCUINTREG uFlags;
    897922    int         rc;
     923
     924    /*
     925     * Register a power management callback.
     926     */
     927    pDevExt->fInvTscRefinePowerEvent = true;
     928    rc = RTPowerNotificationRegister(supdrvGipPowerNotificationCallback, pDevExt);
     929    AssertRC(rc); /* ignore */
    898930
    899931    /*
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r54375 r54448  
    708708    /** Pointer to the timer used to refine the TSC frequency. */
    709709    PRTTIMER                        pInvarTscRefineTimer;
     710    /** Stop the timer on the next tick because we saw a power event. */
     711    bool volatile                   fInvTscRefinePowerEvent;
    710712    /** @} */
    711713
    712714    /** @name TSC-delta measurement.
    713715     *  @{ */
     716    /** Number of online/offline events, incremented each time a CPU goes online
     717     *  or offline. */
     718    uint32_t volatile               cMpOnOffEvents;
    714719    /** TSC-delta measurement mutext.
    715720     * At the moment, we don't want to have more than one measurement going on at
     
    721726    RTSEMFASTMUTEX                  mtxTscDelta;
    722727#endif
    723     /** Number of online/offline events, incremented each time a CPU goes online
    724      *  or offline. */
    725     uint32_t volatile               cMpOnOffEvents;
    726728    /** The set of CPUs we need to take measurements for. */
    727729    RTCPUSET                        TscDeltaCpuSet;
Note: See TracChangeset for help on using the changeset viewer.

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