Index: trunk/src/VBox/HostDrivers/Support/SUPDrv.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 54288)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 54290)
@@ -6012,5 +6012,5 @@
         RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
 
-    pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_Butchered;
+    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Butchered;
     RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
     OSDBGPRINT(("supdrvTscDeltaThreadButchered: %s. rc=%Rrc\n", rcFailed));
@@ -6037,12 +6037,12 @@
          * Switch on the current state.
          */
-        SUPDRVTSCDELTASTATE enmState;
+        SUPDRVTSCDELTATHREADSTATE enmState;
         RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
-        enmState = pDevExt->enmTscDeltaState;
+        enmState = pDevExt->enmTscDeltaThreadState;
         switch (enmState)
         {
-            case kSupDrvTscDeltaState_Creating:
-            {
-                pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_Listening;
+            case kTscDeltaThreadState_Creating:
+            {
+                pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Listening;
                 rc = RTSemEventSignal(pDevExt->hTscDeltaEvent);
                 if (RT_FAILURE(rc))
@@ -6051,5 +6051,5 @@
             }
 
-            case kSupDrvTscDeltaState_Listening:
+            case kTscDeltaThreadState_Listening:
             {
                 RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
@@ -6073,7 +6073,7 @@
             }
 
-            case kSupDrvTscDeltaState_WaitAndMeasure:
-            {
-                pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_Measuring;
+            case kTscDeltaThreadState_WaitAndMeasure:
+            {
+                pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Measuring;
                 rc = RTSemEventSignal(pDevExt->hTscDeltaEvent);
                 if (RT_FAILURE(rc))
@@ -6085,5 +6085,5 @@
             }
 
-            case kSupDrvTscDeltaState_Measuring:
+            case kTscDeltaThreadState_Measuring:
             {
                 cConsecutiveTimeouts = 0;
@@ -6117,6 +6117,6 @@
                 }
                 RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
-                if (pDevExt->enmTscDeltaState == kSupDrvTscDeltaState_Measuring)
-                    pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_Listening;
+                if (pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
+                    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Listening;
                 RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
                 Assert(rc != VERR_NOT_AVAILABLE);   /* VERR_NOT_AVAILABLE is used as the initial value. */
@@ -6125,9 +6125,9 @@
             }
 
-            case kSupDrvTscDeltaState_Terminating:
+            case kTscDeltaThreadState_Terminating:
                 RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
                 return VINF_SUCCESS;
 
-            case kSupDrvTscDeltaState_Butchered:
+            case kTscDeltaThreadState_Butchered:
             default:
                 return supdrvTscDeltaThreadButchered(pDevExt, true /* fSpinlockHeld */, "Invalid state", VERR_INVALID_STATE);
@@ -6149,5 +6149,6 @@
  * @param   enmNewState     The new state we're waiting for it to enter.
  */
-static int supdrvTscDeltaThreadWait(PSUPDRVDEVEXT pDevExt, SUPDRVTSCDELTASTATE enmCurState, SUPDRVTSCDELTASTATE enmNewState)
+static int supdrvTscDeltaThreadWait(PSUPDRVDEVEXT pDevExt, SUPDRVTSCDELTATHREADSTATE enmCurState,
+                                    SUPDRVTSCDELTATHREADSTATE enmNewState)
 {
     /*
@@ -6157,10 +6158,10 @@
     RTSemEventWait(pDevExt->hTscDeltaEvent, RT_MS_1SEC);
     RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
-    if (pDevExt->enmTscDeltaState == enmNewState)
+    if (pDevExt->enmTscDeltaThreadState == enmNewState)
     {
         RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
         rc = VINF_SUCCESS;
     }
-    else if (pDevExt->enmTscDeltaState == enmCurState)
+    else if (pDevExt->enmTscDeltaThreadState == enmCurState)
     {
         /*
@@ -6175,7 +6176,7 @@
              * Check the state whether we've succeeded.
              */
-            SUPDRVTSCDELTASTATE enmState;
+            SUPDRVTSCDELTATHREADSTATE enmState;
             RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
-            enmState = pDevExt->enmTscDeltaState;
+            enmState = pDevExt->enmTscDeltaThreadState;
             RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
             if (enmState == enmNewState)
@@ -6217,5 +6218,5 @@
     int rc;
     RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
-    pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_Terminating;
+    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Terminating;
     RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
     RTThreadUserSignal(pDevExt->hTscDeltaThread);
@@ -6259,5 +6260,5 @@
         if (RT_SUCCESS(rc))
         {
-            pDevExt->enmTscDeltaState   = kSupDrvTscDeltaState_Creating;
+            pDevExt->enmTscDeltaThreadState   = kTscDeltaThreadState_Creating;
             pDevExt->cMsTscDeltaTimeout = 1;
             RTCpuSetEmpty(&pDevExt->TscDeltaCpuSet);
@@ -6267,5 +6268,5 @@
             if (RT_SUCCESS(rc))
             {
-                rc = supdrvTscDeltaThreadWait(pDevExt, kSupDrvTscDeltaState_Creating, kSupDrvTscDeltaState_Listening);
+                rc = supdrvTscDeltaThreadWait(pDevExt, kTscDeltaThreadState_Creating, kTscDeltaThreadState_Listening);
                 if (RT_SUCCESS(rc))
                 {
@@ -7102,8 +7103,8 @@
         RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
         RTCpuSetAdd(&pDevExt->TscDeltaCpuSet, idCpu);
-        if (   pDevExt->enmTscDeltaState == kSupDrvTscDeltaState_Listening
-            || pDevExt->enmTscDeltaState == kSupDrvTscDeltaState_Measuring)
-        {
-            pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_WaitAndMeasure;
+        if (   pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Listening
+            || pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
+        {
+            pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_WaitAndMeasure;
         }
         RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
@@ -8348,8 +8349,8 @@
                 RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
                 RTCpuSetAdd(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->idCpu);
-                if (   pDevExt->enmTscDeltaState == kSupDrvTscDeltaState_Listening
-                    || pDevExt->enmTscDeltaState == kSupDrvTscDeltaState_Measuring)
+                if (   pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Listening
+                    || pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
                 {
-                    pDevExt->enmTscDeltaState = kSupDrvTscDeltaState_WaitAndMeasure;
+                    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_WaitAndMeasure;
                 }
                 RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
@@ -8357,4 +8358,27 @@
                 return VINF_SUCCESS;
             }
+
+            /*
+             * If a TSC-delta measurement request is already being serviced by the thread,
+             * wait 'cTries' times if a retry-timeout is provided, otherwise bail as busy.
+             */
+            while (cTries-- > 0)
+            {
+                SUPDRVTSCDELTATHREADSTATE enmState;
+                RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+                enmState = pDevExt->enmTscDeltaThreadState;
+                RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+
+                if (   enmState == kTscDeltaThreadState_Measuring
+                    || enmState == kTscDeltaThreadState_WaitAndMeasure)
+                {
+                    if (   !cTries
+                        || !cMsWaitRetry)
+                        return VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY;
+                    if (cMsWaitRetry)
+                        RTThreadSleep(cMsWaitRetry);
+                }
+            }
+            cTries = RT_MAX(pReq->u.In.cRetries + 1, 10);
 #endif
 
Index: trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h	(revision 54288)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h	(revision 54290)
@@ -231,5 +231,5 @@
 #endif
 
-#if 0
+#if 1
 /**  Use a dedicated kernel thread to service TSC-delta measurement requests.
  *   @todo Test on servers with many CPUs and sockets. */
@@ -247,25 +247,25 @@
  * TSC-delta measurement thread state machine.
  */
-typedef enum SUPDRVTSCDELTASTATE
+typedef enum SUPDRVTSCDELTATHREADSTATE
 {
     /** Uninitialized/invalid value. */
-    kSupDrvTscDeltaState_Invalid = 0,
+    kTscDeltaThreadState_Invalid = 0,
     /** The thread is being created. */
-    kSupDrvTscDeltaState_Creating,
+    kTscDeltaThreadState_Creating,
     /** The thread is listening for events. */
-    kSupDrvTscDeltaState_Listening,
+    kTscDeltaThreadState_Listening,
     /** The thread is sleeping before starting a measurement. */
-    kSupDrvTscDeltaState_WaitAndMeasure,
+    kTscDeltaThreadState_WaitAndMeasure,
     /** The thread is currently servicing a measurement request. */
-    kSupDrvTscDeltaState_Measuring,
+    kTscDeltaThreadState_Measuring,
     /** The thread is terminating. */
-    kSupDrvTscDeltaState_Terminating,
+    kTscDeltaThreadState_Terminating,
     /** The thread is butchered due to an unexpected error. */
-    kSupDrvTscDeltaState_Butchered,
+    kTscDeltaThreadState_Butchered,
     /** The thread is destroyed. */
-    kSupDrvTscDeltaState_Destroyed,
+    kTscDeltaThreadState_Destroyed,
     /** The usual 32-bit blowup hack. */
-    kSupDrvTscDeltaState_32BitHack = 0x7fffffff
-} SUPDRVTSCDELTASTATE;
+    kTscDeltaThreadState_32BitHack = 0x7fffffff
+} SUPDRVTSCDELTATHREADSTATE, *PSUPDRVTSCDELTATHREADSTATE;
 #endif
 
@@ -717,5 +717,5 @@
     /** @name TSC-delta measurement thread.
      *  @{ */
-    /** Spinlock protecting enmTscDeltaState. */
+    /** Spinlock protecting enmTscDeltaThreadState. */
     RTSPINLOCK                      hTscDeltaSpinlock;
     /** TSC-delta measurement thread. */
@@ -724,5 +724,5 @@
     RTSEMEVENT                      hTscDeltaEvent;
     /** The state of the TSC-delta measurement thread. */
-    SUPDRVTSCDELTASTATE             enmTscDeltaState;
+    SUPDRVTSCDELTATHREADSTATE       enmTscDeltaThreadState;
     /** Thread timeout time before rechecking state in ms. */
     RTMSINTERVAL                    cMsTscDeltaTimeout;
