x86/time: use relative counts in calibration loops
authorJan Beulich <jbeulich@suse.com>
Tue, 25 Jan 2022 12:37:45 +0000 (13:37 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 25 Jan 2022 12:37:45 +0000 (13:37 +0100)
commit4774d06097e524913fbd4ffcea3307275c5215d1
treee6390d73979430a84bdf68b6b6d7455d9779ae3a
parent18d0f501596bd55412282aac3db1f0a349a68f50
x86/time: use relative counts in calibration loops

Looping until reaching/exceeding a certain value is error prone: If the
target value is close enough to the wrapping point, the loop may not
terminate at all. Switch to using delta values, which then allows to
fold the two loops each into just one.

Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
master date: 2022-01-13 14:30:18 +0100
xen/arch/x86/time.c