|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [UNIKRAFT PATCH 2/2] plat/kvm/x86/tscclock: start from zero
All good.
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@xxxxxxxxx>
On Tue, Jun 23, 2020 at 9:36 AM Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx> wrote:
>
> The starting point of our monotonic clock is currently the initial value
> of the TSC, converted to nanoseconds.
>
> Start from zero instead: this allows for easier interpretation of
> timestamps in debug messages.
>
> Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx>
> ---
> plat/kvm/x86/tscclock.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/plat/kvm/x86/tscclock.c b/plat/kvm/x86/tscclock.c
> index e477088..bfe801c 100644
> --- a/plat/kvm/x86/tscclock.c
> +++ b/plat/kvm/x86/tscclock.c
> @@ -256,24 +256,29 @@ int tscclock_init(void)
> tsc_freq = (rdtsc() - tsc_base) * 10;
> }
>
> - uk_pr_info("Clock source: TSC, frequency estimate is %llu Hz\n",
> - (unsigned long long) tsc_freq);
> -
> /*
> * Calculate TSC scaling multiplier.
> *
> * (0.32) tsc_mult = UKARCH_NSEC_PER_SEC (32.32) / tsc_freq (32.0)
> *
> + * Warning, do not print anything between TSC calibration and the
> + * setting of tsc_mult: if CONFIG_LIBUKDEBUG_PRINT_TIME is enabled
> + * this will trigger a reset of tsc_base via tscclock_monotonic
> + * and delay the clock starting point.
> + *
> * FIXME: this will overflow with small TSC frequencies. We should
> * probably calculate the TSC shift dynamically like solo5/hvt does.
> */
> tsc_mult = (UKARCH_NSEC_PER_SEC << 32) / tsc_freq;
>
> + uk_pr_info("Clock source: TSC, frequency estimate is %llu Hz\n",
> + (unsigned long long) tsc_freq);
> +
> /*
> * Monotonic time begins at tsc_base (first read of TSC before
> * calibration).
> */
> - time_base = mul64_32(tsc_base, tsc_mult);
> + tscclock_monotonic();
>
> /*
> * Compute RTC epoch offset by subtracting monotonic time_base from
> RTC
> --
> 2.7.4
>
>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |