>>> On 04.01.18 at 14:05, <wei.l...@citrix.com> wrote:
> Signed-off-by: Wei Liu <wei.l...@citrix.com>

Reviewed-by: Jan Beulich <jbeul...@suse.com>
with a suggestion on code structure:

> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -969,6 +969,36 @@ static unsigned long get_cmos_time(void)
>      return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
>  }
>  
> +static unsigned long noinline get_xen_wallclock_time(void)
> +{
> +#ifdef CONFIG_XEN_GUEST
> +    struct shared_info *sh_info = XEN_shared_info;
> +    uint32_t wc_version;
> +    uint64_t wc_sec;
> +
> +    do {
> +        wc_version = sh_info->wc_version & ~1;
> +        smp_rmb();
> +
> +        wc_sec  = sh_info->wc_sec;
> +        smp_rmb();
> +    } while ( wc_version != sh_info->wc_version );
> +
> +    return wc_sec + read_xen_timer() / 1000000000;

Why not move all of this ...

> +#else
> +    ASSERT_UNREACHABLE();
> +    return 0;
> +#endif
> +}
> +
> +static unsigned long get_wallclock_time(void)
> +{

... here:

#ifdef CONFIG_XEN_GUEST
    if ( xen_guest )
    {
        ...
        return wc_sec + read_xen_timer() / 1000000000;
    }
#endif

   return get_cmos_time();
}

avoiding one of these not very nice ASSERT_UNREACHABLE()?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to