Index: trunk/src/VBox/HostDrivers/Support/SUPDrv.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 54322)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 54325)
@@ -6099,5 +6099,5 @@
                         PSUPGIPCPU pGipCpuWorker = &pGip->aCPUs[iCpu];
                         if (   pGipCpuWorker->i64TSCDelta == INT64_MAX
-                            && RTCpuSetIsMember(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet))
+                            && RTCpuSetIsMemberByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet))
                         {
                             rc |= supdrvMeasureTscDeltaOne(pDevExt, iCpu);
@@ -7526,27 +7526,32 @@
  *
  * @remarks Measuring TSC deltas between the CPUs is tricky because we need to
- *     read the TSC at exactly the same time on both the master and the worker
- *     CPUs. Due to DMA, bus arbitration, cache locality, contention, SMI,
- *     pipelining etc. there is no guaranteed way of doing this on x86 CPUs. We
- *     try to minimize the measurement error by computing the minimum read time
- *     of the compare statement in the worker by taking TSC measurements across
- *     it.
- *
- *     We ignore the first few runs of the loop in order to prime the cache.
- *     Also, be careful about using 'pause' instruction in critical busy-wait
- *     loops in this code - it can cause undesired behaviour with
- *     hyperthreading.
- *
- *     It must be noted that the computed minimum read time is mostly to
- *     eliminate huge deltas when the worker is too early and doesn't by itself
- *     help produce more accurate deltas. We allow two times the computed
- *     minimum as an arbibtrary acceptable threshold. Therefore, it is still
- *     possible to get negative deltas where there are none when the worker is
- *     earlier. As long as these occasional negative deltas are lower than the
- *     time it takes to exit guest-context and the OS to reschedule EMT on a
- *     different CPU we won't expose a TSC that jumped backwards. It is because
- *     of the existence of the negative deltas we don't recompute the delta with
- *     the master and worker interchanged to eliminate the remaining measurement
- *     error.
+ *          read the TSC at exactly the same time on both the master and the
+ *          worker CPUs. Due to DMA, bus arbitration, cache locality,
+ *          contention, SMI, pipelining etc. there is no guaranteed way of
+ *          doing this on x86 CPUs.
+ *
+ *          GIP_TSC_DELTA_METHOD_1:
+ *          We ignore the first few runs of the loop in order to prime the
+ *          cache. Also, we need to be careful about using 'pause' instruction
+ *          in critical busy-wait loops in this code - it can cause undesired
+ *          behaviour with hyperthreading.
+ *
+ *          We try to minimize the measurement error by computing the minimum
+ *          read time of the compare statement in the worker by taking TSC
+ *          measurements across it.
+ *
+ *          It must be noted that the computed minimum read time is mostly to
+ *          eliminate huge deltas when the worker is too early and doesn't by
+ *          itself help produce more accurate deltas. We allow two times the
+ *          computed minimum as an arbibtrary acceptable threshold. Therefore,
+ *          it is still possible to get negative deltas where there are none
+ *          when the worker is earlier. As long as these occasional negative
+ *          deltas are lower than the time it takes to exit guest-context and
+ *          the OS to reschedule EMT on a different CPU we won't expose a TSC
+ *          that jumped backwards. It is because of the existence of the
+ *          negative deltas we don't recompute the delta with the master and
+ *          worker interchanged to eliminate the remaining measurement error.
+ *
+ *          @todo document working of GIP_TSC_DELTA_METHOD_2.
  */
 static DECLCALLBACK(void) supdrvMeasureTscDeltaCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
@@ -7818,5 +7823,5 @@
  *                          CPUs.
  *
- * @remarks This can be called with preemption disabled!
+ * @remarks This must be called with preemption enabled!
  */
 static int supdrvMeasureTscDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker)
@@ -7832,4 +7837,5 @@
     AssertReturn(pGip, VERR_INVALID_PARAMETER);
     Assert(pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED);
+    Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
     /*
@@ -7885,5 +7891,5 @@
          * being executed and that can take a good while to be done.
          */
-        RTThreadSleep(1); /** @todo r=bird: This won't work with preemption disabled, not on real OSes anyway. */
+        RTThreadSleep(1);
     }
 
