x86/time: latch to-be-written TSC value early in rendezvous loop
authorJan Beulich <jbeulich@suse.com>
Thu, 22 Apr 2021 11:25:53 +0000 (13:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 22 Apr 2021 11:25:53 +0000 (13:25 +0200)
commit6ca022a1e16a3ad46ddb3f5fff48b69a434b1c21
treef78f41cf89abfdcfa45f768d27d718c0f00ec09f
parentaaa3eafb3ba8b544d19ca41cda1477640b22b8fc
x86/time: latch to-be-written TSC value early in rendezvous loop

To reduce latency on time_calibration_tsc_rendezvous()'s last loop
iteration, read the value to be written on the last iteration at the end
of the loop body (i.e. in particular at the end of the second to last
iteration).

On my single-socket 18-core Skylake system this reduces the average loop
exit time on CPU0 (from the TSC write on the last iteration to until
after the main loop) from around 32k cycles to around 29k (albeit the
values measured on separate runs vary quite significantly).

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