VirtualBox

Changeset 52618 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Sep 5, 2014 12:07:29 PM (10 years ago)
Author:
vboxsync
Message:

HostDrivers, Runtime, Devices, Additions: TSC delta measurement and other changes resulting from bumping supdrv major version. TSC delta measurement currently disabled.

Location:
trunk/src/VBox/HostDrivers
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r52575 r52618  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    9393 * u32UpdateIntervalNS GIP members. The value must be a power of 2. */
    9494#define GIP_UPDATEHZ_RECALC_FREQ            0x800
     95
     96/** A reserved TSC value used for synchronization as well as measurement of
     97 *  TSC deltas. */
     98#define GIP_TSC_DELTA_RSVD                  UINT64_MAX
     99/** The number of TSC delta measurement loops in total (includes primer and
     100 *  read-time loops). */
     101#define GIP_TSC_DELTA_LOOPS                 96
     102/** The number of cache primer loops. */
     103#define GIP_TSC_DELTA_PRIMER_LOOPS          4
     104/** The number of loops until we keep computing the minumum read time. */
     105#define GIP_TSC_DELTA_READ_TIME_LOOPS       24
     106/** Stop measurement of TSC delta. */
     107#define GIP_TSC_DELTA_SYNC_STOP             0
     108/** Start measurement of TSC delta. */
     109#define GIP_TSC_DELTA_SYNC_START            1
     110/** Worker thread is ready for reading the TSC. */
     111#define GIP_TSC_DELTA_SYNC_WORKER_READY     2
     112/** Worker thread is done updating TSC delta info. */
     113#define GIP_TSC_DELTA_SYNC_WORKER_DONE      3
     114/** When IPRT is isn't concurrent safe: Master is ready and will wait for slave
     115 *  with a timeout. */
     116#define GIP_TSC_DELTA_SYNC_PRESTART_MASTER  4
     117/** When IPRT is isn't concurrent safe: Worker is ready after waiting for
     118 *  master with a timeout. */
     119#define GIP_TSC_DELTA_SYNC_PRESTART_WORKER  5
     120
     121AssertCompile(GIP_TSC_DELTA_PRIMER_LOOPS < GIP_TSC_DELTA_READ_TIME_LOOPS);
     122AssertCompile(GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS < GIP_TSC_DELTA_LOOPS);
    95123
    96124/** @def VBOX_SVN_REV
     
    139167                                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick);
    140168static void                 supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS);
     169static int                  supdrvMeasureTscDeltas(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, uint32_t *pidxMaster);
    141170static int                  supdrvIOCtl_ResumeSuspendedKbds(void);
    142171
     
    146175*******************************************************************************/
    147176DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage = NULL;
     177
     178/**
     179 * The TSC delta synchronization struct. rounded to cache line size.
     180 */
     181typedef union SUPTSCDELTASYNC
     182{
     183    /** The synchronization variable, holds values GIP_TSC_DELTA_SYNC_*. */
     184    volatile uint32_t   u;
     185    /** Padding to cache line size. */
     186    uint8_t             u8Padding[64];
     187} SUPTSCDELTASYNC;
     188AssertCompileSize(SUPTSCDELTASYNC, 64);
     189typedef SUPTSCDELTASYNC *PSUPTSCDELTASYNC;
     190
     191/** Pointer to the TSC delta sync. struct. */
     192static void                *g_pvTscDeltaSync;
     193/** Aligned pointer to the TSC delta sync. struct. */
     194static PSUPTSCDELTASYNC     g_pTscDeltaSync;
     195/** The TSC delta measurement initiator Cpu Id. */
     196static volatile RTCPUID     g_idTscDeltaInitiator = NIL_RTCPUID;
     197/** Number of online/offline events, incremented each time a CPU goes online
     198 *  or offline. */
     199static volatile uint32_t    g_cMpOnOffEvents;
    148200
    149201/**
     
    354406    { "RTSpinlockDestroy",                      (void *)RTSpinlockDestroy },
    355407    { "RTSpinlockRelease",                      (void *)RTSpinlockRelease },
    356     { "RTSpinlockReleaseNoInts",                (void *)RTSpinlockReleaseNoInts },
    357408    { "RTStrCopy",                              (void *)RTStrCopy },
    358409    { "RTStrDupTag",                            (void *)RTStrDupTag },
     
    39574008                if (pGipR0->aCPUs[0].u32TransactionId != 2 /* not the first time */)
    39584009                {
    3959                     for (i = 0; i < RT_ELEMENTS(pGipR0->aCPUs); i++)
     4010                    for (i = 0; i < pGipR0->cCpus; i++)
    39604011                        ASMAtomicUoWriteU32(&pGipR0->aCPUs[i].u32TransactionId,
    39614012                                            (pGipR0->aCPUs[i].u32TransactionId + GIP_UPDATEHZ_RECALC_FREQ * 2)
     
    55815632    supdrvGipInit(pDevExt, pGip, HCPhysGip, RTTimeSystemNanoTS(), 1000000000 / u32Interval /*=Hz*/, cCpus);
    55825633
    5583     /*
    5584      * Create the timer.
    5585      * If CPU_ALL isn't supported we'll have to fall back to synchronous mode.
    5586      */
    5587     if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
    5588     {
    5589         rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, RTTIMER_FLAGS_CPU_ALL, supdrvGipAsyncTimer, pDevExt);
    5590         if (rc == VERR_NOT_SUPPORTED)
    5591         {
    5592             OSDBGPRINT(("supdrvGipCreate: omni timer not supported, falling back to synchronous mode\n"));
    5593             pGip->u32Mode = SUPGIPMODE_SYNC_TSC;
    5594         }
    5595     }
    5596     if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
    5597         rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, 0 /* fFlags */, supdrvGipSyncTimer, pDevExt);
     5634    rc = RTMpNotificationRegister(supdrvGipMpEvent, pDevExt);
    55985635    if (RT_SUCCESS(rc))
    55995636    {
    5600         rc = RTMpNotificationRegister(supdrvGipMpEvent, pDevExt);
     5637        rc = RTMpOnAll(supdrvGipInitOnCpu, pDevExt, pGip);
    56015638        if (RT_SUCCESS(rc))
    56025639        {
    5603             rc = RTMpOnAll(supdrvGipInitOnCpu, pDevExt, pGip);
     5640            /*
     5641             * Measure the TSC deltas now that we have MP notifications.
     5642             */
     5643            unsigned cTries = 5;
     5644#if 0
     5645            do
     5646            {
     5647                rc = supdrvMeasureTscDeltas(pDevExt, pGip, NULL /* pidxMaster */);
     5648                if (rc == VERR_TRY_AGAIN)
     5649                {
     5650                    --cTries;
     5651                    continue;
     5652                }
     5653                else
     5654                    break;
     5655            } while (cTries > 0);
     5656#endif
     5657
    56045658            if (RT_SUCCESS(rc))
    56055659            {
     5660#if 0
     5661                unsigned iCpu;
     5662                SUPR0Printf("cTries=%u\n", cTries);
     5663                for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
     5664                    SUPR0Printf("Cpu[%3u].delta=%ld\n", iCpu, pGip->aCPUs[iCpu].i64TSCDelta);
     5665#endif
     5666
    56065667                /*
    5607                  * We're good.
     5668                 * Create the timer.
     5669                 * If CPU_ALL isn't supported we'll have to fall back to synchronous mode.
    56085670                 */
    5609                 Log(("supdrvGipCreate: %u ns interval.\n", u32Interval));
    5610                 g_pSUPGlobalInfoPage = pGip;
    5611                 return VINF_SUCCESS;
    5612             }
    5613 
     5671                if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
     5672                {
     5673                    rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, RTTIMER_FLAGS_CPU_ALL, supdrvGipAsyncTimer, pDevExt);
     5674                    if (rc == VERR_NOT_SUPPORTED)
     5675                    {
     5676                        OSDBGPRINT(("supdrvGipCreate: omni timer not supported, falling back to synchronous mode\n"));
     5677                        pGip->u32Mode = SUPGIPMODE_SYNC_TSC;
     5678                    }
     5679                }
     5680                if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
     5681                    rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, 0 /* fFlags */, supdrvGipSyncTimer, pDevExt);
     5682                if (RT_SUCCESS(rc))
     5683                {
     5684                    /*
     5685                     * We're good.
     5686                     */
     5687                    Log(("supdrvGipCreate: %u ns interval.\n", u32Interval));
     5688                    g_pSUPGlobalInfoPage = pGip;
     5689                    return VINF_SUCCESS;
     5690                }
     5691                else
     5692                {
     5693                    OSDBGPRINT(("supdrvGipCreate: failed create GIP timer at %u ns interval. rc=%Rrc\n", u32Interval, rc));
     5694                    Assert(!pDevExt->pGipTimer);
     5695                }
     5696            }
     5697            else
     5698                OSDBGPRINT(("supdrvGipCreate: supdrvMeasureTscDeltas() failed with rc=%Rrc after %u tries!\n", rc, cTries));
     5699        }
     5700        else
    56145701            OSDBGPRINT(("supdrvGipCreate: RTMpOnAll failed with rc=%Rrc\n", rc));
    5615             RTMpNotificationDeregister(supdrvGipMpEvent, pDevExt);
    5616 
    5617         }
    5618         else
    5619             OSDBGPRINT(("supdrvGipCreate: failed to register MP event notfication. rc=%Rrc\n", rc));
     5702
     5703        RTMpNotificationDeregister(supdrvGipMpEvent, pDevExt);
    56205704    }
    56215705    else
    5622     {
    5623         OSDBGPRINT(("supdrvGipCreate: failed create GIP timer at %u ns interval. rc=%Rrc\n", u32Interval, rc));
    5624         Assert(!pDevExt->pGipTimer);
    5625     }
     5706        OSDBGPRINT(("supdrvGipCreate: failed to register MP event notfication. rc=%Rrc\n", rc));
     5707
    56265708    supdrvGipDestroy(pDevExt);
    56275709    return rc;
     
    58115893    ASMAtomicWriteU16(&pGip->aiCpuFromCpuSetIdx[iCpuSet], i);
    58125894
     5895    /* Update the Mp online/offline counter. */
     5896    ASMAtomicIncU32(&g_cMpOnOffEvents);
     5897
    58135898    /* commit it */
    58145899    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_ONLINE);
    58155900
    5816     RTSpinlockReleaseNoInts(pDevExt->hGipSpinlock);
     5901    RTSpinlockRelease(pDevExt->hGipSpinlock);
    58175902}
    58185903
     
    58465931    RTCpuSetDelByIndex(&pGip->OnlineCpuSet, iCpuSet);
    58475932
     5933    /* Update the Mp online/offline counter. */
     5934    ASMAtomicIncU32(&g_cMpOnOffEvents);
     5935
     5936    /* If we are the initiator going offline while measuring the TSC delta, unspin other waiting CPUs! */
     5937    if (ASMAtomicReadU32(&g_idTscDeltaInitiator) == idCpu)
     5938    {
     5939        ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_START);
     5940        ASMAtomicWriteU64(&pGip->aCPUs[i].u64TSCSample, ~GIP_TSC_DELTA_RSVD);
     5941    }
     5942
    58485943    /* commit it */
    58495944    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE);
    58505945
    5851     RTSpinlockReleaseNoInts(pDevExt->hGipSpinlock);
     5946    RTSpinlockRelease(pDevExt->hGipSpinlock);
    58525947}
    58535948
     
    59296024
    59306025/**
     6026 * Callback used by supdrvMeasureTscDeltas() to read the TSC on two CPUs and
     6027 * compute the delta between them.
     6028 *
     6029 * @param   idCpu       The CPU we are current scheduled on.
     6030 * @param   pvUser1     Opaque pointer to the GIP.
     6031 * @param   pvUser2     Opaque pointer to the worker Cpu Id.
     6032 *
     6033 * @remarks Measuring TSC deltas between the CPUs is tricky because we need to
     6034 *     read the TSC at exactly the same time on both the master and the worker
     6035 *     CPUs. Due to DMA, bus arbitration, cache locality, contention etc. there
     6036 *     is no guaranteed way of doing this on x86 CPUs. We try to minimize the
     6037 *     measurement error by computing the minimum read time of the compare
     6038 *     statement in the slave by taking TSC measurements across it. We also
     6039 *     ignore the first few runs of the loop in order to prime the cache.
     6040 *
     6041 *     It must be noted that the computed minimum read time is mostly to
     6042 *     eliminate huge deltas when the slave is too early and doesn't by itself
     6043 *     help produce more accurate deltas. We allow two times the computed
     6044 *     minimum as an arbibtrary acceptable threshold. Therefore, it is still
     6045 *     possible to get negative deltas where there are none when the slave is
     6046 *     earlier.
     6047 */
     6048static DECLCALLBACK(void) supdrvDetermineTscDeltaCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
     6049{
     6050    PSUPGLOBALINFOPAGE pGip      = (PSUPGLOBALINFOPAGE)pvUser1;
     6051    uint32_t          *pidWorker = (uint32_t *)pvUser2;
     6052    RTCPUID            idMaster  = ASMAtomicUoReadU32(&g_idTscDeltaInitiator);
     6053    unsigned           idxMaster = supdrvGipCpuIndexFromCpuId(pGip, idMaster);
     6054    unsigned           idxWorker = supdrvGipCpuIndexFromCpuId(pGip, *pidWorker);
     6055    PSUPGIPCPU         pGipCpuMaster = &pGip->aCPUs[idxMaster];
     6056    PSUPGIPCPU         pGipCpuWorker = &pGip->aCPUs[idxWorker];
     6057    uint64_t           uMinCmpReadTime = UINT64_MAX;
     6058    int                cTriesLeft = 8;
     6059
     6060    if (   idCpu != idMaster
     6061        && idCpu != *pidWorker)
     6062        return;
     6063
     6064    /* If the IPRT API isn't concurrent safe, the master and worker wait for each other
     6065       with a timeout to avoid deadlocking the entire system. */
     6066    if (!RTMpOnAllIsConcurrentSafe())
     6067    {
     6068        uint64_t       uTscNow;
     6069        uint64_t       uTscStart;
     6070        uint64_t const cWaitTicks = 130000;  /* Arbitrary value, can be tweaked later. */
     6071
     6072        ASMSerializeInstruction();
     6073        uTscStart = ASMReadTSC();
     6074        if (idCpu == idMaster)
     6075        {
     6076            ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_PRESTART_MASTER);
     6077            while (ASMAtomicReadU32(&g_pTscDeltaSync->u) != GIP_TSC_DELTA_SYNC_PRESTART_WORKER)
     6078            {
     6079                ASMSerializeInstruction();
     6080                uTscNow = ASMReadTSC();
     6081                if (uTscNow - uTscStart > cWaitTicks)
     6082                {
     6083                    /* Set the worker delta to indicate failure, not the master. */
     6084                    ASMAtomicWriteS64(&pGipCpuWorker->i64TSCDelta, INT64_MAX);
     6085                    return;
     6086                }
     6087
     6088                ASMNopPause();
     6089            }
     6090        }
     6091        else
     6092        {
     6093            while (ASMAtomicReadU32(&g_pTscDeltaSync->u) != GIP_TSC_DELTA_SYNC_PRESTART_MASTER)
     6094            {
     6095                ASMSerializeInstruction();
     6096                uTscNow = ASMReadTSC();
     6097                if (uTscNow - uTscStart > cWaitTicks)
     6098                {
     6099                    ASMAtomicWriteS64(&pGipCpuWorker->i64TSCDelta, INT64_MAX);
     6100                    return;
     6101                }
     6102
     6103                ASMNopPause();
     6104            }
     6105            ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_PRESTART_WORKER);
     6106        }
     6107    }
     6108
     6109    Assert(pGipCpuWorker->i64TSCDelta == INT64_MAX);
     6110    while (cTriesLeft-- > 0)
     6111    {
     6112        unsigned i;
     6113        RTCCUINTREG uFlags = ASMIntDisableFlags();          /* Disable interrupts for the duration of a try. */
     6114        for (i = 0; i < GIP_TSC_DELTA_LOOPS; i++)
     6115        {
     6116            if (idCpu == idMaster)
     6117            {
     6118                /*
     6119                 * The master.
     6120                 */
     6121                Assert(pGipCpuMaster->u64TSCSample == GIP_TSC_DELTA_RSVD);
     6122                ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_START);
     6123                while (ASMAtomicReadU32(&g_pTscDeltaSync->u) == GIP_TSC_DELTA_SYNC_START)
     6124                    ;
     6125
     6126                do
     6127                {
     6128                    ASMSerializeInstruction();
     6129                    ASMAtomicWriteU64(&pGipCpuMaster->u64TSCSample, ASMReadTSC());
     6130                } while (pGipCpuMaster->u64TSCSample == GIP_TSC_DELTA_RSVD);
     6131
     6132                while (ASMAtomicReadU32(&g_pTscDeltaSync->u) != GIP_TSC_DELTA_SYNC_WORKER_DONE)
     6133                    ;
     6134
     6135                if (i > GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS)
     6136                {
     6137                    if (pGipCpuWorker->u64TSCSample != GIP_TSC_DELTA_RSVD)
     6138                    {
     6139                        int64_t iDelta = pGipCpuWorker->u64TSCSample - pGipCpuMaster->u64TSCSample;
     6140                        if (iDelta < pGipCpuWorker->i64TSCDelta)
     6141                            pGipCpuWorker->i64TSCDelta = iDelta;
     6142                    }
     6143                }
     6144
     6145                ASMAtomicWriteU64(&pGipCpuMaster->u64TSCSample, GIP_TSC_DELTA_RSVD);
     6146                ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_STOP);
     6147            }
     6148            else
     6149            {
     6150                /*
     6151                 * The worker.
     6152                 */
     6153                uint64_t uTscWorker;
     6154                uint64_t uTscWorkerFlushed;
     6155                uint64_t uCmpReadTime;
     6156
     6157                ASMAtomicReadU64(&pGipCpuMaster->u64TSCSample);     /* Warm the cache line. */
     6158                while (ASMAtomicReadU32(&g_pTscDeltaSync->u) != GIP_TSC_DELTA_SYNC_START)
     6159                    ;
     6160                ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_WORKER_READY);
     6161
     6162                /*
     6163                 * Keep reading the TSC until we notice that the master has read his. Reading
     6164                 * the TSC -after- the master has updated the memory is way too late. We thus
     6165                 * compensate by trying to measure how long it took for the slave to notice
     6166                 * the memory flushed from the master.
     6167                 */
     6168                do
     6169                {
     6170                    ASMSerializeInstruction();
     6171                    uTscWorker = ASMReadTSC();
     6172                } while (pGipCpuMaster->u64TSCSample == GIP_TSC_DELTA_RSVD);
     6173                ASMSerializeInstruction();
     6174                uTscWorkerFlushed = ASMReadTSC();
     6175
     6176                uCmpReadTime = uTscWorkerFlushed - uTscWorker;
     6177                if (i > GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS)
     6178                {
     6179                    /* This is totally arbitrary a.k.a I don't like it but I have no better ideas for now. */
     6180                    if (uCmpReadTime < (uMinCmpReadTime << 1))
     6181                    {
     6182                        ASMAtomicWriteU64(&pGipCpuWorker->u64TSCSample, uTscWorker);
     6183                        if (uCmpReadTime < uMinCmpReadTime)
     6184                            uMinCmpReadTime = uCmpReadTime;
     6185                    }
     6186                    else
     6187                        ASMAtomicWriteU64(&pGipCpuWorker->u64TSCSample, GIP_TSC_DELTA_RSVD);
     6188                }
     6189                else if (i > GIP_TSC_DELTA_PRIMER_LOOPS)
     6190                {
     6191                    if (uCmpReadTime < uMinCmpReadTime)
     6192                        uMinCmpReadTime = uCmpReadTime;
     6193                }
     6194
     6195                ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_WORKER_DONE);
     6196                while (ASMAtomicReadU32(&g_pTscDeltaSync->u) == GIP_TSC_DELTA_SYNC_WORKER_DONE)
     6197                    ASMNopPause();
     6198            }
     6199        }
     6200        ASMSetFlags(uFlags);
     6201
     6202        if (pGipCpuWorker->i64TSCDelta != INT64_MAX)
     6203            break;
     6204    }
     6205}
     6206
     6207
     6208/**
     6209 * Clears all TSCs on the per-CPUs GIP struct. as well as the delta
     6210 * synchronization variable. Optionally also clears the deltas on the per-CPU
     6211 * GIP struct. as well.
     6212 *
     6213 * @param   pGip            Pointer to the GIP.
     6214 * @param   fClearDeltas    Whether the deltas are also to be cleared.
     6215 */
     6216DECLINLINE(void) supdrvClearTscSamples(PSUPGLOBALINFOPAGE pGip, bool fClearDeltas)
     6217{
     6218    unsigned iCpu;
     6219    for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
     6220    {
     6221        PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu];
     6222        ASMAtomicWriteU64(&pGipCpu->u64TSCSample, GIP_TSC_DELTA_RSVD);
     6223        if (fClearDeltas)
     6224            ASMAtomicWriteS64(&pGipCpu->i64TSCDelta, INT64_MAX);
     6225    }
     6226    ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_STOP);
     6227}
     6228
     6229
     6230/**
     6231 * Measures the TSC deltas between CPUs.
     6232 *
     6233 * @param   pDevExt     Pointer to the device instance data.
     6234 * @param   pGip        Pointer to the GIP.
     6235 * @param   pidxMaster  Where to store the index of the chosen master TSC if we
     6236 *                      managed to determine the TSC deltas successfully.
     6237 *                      Optional, can be NULL.
     6238 *
     6239 * @returns VBox status code.
     6240 * @remarks Must be called only after supdrvGipInitOnCpu() as this function uses
     6241 *          idCpu, GIP's online CPU set which are populated in
     6242 *          supdrvGipInitOnCpu().
     6243 */
     6244static int supdrvMeasureTscDeltas(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, uint32_t *pidxMaster)
     6245{
     6246    PSUPGIPCPU pGipCpuMaster;
     6247    unsigned   iCpu;
     6248    uint32_t   cMpOnOffEvents = ASMAtomicReadU32(&g_cMpOnOffEvents);
     6249    uint32_t   cOnlineCpus    = pGip->cOnlineCpus;
     6250
     6251    /* Pick the first CPU which is online as the master TSC. */
     6252    uint32_t idxMaster = UINT32_MAX;
     6253    supdrvClearTscSamples(pGip, true /* fClearDeltas */);
     6254    for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
     6255    {
     6256        PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu];
     6257        if (RTCpuSetIsMember(&pGip->OnlineCpuSet, pGipCpu->idCpu))
     6258        {
     6259            idxMaster = iCpu;
     6260            pGipCpu->i64TSCDelta = 0;
     6261            break;
     6262        }
     6263    }
     6264    AssertReturn(cOnlineCpus > 0, VERR_INTERNAL_ERROR_5);
     6265    AssertReturn(idxMaster != UINT32_MAX, VERR_CPU_NOT_FOUND);
     6266
     6267    if (pGip->cOnlineCpus <= 1)
     6268    {
     6269        if (pidxMaster)
     6270            *pidxMaster = idxMaster;
     6271        return VINF_SUCCESS;
     6272    }
     6273
     6274    /* Pick the master TSC as the initiator. */
     6275    pGipCpuMaster = &pGip->aCPUs[idxMaster];
     6276    ASMAtomicWriteU32(&g_idTscDeltaInitiator, pGipCpuMaster->idCpu);
     6277
     6278    for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
     6279    {
     6280        PSUPGIPCPU pGipCpuWorker = &pGip->aCPUs[iCpu];
     6281        if (   iCpu != idxMaster
     6282            && RTCpuSetIsMember(&pGip->OnlineCpuSet, pGipCpuWorker->idCpu))
     6283        {
     6284            int rc;
     6285
     6286            /* Fire TSC-read workers on all CPUs but only synchronize between master and one worker to memory contention. */
     6287            ASMAtomicWriteU32(&g_pTscDeltaSync->u, GIP_TSC_DELTA_SYNC_STOP);
     6288            rc = RTMpOnAll(supdrvDetermineTscDeltaCallback, pGip, &pGipCpuWorker->idCpu);
     6289            if (RT_FAILURE(rc))
     6290            {
     6291                SUPR0Printf("supdrvMeasureTscDeltas: RTMpOnAll failed. rc=%d\n", rc);
     6292                return rc;
     6293            }
     6294
     6295            if (RT_UNLIKELY(pGipCpuWorker->i64TSCDelta == INT64_MAX))
     6296            {
     6297                SUPR0Printf("Failed to measure TSC deltas for CPU[%u] idCpu=%u\n", iCpu, pGipCpuWorker->idCpu);
     6298                return VERR_UNRESOLVED_ERROR;
     6299            }
     6300
     6301            if (ASMAtomicReadU32(&g_cMpOnOffEvents) != cMpOnOffEvents)
     6302            {
     6303                SUPR0Printf("One or more CPUs transitioned between online & offline states. I are confused, retrying...\n");
     6304                return VERR_TRY_AGAIN;
     6305            }
     6306        }
     6307    }
     6308
     6309    ASMAtomicWriteU32(&g_idTscDeltaInitiator, NIL_RTCPUID);
     6310
     6311    if (RT_LIKELY(!pGipCpuMaster->i64TSCDelta))
     6312    {
     6313        if (pidxMaster)
     6314            *pidxMaster = idxMaster;
     6315        return VINF_SUCCESS;
     6316    }
     6317    return VERR_INTERNAL_ERROR_4;
     6318}
     6319
     6320
     6321/**
    59316322 * Callback used by supdrvDetermineAsyncTSC to read the TSC on a CPU.
    59326323 *
     
    59376328static DECLCALLBACK(void) supdrvDetermineAsyncTscWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
    59386329{
    5939 #if 1
    59406330    ASMAtomicWriteU64((uint64_t volatile *)pvUser1, ASMReadTSC());
    5941 #else
    5942     *(uint64_t *)pvUser1 = ASMReadTSC();
    5943 #endif
    59446331}
    59456332
     
    60926479    pCpu->u64NanoTS          = u64NanoTS;
    60936480    pCpu->u64TSC             = ASMReadTSC();
     6481    pCpu->u64TSCSample       = GIP_TSC_DELTA_RSVD;
     6482    pCpu->i64TSCDelta        = INT64_MAX;
    60946483
    60956484    ASMAtomicWriteSize(&pCpu->enmState, SUPGIPCPUSTATE_INVALID);
     
    61716560    pDevExt->HCPhysGip = HCPhys;
    61726561    pDevExt->cGipUsers = 0;
     6562
     6563    /*
     6564     * Allocate the TSC delta sync. struct. on a separate cache line.
     6565     */
     6566    g_pvTscDeltaSync = RTMemAllocZ(sizeof(SUPTSCDELTASYNC) + 63);
     6567    g_pTscDeltaSync  = RT_ALIGN_PT(g_pvTscDeltaSync, 64, PSUPTSCDELTASYNC);
     6568    Assert(RT_ALIGN_PT(g_pTscDeltaSync, 64, PSUPTSCDELTASYNC) == g_pTscDeltaSync);
    61736569}
    61746570
     
    61986594    unsigned i;
    61996595    pGip->u32Magic = 0;
    6200     for (i = 0; i < RT_ELEMENTS(pGip->aCPUs); i++)
     6596    for (i = 0; i < pGip->cCpus; i++)
    62016597    {
    62026598        pGip->aCPUs[i].u64NanoTS = 0;
    62036599        pGip->aCPUs[i].u64TSC = 0;
    62046600        pGip->aCPUs[i].iTSCHistoryHead = 0;
     6601        pGip->aCPUs[i].u64TSCSample = 0;
     6602        pGip->aCPUs[i].i64TSCDelta = INT64_MAX;
     6603    }
     6604
     6605    if (g_pvTscDeltaSync)
     6606    {
     6607        RTMemFree(g_pvTscDeltaSync);
     6608        g_pTscDeltaSync  = NULL;
     6609        g_pvTscDeltaSync = NULL;
    62056610    }
    62066611}
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r51907 r52618  
    55
    66/*
    7  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    200200 *
    201201 * @todo Pending work on next major version change:
    202  *          - Remove RTSpinlockReleaseNoInts.
    203  */
    204 #define SUPDRV_IOC_VERSION                              0x001a0007
     202 *          - (none).
     203 */
     204#define SUPDRV_IOC_VERSION                              0x001b0000
    205205
    206206/** SUP_IOCTL_COOKIE. */
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r51978 r52618  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    474474        { "RTSpinlockRelease",                      0xefef0031 },
    475475        { "RTSpinlockAcquireNoInts",                0xefef0032 },
    476         { "RTSpinlockReleaseNoInts",                0xefef0033 },
    477476        { "RTTimeNanoTS",                           0xefef0034 },
    478477        { "RTTimeMillieTS",                         0xefef0035 },
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r52576 r52618  
    505505            rc = VERR_GENERAL_FAILURE;
    506506
    507         RTSpinlockReleaseNoInts(g_Spinlock);
     507        RTSpinlockRelease(g_Spinlock);
    508508#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
    509509        kauth_cred_unref(&pCred);
     
    571571        supdrvSessionRetain(pSession);
    572572
    573     RTSpinlockReleaseNoInts(g_Spinlock);
     573    RTSpinlockRelease(g_Spinlock);
    574574    if (RT_UNLIKELY(!pSession))
    575575    {
     
    14781478                    rc = VERR_ALREADY_LOADED;
    14791479
    1480                 RTSpinlockReleaseNoInts(g_Spinlock);
     1480                RTSpinlockRelease(g_Spinlock);
    14811481                if (RT_SUCCESS(rc))
    14821482                {
     
    15411541        }
    15421542    }
    1543     RTSpinlockReleaseNoInts(g_Spinlock);
     1543    RTSpinlockRelease(g_Spinlock);
    15441544    if (!pSession)
    15451545    {
  • trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp

    r52575 r52618  
    163163        pSession->pNextHash = g_apSessionHashTab[iHash];
    164164        g_apSessionHashTab[iHash] = pSession;
    165         RTSpinlockReleaseNoInts(g_Spinlock);
     165        RTSpinlockRelease(g_Spinlock);
    166166    }
    167167
     
    212212        }
    213213    }
    214     RTSpinlockReleaseNoInts(g_Spinlock);
     214    RTSpinlockRelease(g_Spinlock);
    215215    if (!pSession)
    216216    {
     
    248248            supdrvSessionRetain(pSession);
    249249    }
    250     RTSpinlockReleaseNoInts(g_Spinlock);
     250    RTSpinlockRelease(g_Spinlock);
    251251    if (RT_UNLIKELY(!pSession))
    252252    {
     
    285285            supdrvSessionRetain(pSession);
    286286    }
    287     RTSpinlockReleaseNoInts(g_Spinlock);
     287    RTSpinlockRelease(g_Spinlock);
    288288    if (!pSession)
    289289    {
  • trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c

    r52575 r52618  
    55
    66/*
    7  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    543543        pSession->pNextHash = g_apSessionHashTab[iHash];
    544544        g_apSessionHashTab[iHash] = pSession;
    545         RTSpinlockReleaseNoInts(g_Spinlock);
     545        RTSpinlockRelease(g_Spinlock);
    546546        LogFlow(("VBoxDrvSolarisOpen success\n"));
    547547    }
     
    631631        }
    632632    }
    633     RTSpinlockReleaseNoInts(g_Spinlock);
     633    RTSpinlockRelease(g_Spinlock);
    634634    if (!pSession)
    635635    {
     
    705705    while (pSession && pSession->Process != Process && pSession->fUnrestricted == fUnrestricted);
    706706        pSession = pSession->pNextHash;
    707     RTSpinlockReleaseNoInts(g_Spinlock);
     707    RTSpinlockRelease(g_Spinlock);
    708708    if (!pSession)
    709709    {
  • trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp

    r45399 r52618  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    108108                     g_pSUPGlobalInfoPage->u32Version);
    109109            RTPrintf(fHex
    110                      ? "tstGIP-2:     it: u64NanoTS        delta     u64TSC           UpIntTSC H  TransId           CpuHz TSC Interval History...\n"
    111                      : "tstGIP-2:     it: u64NanoTS        delta     u64TSC             UpIntTSC H    TransId           CpuHz TSC Interval History...\n");
     110                     ? "tstGIP-2:     it: u64NanoTS        delta     u64TSC           UpIntTSC H  TransId           CpuHz         TSCDelta TSC Interval History...\n"
     111                     : "tstGIP-2:     it: u64NanoTS        delta     u64TSC             UpIntTSC H    TransId           CpuHz         TSCDelta TSC Interval History...\n");
    112112            static SUPGIPCPU s_aaCPUs[2][256];
    113113            for (uint32_t i = 0; i < cIterations; i++)
     
    126126                        PSUPGIPCPU pCpu = &s_aaCPUs[i & 1][iCpu];
    127127                        RTPrintf(fHex
    128                                  ? "tstGIP-2: %4d/%d: %016llx %09llx %016llx %08x %d %08x %15llu %08x %08x %08x %08x %08x %08x %08x %08x (%d)\n"
    129                                  : "tstGIP-2: %4d/%d: %016llu %09llu %016llu %010u %d %010u %15llu %08x %08x %08x %08x %08x %08x %08x %08x (%d)\n",
     128                                 ? "tstGIP-2: %4d/%d: %016llx %09llx %016llx %08x %d %08x %15llu %016lld %08x %08x %08x %08x %08x %08x %08x %08x (%d)\n"
     129                                 : "tstGIP-2: %4d/%d: %016llu %09llu %016llu %010u %d %010u %15llu %016lld %08x %08x %08x %08x %08x %08x %08x %08x (%d)\n",
    130130                                 i, iCpu,
    131131                                 pCpu->u64NanoTS,
     
    136136                                 pCpu->u32TransactionId,
    137137                                 pCpu->u64CpuHz,
     138                                 pCpu->i64TSCDelta,
    138139                                 pCpu->au32TSCHistory[0],
    139140                                 pCpu->au32TSCHistory[1],
     
    159160                        /* nop */;
    160161            }
     162
     163            /* Display TSC deltas. */
     164            RTPrintf("tstGIP-2: TSC deltas:\n");
     165            for (unsigned iCpu = 0; iCpu < g_pSUPGlobalInfoPage->cCpus; iCpu++)
     166                RTPrintf("tstGIP-2: %6d: %016lld\n", iCpu, g_pSUPGlobalInfoPage->aCPUs[iCpu].i64TSCDelta);
    161167        }
    162168        else
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c

    r44528 r52618  
    55
    66/*
    7  * Copyright (C) 2008-2012 Oracle Corporation
     7 * Copyright (C) 2008-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    109109    RTSpinlockAcquire(pThis->hSpinlock);
    110110    vboxNetAdpSetState(pThis, enmNewState);
    111     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     111    RTSpinlockRelease(pThis->hSpinlock);
    112112}
    113113
     
    126126    RTSpinlockAcquire(pThis->hSpinlock);
    127127    enmState = vboxNetAdpGetState(pThis);
    128     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     128    RTSpinlockRelease(pThis->hSpinlock);
    129129    Log(("vboxNetAdpGetStateWithLock: pThis=%p, state=%d.\n", pThis, enmState));
    130130    return enmState;
     
    152152    else
    153153        fRc = false;
    154     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     154    RTSpinlockRelease(pThis->hSpinlock);
    155155
    156156    if (fRc)
     
    180180            &&  !strcmp(pThis->szName, pszName))
    181181        {
    182             RTSpinlockReleaseNoInts(pThis->hSpinlock);
     182            RTSpinlockRelease(pThis->hSpinlock);
    183183            return pThis;
    184184        }
    185         RTSpinlockReleaseNoInts(pThis->hSpinlock);
     185        RTSpinlockRelease(pThis->hSpinlock);
    186186    }
    187187    return NULL;
     
    349349        vboxNetAdpBusy(pThis);
    350350    }
    351     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     351    RTSpinlockRelease(pThis->hSpinlock);
    352352    Log(("vboxNetAdpPrepareToReceive: fCanReceive=%d.\n", fCanReceive));
    353353
     
    413413    if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Active)
    414414    {
    415         RTSpinlockReleaseNoInts(pThis->hSpinlock);
     415        RTSpinlockRelease(pThis->hSpinlock);
    416416        Log(("vboxNetAdpReceive: Dropping incoming packet for inactive interface %s.\n",
    417417             pThis->szName));
     
    420420    vboxNetAdpRetain(pThis);
    421421    vboxNetAdpBusy(pThis);
    422     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     422    RTSpinlockRelease(pThis->hSpinlock);
    423423
    424424    rc = vboxNetAdpPortOsXmit(pThis, pSG, fDst);
     
    515515    }
    516516
    517     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     517    RTSpinlockRelease(pThis->hSpinlock);
    518518    Log(("vboxNetAdpPortSetActive: state after: %RTbool.\n", vboxNetAdpGetState(pThis)));
    519519    return fPreviouslyActive;
     
    546546    Assert(!pThis->cBusy);
    547547    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
    548     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     548    RTSpinlockRelease(pThis->hSpinlock);
    549549
    550550    vboxNetAdpOsDisconnectIt(pThis);
     
    553553    RTSpinlockAcquire(pThis->hSpinlock);
    554554    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
    555     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     555    RTSpinlockRelease(pThis->hSpinlock);
    556556
    557557    vboxNetAdpRelease(pThis);
     
    601601            RTSpinlockAcquire(pThis->hSpinlock);
    602602            vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
    603             RTSpinlockReleaseNoInts(pThis->hSpinlock);
     603            RTSpinlockRelease(pThis->hSpinlock);
    604604            return rc;
    605605        }
     
    617617    if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Available || pThis->cBusy)
    618618    {
    619         RTSpinlockReleaseNoInts(pThis->hSpinlock);
     619        RTSpinlockRelease(pThis->hSpinlock);
    620620        return VERR_INTNET_FLT_IF_BUSY;
    621621    }
    622622    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
    623     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     623    RTSpinlockRelease(pThis->hSpinlock);
    624624    vboxNetAdpRelease(pThis);
    625625
     
    628628    RTSpinlockAcquire(pThis->hSpinlock);
    629629    vboxNetAdpSetState(pThis, kVBoxNetAdpState_Invalid);
    630     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     630    RTSpinlockRelease(pThis->hSpinlock);
    631631
    632632    return rc;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c

    r52394 r52618  
    55
    66/*
    7  * Copyright (C) 2008-2012 Oracle Corporation
     7 * Copyright (C) 2008-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    404404        ASMAtomicWriteBool(&pThis->fRediscoveryPending, true);
    405405
    406     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     406    RTSpinlockRelease(pThis->hSpinlock);
    407407
    408408    /*
     
    517517    if (enmOldTrunkState != enmState)
    518518        ASMAtomicWriteU32((uint32_t volatile *)&pThis->enmTrunkState, enmState);
    519     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     519    RTSpinlockRelease(pThis->hSpinlock);
    520520
    521521    /*
     
    622622    RTSpinlockAcquire(pThis->hSpinlock);
    623623    vboxNetFltSetState(pThis, kVBoxNetFltInsState_Disconnecting);
    624     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     624    RTSpinlockRelease(pThis->hSpinlock);
    625625
    626626    vboxNetFltOsDisconnectIt(pThis);
     
    630630    RTSpinlockAcquire(pThis->hSpinlock);
    631631    vboxNetFltSetState(pThis, kVBoxNetFltInsState_Unconnected);
    632     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     632    RTSpinlockRelease(pThis->hSpinlock);
    633633#endif
    634634
     
    850850        AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs);
    851851    }
    852     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     852    RTSpinlockRelease(pThis->hSpinlock);
    853853
    854854    return fRc;
     
    897897        AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs);
    898898    }
    899     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     899    RTSpinlockRelease(pThis->hSpinlock);
    900900
    901901    return fRc;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp

    r50762 r52618  
    319319            ifnet_reference(pIfNet);
    320320    }
    321     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     321    RTSpinlockRelease(pThis->hSpinlock);
    322322
    323323    return pIfNet;
     
    749749    ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
    750750
    751     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     751    RTSpinlockRelease(pThis->hSpinlock);
    752752
    753753    if (pIfNet)
     
    10311031    RTSpinlockAcquire(pThis->hSpinlock);
    10321032    ASMAtomicUoWritePtr(&pThis->u.s.pIfNet, pIfNet);
    1033     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1033    RTSpinlockRelease(pThis->hSpinlock);
    10341034
    10351035    /* Adjust g_offIfNetPCount as it varies for different versions of xnu. */
     
    10691069            pIfNet = NULL; /* don't dereference it */
    10701070        }
    1071         RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1071        RTSpinlockRelease(pThis->hSpinlock);
    10721072
    10731073        /* Report capabilities. */
     
    12901290    if (pIfFilter)
    12911291        ASMAtomicUoWriteNullPtr(&pThis->u.s.pIfFilter);
    1292     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1292    RTSpinlockRelease(pThis->hSpinlock);
    12931293
    12941294    if (pIfFilter)
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c

    r40912 r52618  
    609609    TASK_INIT(&pThis->u.s.tskout, 0, vboxNetFltFreeBSDoutput, pThis);
    610610
    611     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     611    RTSpinlockRelease(pThis->hSpinlock);
    612612
    613613    NG_NODE_SET_PRIVATE(node, pThis);
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c

    r47484 r52618  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    406406    ASMAtomicXchgPtr((void * volatile *)&pDev->hard_start_xmit, vboxNetFltLinuxStartXmitFilter);
    407407# endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
    408     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     408    RTSpinlockRelease(pThis->hSpinlock);
    409409}
    410410
     
    442442    else
    443443        pOverride = NULL;
    444     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     444    RTSpinlockRelease(pThis->hSpinlock);
    445445
    446446    if (pOverride)
     
    14651465            fFeatures = 0;
    14661466
    1467         RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1467        RTSpinlockRelease(pThis->hSpinlock);
    14681468
    14691469        if (pThis->pSwitchPort)
     
    15791579    RTSpinlockAcquire(pThis->hSpinlock);
    15801580    ASMAtomicUoWritePtr(&pThis->u.s.pDev, pDev);
    1581     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1581    RTSpinlockRelease(pThis->hSpinlock);
    15821582
    15831583    Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n",
     
    16291629        pDev = NULL; /* don't dereference it */
    16301630    }
    1631     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1631    RTSpinlockRelease(pThis->hSpinlock);
    16321632
    16331633    /*
     
    16541654        RTSpinlockAcquire(pThis->hSpinlock);
    16551655        ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev);
    1656         RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1656        RTSpinlockRelease(pThis->hSpinlock);
    16571657        dev_put(pDev);
    16581658        Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) released. ref=%d\n",
     
    16931693        ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev);
    16941694    }
    1695     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1695    RTSpinlockRelease(pThis->hSpinlock);
    16961696
    16971697    if (fRegistered)
     
    20282028    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
    20292029    fRegistered = ASMAtomicXchgBool(&pThis->u.s.fRegistered, false);
    2030     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     2030    RTSpinlockRelease(pThis->hSpinlock);
    20312031
    20322032    if (fRegistered)
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r50664 r52618  
    55
    66/*
    7  * Copyright (C) 2008-2012 Oracle Corporation
     7 * Copyright (C) 2008-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    11101110            const bool fActive = pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE;
    11111111            vboxNetFltRetain(pThis, true /* fBusy */);
    1112             RTSpinlockReleaseNoInts(pThis->hSpinlock);
     1112            RTSpinlockRelease(pThis->hSpinlock);
    11131113
    11141114            vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp

    r44529 r52618  
    55 */
    66/*
    7  * Copyright (C) 2011-2012 Oracle Corporation
     7 * Copyright (C) 2011-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    143143    vboxNetFltWinSetOpState(&pNetFlt->u.s.WinIf.MpState, kVBoxNetDevOpState_Deinitializing);
    144144
    145     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     145    RTSpinlockRelease(pNetFlt->hSpinlock);
    146146
    147147    vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState);
     
    518518            || vboxNetFltWinGetPowerState(&pNetFlt->u.s.WinIf.MpState) > NdisDeviceStateD0)
    519519    {
    520         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     520        RTSpinlockRelease(pNetFlt->hSpinlock);
    521521        *pStatus = NDIS_STATUS_FAILURE;
    522522        return 0;
     
    527527    {
    528528        pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED;
    529         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     529        RTSpinlockRelease(pNetFlt->hSpinlock);
    530530        *pStatus = NDIS_STATUS_PENDING;
    531531        return VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED;
     
    534534    if (pNetFlt->u.s.WinIf.StateFlags.fStandBy)
    535535    {
    536         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     536        RTSpinlockRelease(pNetFlt->hSpinlock);
    537537        *pStatus = NDIS_STATUS_FAILURE;
    538538        return 0;
     
    541541    pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
    542542
    543     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     543    RTSpinlockRelease(pNetFlt->hSpinlock);
    544544
    545545    *pStatus = NDIS_STATUS_SUCCESS;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp

    r44529 r52618  
    55 */
    66/*
    7  * Copyright (C) 2011-2012 Oracle Corporation
     7 * Copyright (C) 2011-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    176176        /* mark the request as InProgress before posting it to RequestComplete */
    177177        pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
    178         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     178        RTSpinlockRelease(pNetFlt->hSpinlock);
    179179        vboxNetFltWinPtRequestComplete(pNetFlt, &pNetFlt->u.s.WinIf.PassDownRequest, NDIS_STATUS_FAILURE);
    180180    }
    181181    else
    182182    {
    183         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     183        RTSpinlockRelease(pNetFlt->hSpinlock);
    184184    }
    185185}
     
    209209    }
    210210
    211     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     211    RTSpinlockRelease(pNetFlt->hSpinlock);
    212212
    213213    vboxNetFltWinPtRequestsWaitComplete(pNetFlt);
     
    14011401    if (pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing)
    14021402    {
    1403         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     1403        RTSpinlockRelease(pNetFlt->hSpinlock);
    14041404        Assert(0);
    14051405        return false;
     
    14071407    if (pNetFlt->u.s.WinIf.hBinding == NULL)
    14081408    {
    1409         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     1409        RTSpinlockRelease(pNetFlt->hSpinlock);
    14101410        Assert(0);
    14111411        return false;
     
    14131413
    14141414    pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing = TRUE;
    1415     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     1415    RTSpinlockRelease(pNetFlt->hSpinlock);
    14161416
    14171417    NdisResetEvent(&pNetFlt->u.s.WinIf.OpenCloseEvent);
     
    14441444            pNetFlt->u.s.WinIf.StateFlags.fStandBy = TRUE;
    14451445        }
    1446         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     1446        RTSpinlockRelease(pNetFlt->hSpinlock);
    14471447        vboxNetFltWinPtRequestsWaitComplete(pNetFlt);
    14481448        vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState);
     
    14691469        {
    14701470            pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
    1471             RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     1471            RTSpinlockRelease(pNetFlt->hSpinlock);
    14721472
    14731473            vboxNetFltWinMpRequestPost(pNetFlt);
     
    14751475        else
    14761476        {
    1477             RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     1477            RTSpinlockRelease(pNetFlt->hSpinlock);
    14781478        }
    14791479    }
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp

    r44529 r52618  
    55 */
    66/*
    7  * Copyright (C) 2011-2012 Oracle Corporation
     7 * Copyright (C) 2011-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    10691069        pSG = pWorker->pSG;
    10701070        pWorker->pSG = NULL;
    1071         RTSpinlockReleaseNoInts((pInstance)->hSpinlock);
     1071        RTSpinlockRelease((pInstance)->hSpinlock);
    10721072        KeSetEvent(&pWorker->KillEvent, 0, FALSE);
    10731073
     
    10831083    else
    10841084    {
    1085         RTSpinlockReleaseNoInts((pInstance)->hSpinlock);
     1085        RTSpinlockRelease((pInstance)->hSpinlock);
    10861086    }
    10871087}
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h

    r49137 r52618  
    55 */
    66/*
    7  * Copyright (C) 2011-2012 Oracle Corporation
     7 * Copyright (C) 2011-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    594594#endif
    595595    {
    596         RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
     596        RTSpinlockRelease((pNetFlt)->hSpinlock);
    597597        *pbNetFltActive = false;
    598598        return false;
     
    602602    {
    603603        vboxNetFltWinReferenceModePassThru(pNetFlt);
    604         RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
     604        RTSpinlockRelease((pNetFlt)->hSpinlock);
    605605        *pbNetFltActive = false;
    606606        return true;
     
    609609    vboxNetFltRetain((pNetFlt), true /* fBusy */);
    610610    vboxNetFltWinReferenceModeNetFlt(pNetFlt);
    611     RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
     611    RTSpinlockRelease((pNetFlt)->hSpinlock);
    612612
    613613    *pbNetFltActive = true;
     
    633633#endif
    634634    {
    635         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     635        RTSpinlockRelease(pNetFlt->hSpinlock);
    636636        *pbNetFltActive = false;
    637637        return false;
     
    642642        vboxNetFltWinIncReferenceModePassThru(pNetFlt, v);
    643643
    644         RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
     644        RTSpinlockRelease((pNetFlt)->hSpinlock);
    645645        *pbNetFltActive = false;
    646646        return true;
     
    651651    vboxNetFltWinIncReferenceModeNetFlt(pNetFlt, v);
    652652
    653     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     653    RTSpinlockRelease(pNetFlt->hSpinlock);
    654654
    655655    /* we have marked it as busy, so can do the res references outside the lock */
     
    715715#endif
    716716    {
    717         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     717        RTSpinlockRelease(pNetFlt->hSpinlock);
    718718        return true;
    719719    }
    720720
    721     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     721    RTSpinlockRelease(pNetFlt->hSpinlock);
    722722    return false;
    723723}
     
    732732#endif
    733733    {
    734         RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     734        RTSpinlockRelease(pNetFlt->hSpinlock);
    735735        return true;
    736736    }
    737737
    738     RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
     738    RTSpinlockRelease(pNetFlt->hSpinlock);
    739739    return false;
    740740}
  • trunk/src/VBox/HostDrivers/VBoxPci/VBoxPci.c

    r44529 r52618  
    55
    66/*
    7  * Copyright (C) 2011-2012 Oracle Corporation
     7 * Copyright (C) 2011-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    9090{
    9191#ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS
    92     RTSpinlockReleaseNoInts(pThis->hSpinlock);
     92    RTSpinlockRelease(pThis->hSpinlock);
    9393#else
    9494    RTSemFastMutexRelease(pThis->hFastMtx);
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