Changeset 52618 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Sep 5, 2014 12:07:29 PM (10 years ago)
- Location:
- trunk/src/VBox/HostDrivers
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r52575 r52618 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 93 93 * u32UpdateIntervalNS GIP members. The value must be a power of 2. */ 94 94 #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 121 AssertCompile(GIP_TSC_DELTA_PRIMER_LOOPS < GIP_TSC_DELTA_READ_TIME_LOOPS); 122 AssertCompile(GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS < GIP_TSC_DELTA_LOOPS); 95 123 96 124 /** @def VBOX_SVN_REV … … 139 167 RTCPUID idCpu, uint8_t idApic, uint64_t iTick); 140 168 static void supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS); 169 static int supdrvMeasureTscDeltas(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, uint32_t *pidxMaster); 141 170 static int supdrvIOCtl_ResumeSuspendedKbds(void); 142 171 … … 146 175 *******************************************************************************/ 147 176 DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage = NULL; 177 178 /** 179 * The TSC delta synchronization struct. rounded to cache line size. 180 */ 181 typedef 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; 188 AssertCompileSize(SUPTSCDELTASYNC, 64); 189 typedef SUPTSCDELTASYNC *PSUPTSCDELTASYNC; 190 191 /** Pointer to the TSC delta sync. struct. */ 192 static void *g_pvTscDeltaSync; 193 /** Aligned pointer to the TSC delta sync. struct. */ 194 static PSUPTSCDELTASYNC g_pTscDeltaSync; 195 /** The TSC delta measurement initiator Cpu Id. */ 196 static volatile RTCPUID g_idTscDeltaInitiator = NIL_RTCPUID; 197 /** Number of online/offline events, incremented each time a CPU goes online 198 * or offline. */ 199 static volatile uint32_t g_cMpOnOffEvents; 148 200 149 201 /** … … 354 406 { "RTSpinlockDestroy", (void *)RTSpinlockDestroy }, 355 407 { "RTSpinlockRelease", (void *)RTSpinlockRelease }, 356 { "RTSpinlockReleaseNoInts", (void *)RTSpinlockReleaseNoInts },357 408 { "RTStrCopy", (void *)RTStrCopy }, 358 409 { "RTStrDupTag", (void *)RTStrDupTag }, … … 3957 4008 if (pGipR0->aCPUs[0].u32TransactionId != 2 /* not the first time */) 3958 4009 { 3959 for (i = 0; i < RT_ELEMENTS(pGipR0->aCPUs); i++)4010 for (i = 0; i < pGipR0->cCpus; i++) 3960 4011 ASMAtomicUoWriteU32(&pGipR0->aCPUs[i].u32TransactionId, 3961 4012 (pGipR0->aCPUs[i].u32TransactionId + GIP_UPDATEHZ_RECALC_FREQ * 2) … … 5581 5632 supdrvGipInit(pDevExt, pGip, HCPhysGip, RTTimeSystemNanoTS(), 1000000000 / u32Interval /*=Hz*/, cCpus); 5582 5633 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); 5598 5635 if (RT_SUCCESS(rc)) 5599 5636 { 5600 rc = RTMp NotificationRegister(supdrvGipMpEvent, pDevExt);5637 rc = RTMpOnAll(supdrvGipInitOnCpu, pDevExt, pGip); 5601 5638 if (RT_SUCCESS(rc)) 5602 5639 { 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 5604 5658 if (RT_SUCCESS(rc)) 5605 5659 { 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 5606 5667 /* 5607 * We're good. 5668 * Create the timer. 5669 * If CPU_ALL isn't supported we'll have to fall back to synchronous mode. 5608 5670 */ 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 5614 5701 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); 5620 5704 } 5621 5705 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 5626 5708 supdrvGipDestroy(pDevExt); 5627 5709 return rc; … … 5811 5893 ASMAtomicWriteU16(&pGip->aiCpuFromCpuSetIdx[iCpuSet], i); 5812 5894 5895 /* Update the Mp online/offline counter. */ 5896 ASMAtomicIncU32(&g_cMpOnOffEvents); 5897 5813 5898 /* commit it */ 5814 5899 ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_ONLINE); 5815 5900 5816 RTSpinlockRelease NoInts(pDevExt->hGipSpinlock);5901 RTSpinlockRelease(pDevExt->hGipSpinlock); 5817 5902 } 5818 5903 … … 5846 5931 RTCpuSetDelByIndex(&pGip->OnlineCpuSet, iCpuSet); 5847 5932 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 5848 5943 /* commit it */ 5849 5944 ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE); 5850 5945 5851 RTSpinlockRelease NoInts(pDevExt->hGipSpinlock);5946 RTSpinlockRelease(pDevExt->hGipSpinlock); 5852 5947 } 5853 5948 … … 5929 6024 5930 6025 /** 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 */ 6048 static 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 */ 6216 DECLINLINE(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 */ 6244 static 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 /** 5931 6322 * Callback used by supdrvDetermineAsyncTSC to read the TSC on a CPU. 5932 6323 * … … 5937 6328 static DECLCALLBACK(void) supdrvDetermineAsyncTscWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2) 5938 6329 { 5939 #if 15940 6330 ASMAtomicWriteU64((uint64_t volatile *)pvUser1, ASMReadTSC()); 5941 #else5942 *(uint64_t *)pvUser1 = ASMReadTSC();5943 #endif5944 6331 } 5945 6332 … … 6092 6479 pCpu->u64NanoTS = u64NanoTS; 6093 6480 pCpu->u64TSC = ASMReadTSC(); 6481 pCpu->u64TSCSample = GIP_TSC_DELTA_RSVD; 6482 pCpu->i64TSCDelta = INT64_MAX; 6094 6483 6095 6484 ASMAtomicWriteSize(&pCpu->enmState, SUPGIPCPUSTATE_INVALID); … … 6171 6560 pDevExt->HCPhysGip = HCPhys; 6172 6561 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); 6173 6569 } 6174 6570 … … 6198 6594 unsigned i; 6199 6595 pGip->u32Magic = 0; 6200 for (i = 0; i < RT_ELEMENTS(pGip->aCPUs); i++)6596 for (i = 0; i < pGip->cCpus; i++) 6201 6597 { 6202 6598 pGip->aCPUs[i].u64NanoTS = 0; 6203 6599 pGip->aCPUs[i].u64TSC = 0; 6204 6600 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; 6205 6610 } 6206 6611 } -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r51907 r52618 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 200 200 * 201 201 * @todo Pending work on next major version change: 202 * - Remove RTSpinlockReleaseNoInts.203 */ 204 #define SUPDRV_IOC_VERSION 0x001 a0007202 * - (none). 203 */ 204 #define SUPDRV_IOC_VERSION 0x001b0000 205 205 206 206 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r51978 r52618 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 474 474 { "RTSpinlockRelease", 0xefef0031 }, 475 475 { "RTSpinlockAcquireNoInts", 0xefef0032 }, 476 { "RTSpinlockReleaseNoInts", 0xefef0033 },477 476 { "RTTimeNanoTS", 0xefef0034 }, 478 477 { "RTTimeMillieTS", 0xefef0035 }, -
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r52576 r52618 505 505 rc = VERR_GENERAL_FAILURE; 506 506 507 RTSpinlockRelease NoInts(g_Spinlock);507 RTSpinlockRelease(g_Spinlock); 508 508 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 509 509 kauth_cred_unref(&pCred); … … 571 571 supdrvSessionRetain(pSession); 572 572 573 RTSpinlockRelease NoInts(g_Spinlock);573 RTSpinlockRelease(g_Spinlock); 574 574 if (RT_UNLIKELY(!pSession)) 575 575 { … … 1478 1478 rc = VERR_ALREADY_LOADED; 1479 1479 1480 RTSpinlockRelease NoInts(g_Spinlock);1480 RTSpinlockRelease(g_Spinlock); 1481 1481 if (RT_SUCCESS(rc)) 1482 1482 { … … 1541 1541 } 1542 1542 } 1543 RTSpinlockRelease NoInts(g_Spinlock);1543 RTSpinlockRelease(g_Spinlock); 1544 1544 if (!pSession) 1545 1545 { -
trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
r52575 r52618 163 163 pSession->pNextHash = g_apSessionHashTab[iHash]; 164 164 g_apSessionHashTab[iHash] = pSession; 165 RTSpinlockRelease NoInts(g_Spinlock);165 RTSpinlockRelease(g_Spinlock); 166 166 } 167 167 … … 212 212 } 213 213 } 214 RTSpinlockRelease NoInts(g_Spinlock);214 RTSpinlockRelease(g_Spinlock); 215 215 if (!pSession) 216 216 { … … 248 248 supdrvSessionRetain(pSession); 249 249 } 250 RTSpinlockRelease NoInts(g_Spinlock);250 RTSpinlockRelease(g_Spinlock); 251 251 if (RT_UNLIKELY(!pSession)) 252 252 { … … 285 285 supdrvSessionRetain(pSession); 286 286 } 287 RTSpinlockRelease NoInts(g_Spinlock);287 RTSpinlockRelease(g_Spinlock); 288 288 if (!pSession) 289 289 { -
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r52575 r52618 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 543 543 pSession->pNextHash = g_apSessionHashTab[iHash]; 544 544 g_apSessionHashTab[iHash] = pSession; 545 RTSpinlockRelease NoInts(g_Spinlock);545 RTSpinlockRelease(g_Spinlock); 546 546 LogFlow(("VBoxDrvSolarisOpen success\n")); 547 547 } … … 631 631 } 632 632 } 633 RTSpinlockRelease NoInts(g_Spinlock);633 RTSpinlockRelease(g_Spinlock); 634 634 if (!pSession) 635 635 { … … 705 705 while (pSession && pSession->Process != Process && pSession->fUnrestricted == fUnrestricted); 706 706 pSession = pSession->pNextHash; 707 RTSpinlockRelease NoInts(g_Spinlock);707 RTSpinlockRelease(g_Spinlock); 708 708 if (!pSession) 709 709 { -
trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
r45399 r52618 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 108 108 g_pSUPGlobalInfoPage->u32Version); 109 109 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"); 112 112 static SUPGIPCPU s_aaCPUs[2][256]; 113 113 for (uint32_t i = 0; i < cIterations; i++) … … 126 126 PSUPGIPCPU pCpu = &s_aaCPUs[i & 1][iCpu]; 127 127 RTPrintf(fHex 128 ? "tstGIP-2: %4d/%d: %016llx %09llx %016llx %08x %d %08x %15llu %0 8x %08x %08x %08x %08x %08x %08x %08x (%d)\n"129 : "tstGIP-2: %4d/%d: %016llu %09llu %016llu %010u %d %010u %15llu %0 8x %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", 130 130 i, iCpu, 131 131 pCpu->u64NanoTS, … … 136 136 pCpu->u32TransactionId, 137 137 pCpu->u64CpuHz, 138 pCpu->i64TSCDelta, 138 139 pCpu->au32TSCHistory[0], 139 140 pCpu->au32TSCHistory[1], … … 159 160 /* nop */; 160 161 } 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); 161 167 } 162 168 else -
trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c
r44528 r52618 5 5 6 6 /* 7 * Copyright (C) 2008-201 2Oracle Corporation7 * Copyright (C) 2008-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 109 109 RTSpinlockAcquire(pThis->hSpinlock); 110 110 vboxNetAdpSetState(pThis, enmNewState); 111 RTSpinlockRelease NoInts(pThis->hSpinlock);111 RTSpinlockRelease(pThis->hSpinlock); 112 112 } 113 113 … … 126 126 RTSpinlockAcquire(pThis->hSpinlock); 127 127 enmState = vboxNetAdpGetState(pThis); 128 RTSpinlockRelease NoInts(pThis->hSpinlock);128 RTSpinlockRelease(pThis->hSpinlock); 129 129 Log(("vboxNetAdpGetStateWithLock: pThis=%p, state=%d.\n", pThis, enmState)); 130 130 return enmState; … … 152 152 else 153 153 fRc = false; 154 RTSpinlockRelease NoInts(pThis->hSpinlock);154 RTSpinlockRelease(pThis->hSpinlock); 155 155 156 156 if (fRc) … … 180 180 && !strcmp(pThis->szName, pszName)) 181 181 { 182 RTSpinlockRelease NoInts(pThis->hSpinlock);182 RTSpinlockRelease(pThis->hSpinlock); 183 183 return pThis; 184 184 } 185 RTSpinlockRelease NoInts(pThis->hSpinlock);185 RTSpinlockRelease(pThis->hSpinlock); 186 186 } 187 187 return NULL; … … 349 349 vboxNetAdpBusy(pThis); 350 350 } 351 RTSpinlockRelease NoInts(pThis->hSpinlock);351 RTSpinlockRelease(pThis->hSpinlock); 352 352 Log(("vboxNetAdpPrepareToReceive: fCanReceive=%d.\n", fCanReceive)); 353 353 … … 413 413 if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Active) 414 414 { 415 RTSpinlockRelease NoInts(pThis->hSpinlock);415 RTSpinlockRelease(pThis->hSpinlock); 416 416 Log(("vboxNetAdpReceive: Dropping incoming packet for inactive interface %s.\n", 417 417 pThis->szName)); … … 420 420 vboxNetAdpRetain(pThis); 421 421 vboxNetAdpBusy(pThis); 422 RTSpinlockRelease NoInts(pThis->hSpinlock);422 RTSpinlockRelease(pThis->hSpinlock); 423 423 424 424 rc = vboxNetAdpPortOsXmit(pThis, pSG, fDst); … … 515 515 } 516 516 517 RTSpinlockRelease NoInts(pThis->hSpinlock);517 RTSpinlockRelease(pThis->hSpinlock); 518 518 Log(("vboxNetAdpPortSetActive: state after: %RTbool.\n", vboxNetAdpGetState(pThis))); 519 519 return fPreviouslyActive; … … 546 546 Assert(!pThis->cBusy); 547 547 vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional); 548 RTSpinlockRelease NoInts(pThis->hSpinlock);548 RTSpinlockRelease(pThis->hSpinlock); 549 549 550 550 vboxNetAdpOsDisconnectIt(pThis); … … 553 553 RTSpinlockAcquire(pThis->hSpinlock); 554 554 vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available); 555 RTSpinlockRelease NoInts(pThis->hSpinlock);555 RTSpinlockRelease(pThis->hSpinlock); 556 556 557 557 vboxNetAdpRelease(pThis); … … 601 601 RTSpinlockAcquire(pThis->hSpinlock); 602 602 vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available); 603 RTSpinlockRelease NoInts(pThis->hSpinlock);603 RTSpinlockRelease(pThis->hSpinlock); 604 604 return rc; 605 605 } … … 617 617 if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Available || pThis->cBusy) 618 618 { 619 RTSpinlockRelease NoInts(pThis->hSpinlock);619 RTSpinlockRelease(pThis->hSpinlock); 620 620 return VERR_INTNET_FLT_IF_BUSY; 621 621 } 622 622 vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional); 623 RTSpinlockRelease NoInts(pThis->hSpinlock);623 RTSpinlockRelease(pThis->hSpinlock); 624 624 vboxNetAdpRelease(pThis); 625 625 … … 628 628 RTSpinlockAcquire(pThis->hSpinlock); 629 629 vboxNetAdpSetState(pThis, kVBoxNetAdpState_Invalid); 630 RTSpinlockRelease NoInts(pThis->hSpinlock);630 RTSpinlockRelease(pThis->hSpinlock); 631 631 632 632 return rc; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c
r52394 r52618 5 5 6 6 /* 7 * Copyright (C) 2008-201 2Oracle Corporation7 * Copyright (C) 2008-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 404 404 ASMAtomicWriteBool(&pThis->fRediscoveryPending, true); 405 405 406 RTSpinlockRelease NoInts(pThis->hSpinlock);406 RTSpinlockRelease(pThis->hSpinlock); 407 407 408 408 /* … … 517 517 if (enmOldTrunkState != enmState) 518 518 ASMAtomicWriteU32((uint32_t volatile *)&pThis->enmTrunkState, enmState); 519 RTSpinlockRelease NoInts(pThis->hSpinlock);519 RTSpinlockRelease(pThis->hSpinlock); 520 520 521 521 /* … … 622 622 RTSpinlockAcquire(pThis->hSpinlock); 623 623 vboxNetFltSetState(pThis, kVBoxNetFltInsState_Disconnecting); 624 RTSpinlockRelease NoInts(pThis->hSpinlock);624 RTSpinlockRelease(pThis->hSpinlock); 625 625 626 626 vboxNetFltOsDisconnectIt(pThis); … … 630 630 RTSpinlockAcquire(pThis->hSpinlock); 631 631 vboxNetFltSetState(pThis, kVBoxNetFltInsState_Unconnected); 632 RTSpinlockRelease NoInts(pThis->hSpinlock);632 RTSpinlockRelease(pThis->hSpinlock); 633 633 #endif 634 634 … … 850 850 AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs); 851 851 } 852 RTSpinlockRelease NoInts(pThis->hSpinlock);852 RTSpinlockRelease(pThis->hSpinlock); 853 853 854 854 return fRc; … … 897 897 AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs); 898 898 } 899 RTSpinlockRelease NoInts(pThis->hSpinlock);899 RTSpinlockRelease(pThis->hSpinlock); 900 900 901 901 return fRc; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
r50762 r52618 319 319 ifnet_reference(pIfNet); 320 320 } 321 RTSpinlockRelease NoInts(pThis->hSpinlock);321 RTSpinlockRelease(pThis->hSpinlock); 322 322 323 323 return pIfNet; … … 749 749 ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true); 750 750 751 RTSpinlockRelease NoInts(pThis->hSpinlock);751 RTSpinlockRelease(pThis->hSpinlock); 752 752 753 753 if (pIfNet) … … 1031 1031 RTSpinlockAcquire(pThis->hSpinlock); 1032 1032 ASMAtomicUoWritePtr(&pThis->u.s.pIfNet, pIfNet); 1033 RTSpinlockRelease NoInts(pThis->hSpinlock);1033 RTSpinlockRelease(pThis->hSpinlock); 1034 1034 1035 1035 /* Adjust g_offIfNetPCount as it varies for different versions of xnu. */ … … 1069 1069 pIfNet = NULL; /* don't dereference it */ 1070 1070 } 1071 RTSpinlockRelease NoInts(pThis->hSpinlock);1071 RTSpinlockRelease(pThis->hSpinlock); 1072 1072 1073 1073 /* Report capabilities. */ … … 1290 1290 if (pIfFilter) 1291 1291 ASMAtomicUoWriteNullPtr(&pThis->u.s.pIfFilter); 1292 RTSpinlockRelease NoInts(pThis->hSpinlock);1292 RTSpinlockRelease(pThis->hSpinlock); 1293 1293 1294 1294 if (pIfFilter) -
trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
r40912 r52618 609 609 TASK_INIT(&pThis->u.s.tskout, 0, vboxNetFltFreeBSDoutput, pThis); 610 610 611 RTSpinlockRelease NoInts(pThis->hSpinlock);611 RTSpinlockRelease(pThis->hSpinlock); 612 612 613 613 NG_NODE_SET_PRIVATE(node, pThis); -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r47484 r52618 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 406 406 ASMAtomicXchgPtr((void * volatile *)&pDev->hard_start_xmit, vboxNetFltLinuxStartXmitFilter); 407 407 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */ 408 RTSpinlockRelease NoInts(pThis->hSpinlock);408 RTSpinlockRelease(pThis->hSpinlock); 409 409 } 410 410 … … 442 442 else 443 443 pOverride = NULL; 444 RTSpinlockRelease NoInts(pThis->hSpinlock);444 RTSpinlockRelease(pThis->hSpinlock); 445 445 446 446 if (pOverride) … … 1465 1465 fFeatures = 0; 1466 1466 1467 RTSpinlockRelease NoInts(pThis->hSpinlock);1467 RTSpinlockRelease(pThis->hSpinlock); 1468 1468 1469 1469 if (pThis->pSwitchPort) … … 1579 1579 RTSpinlockAcquire(pThis->hSpinlock); 1580 1580 ASMAtomicUoWritePtr(&pThis->u.s.pDev, pDev); 1581 RTSpinlockRelease NoInts(pThis->hSpinlock);1581 RTSpinlockRelease(pThis->hSpinlock); 1582 1582 1583 1583 Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n", … … 1629 1629 pDev = NULL; /* don't dereference it */ 1630 1630 } 1631 RTSpinlockRelease NoInts(pThis->hSpinlock);1631 RTSpinlockRelease(pThis->hSpinlock); 1632 1632 1633 1633 /* … … 1654 1654 RTSpinlockAcquire(pThis->hSpinlock); 1655 1655 ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev); 1656 RTSpinlockRelease NoInts(pThis->hSpinlock);1656 RTSpinlockRelease(pThis->hSpinlock); 1657 1657 dev_put(pDev); 1658 1658 Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) released. ref=%d\n", … … 1693 1693 ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev); 1694 1694 } 1695 RTSpinlockRelease NoInts(pThis->hSpinlock);1695 RTSpinlockRelease(pThis->hSpinlock); 1696 1696 1697 1697 if (fRegistered) … … 2028 2028 pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *); 2029 2029 fRegistered = ASMAtomicXchgBool(&pThis->u.s.fRegistered, false); 2030 RTSpinlockRelease NoInts(pThis->hSpinlock);2030 RTSpinlockRelease(pThis->hSpinlock); 2031 2031 2032 2032 if (fRegistered) -
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r50664 r52618 5 5 6 6 /* 7 * Copyright (C) 2008-201 2Oracle Corporation7 * Copyright (C) 2008-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1110 1110 const bool fActive = pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE; 1111 1111 vboxNetFltRetain(pThis, true /* fBusy */); 1112 RTSpinlockRelease NoInts(pThis->hSpinlock);1112 RTSpinlockRelease(pThis->hSpinlock); 1113 1113 1114 1114 vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp
r44529 r52618 5 5 */ 6 6 /* 7 * Copyright (C) 2011-201 2Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 143 143 vboxNetFltWinSetOpState(&pNetFlt->u.s.WinIf.MpState, kVBoxNetDevOpState_Deinitializing); 144 144 145 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);145 RTSpinlockRelease(pNetFlt->hSpinlock); 146 146 147 147 vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState); … … 518 518 || vboxNetFltWinGetPowerState(&pNetFlt->u.s.WinIf.MpState) > NdisDeviceStateD0) 519 519 { 520 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);520 RTSpinlockRelease(pNetFlt->hSpinlock); 521 521 *pStatus = NDIS_STATUS_FAILURE; 522 522 return 0; … … 527 527 { 528 528 pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED; 529 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);529 RTSpinlockRelease(pNetFlt->hSpinlock); 530 530 *pStatus = NDIS_STATUS_PENDING; 531 531 return VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED; … … 534 534 if (pNetFlt->u.s.WinIf.StateFlags.fStandBy) 535 535 { 536 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);536 RTSpinlockRelease(pNetFlt->hSpinlock); 537 537 *pStatus = NDIS_STATUS_FAILURE; 538 538 return 0; … … 541 541 pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS; 542 542 543 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);543 RTSpinlockRelease(pNetFlt->hSpinlock); 544 544 545 545 *pStatus = NDIS_STATUS_SUCCESS; -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp
r44529 r52618 5 5 */ 6 6 /* 7 * Copyright (C) 2011-201 2Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 176 176 /* mark the request as InProgress before posting it to RequestComplete */ 177 177 pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS; 178 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);178 RTSpinlockRelease(pNetFlt->hSpinlock); 179 179 vboxNetFltWinPtRequestComplete(pNetFlt, &pNetFlt->u.s.WinIf.PassDownRequest, NDIS_STATUS_FAILURE); 180 180 } 181 181 else 182 182 { 183 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);183 RTSpinlockRelease(pNetFlt->hSpinlock); 184 184 } 185 185 } … … 209 209 } 210 210 211 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);211 RTSpinlockRelease(pNetFlt->hSpinlock); 212 212 213 213 vboxNetFltWinPtRequestsWaitComplete(pNetFlt); … … 1401 1401 if (pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing) 1402 1402 { 1403 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);1403 RTSpinlockRelease(pNetFlt->hSpinlock); 1404 1404 Assert(0); 1405 1405 return false; … … 1407 1407 if (pNetFlt->u.s.WinIf.hBinding == NULL) 1408 1408 { 1409 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);1409 RTSpinlockRelease(pNetFlt->hSpinlock); 1410 1410 Assert(0); 1411 1411 return false; … … 1413 1413 1414 1414 pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing = TRUE; 1415 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);1415 RTSpinlockRelease(pNetFlt->hSpinlock); 1416 1416 1417 1417 NdisResetEvent(&pNetFlt->u.s.WinIf.OpenCloseEvent); … … 1444 1444 pNetFlt->u.s.WinIf.StateFlags.fStandBy = TRUE; 1445 1445 } 1446 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);1446 RTSpinlockRelease(pNetFlt->hSpinlock); 1447 1447 vboxNetFltWinPtRequestsWaitComplete(pNetFlt); 1448 1448 vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState); … … 1469 1469 { 1470 1470 pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS; 1471 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);1471 RTSpinlockRelease(pNetFlt->hSpinlock); 1472 1472 1473 1473 vboxNetFltWinMpRequestPost(pNetFlt); … … 1475 1475 else 1476 1476 { 1477 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);1477 RTSpinlockRelease(pNetFlt->hSpinlock); 1478 1478 } 1479 1479 } -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp
r44529 r52618 5 5 */ 6 6 /* 7 * Copyright (C) 2011-201 2Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1069 1069 pSG = pWorker->pSG; 1070 1070 pWorker->pSG = NULL; 1071 RTSpinlockRelease NoInts((pInstance)->hSpinlock);1071 RTSpinlockRelease((pInstance)->hSpinlock); 1072 1072 KeSetEvent(&pWorker->KillEvent, 0, FALSE); 1073 1073 … … 1083 1083 else 1084 1084 { 1085 RTSpinlockRelease NoInts((pInstance)->hSpinlock);1085 RTSpinlockRelease((pInstance)->hSpinlock); 1086 1086 } 1087 1087 } -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h
r49137 r52618 5 5 */ 6 6 /* 7 * Copyright (C) 2011-201 2Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 594 594 #endif 595 595 { 596 RTSpinlockRelease NoInts((pNetFlt)->hSpinlock);596 RTSpinlockRelease((pNetFlt)->hSpinlock); 597 597 *pbNetFltActive = false; 598 598 return false; … … 602 602 { 603 603 vboxNetFltWinReferenceModePassThru(pNetFlt); 604 RTSpinlockRelease NoInts((pNetFlt)->hSpinlock);604 RTSpinlockRelease((pNetFlt)->hSpinlock); 605 605 *pbNetFltActive = false; 606 606 return true; … … 609 609 vboxNetFltRetain((pNetFlt), true /* fBusy */); 610 610 vboxNetFltWinReferenceModeNetFlt(pNetFlt); 611 RTSpinlockRelease NoInts((pNetFlt)->hSpinlock);611 RTSpinlockRelease((pNetFlt)->hSpinlock); 612 612 613 613 *pbNetFltActive = true; … … 633 633 #endif 634 634 { 635 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);635 RTSpinlockRelease(pNetFlt->hSpinlock); 636 636 *pbNetFltActive = false; 637 637 return false; … … 642 642 vboxNetFltWinIncReferenceModePassThru(pNetFlt, v); 643 643 644 RTSpinlockRelease NoInts((pNetFlt)->hSpinlock);644 RTSpinlockRelease((pNetFlt)->hSpinlock); 645 645 *pbNetFltActive = false; 646 646 return true; … … 651 651 vboxNetFltWinIncReferenceModeNetFlt(pNetFlt, v); 652 652 653 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);653 RTSpinlockRelease(pNetFlt->hSpinlock); 654 654 655 655 /* we have marked it as busy, so can do the res references outside the lock */ … … 715 715 #endif 716 716 { 717 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);717 RTSpinlockRelease(pNetFlt->hSpinlock); 718 718 return true; 719 719 } 720 720 721 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);721 RTSpinlockRelease(pNetFlt->hSpinlock); 722 722 return false; 723 723 } … … 732 732 #endif 733 733 { 734 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);734 RTSpinlockRelease(pNetFlt->hSpinlock); 735 735 return true; 736 736 } 737 737 738 RTSpinlockRelease NoInts(pNetFlt->hSpinlock);738 RTSpinlockRelease(pNetFlt->hSpinlock); 739 739 return false; 740 740 } -
trunk/src/VBox/HostDrivers/VBoxPci/VBoxPci.c
r44529 r52618 5 5 6 6 /* 7 * Copyright (C) 2011-201 2Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 90 90 { 91 91 #ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS 92 RTSpinlockRelease NoInts(pThis->hSpinlock);92 RTSpinlockRelease(pThis->hSpinlock); 93 93 #else 94 94 RTSemFastMutexRelease(pThis->hFastMtx);
Note:
See TracChangeset
for help on using the changeset viewer.