x86/time: yield to hyperthreads after updating TSC during rendezvous
authorJan Beulich <jbeulich@suse.com>
Thu, 22 Apr 2021 11:26:26 +0000 (13:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 22 Apr 2021 11:26:26 +0000 (13:26 +0200)
Since we'd like the updates to be done as synchronously as possible,
make an attempt at yielding immediately after the TSC write.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/time.c

index e92365f5bda5df4d908b6d8966a3edef5e02f3ce..5578b7b3a2692ec2e1663f351bf031a2ab1bed33 100644 (file)
@@ -1708,7 +1708,14 @@ static void time_calibration_tsc_rendezvous(void *_r)
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
+            {
                 write_tsc(master_tsc);
+                /*
+                 * Try to give our hyperthread(s), if any, a chance to do
+                 * the same as instantly as possible.
+                 */
+                cpu_relax();
+            }
 
             while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
                 cpu_relax();
@@ -1730,7 +1737,14 @@ static void time_calibration_tsc_rendezvous(void *_r)
             }
 
             if ( i == 0 )
+            {
                 write_tsc(master_tsc);
+                /*
+                 * Try to give our hyperthread(s), if any, a chance to do
+                 * the same as instantly as possible.
+                 */
+                cpu_relax();
+            }
 
             atomic_inc(&r->semaphore);
             while ( atomic_read(&r->semaphore) > total_cpus )