[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86: convert x86_platform_ops to timespec64



On 10/13/2017 02:37 PM, Arnd Bergmann wrote:
> The x86 platform operations are fairly isolated, so we can
> change them from using timespec to timespec64. I checked that
> All the users and callers are safe, and there is only one
> critical function that is broken beyond 2106:
>
> pvclock_read_wallclock() uses a 32-bit number of seconds since
> the epoch to communicate the boot time between host and guest
> in a virtual environment. This will work until 2106, but we
> should ideally find a replacement anyway. I've added a comment
> about it there.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
>  arch/x86/include/asm/intel_mid_vrtc.h        |  4 ++--
>  arch/x86/include/asm/mc146818rtc.h           |  4 ++--
>  arch/x86/include/asm/pvclock.h               |  2 +-
>  arch/x86/include/asm/x86_init.h              |  6 +++---
>  arch/x86/kernel/kvmclock.c                   |  4 ++--
>  arch/x86/kernel/pvclock.c                    | 12 +++++++++---
>  arch/x86/kernel/rtc.c                        | 16 ++++++++--------
>  arch/x86/platform/intel-mid/intel_mid_vrtc.c | 10 +++++-----
>  arch/x86/xen/time.c                          | 10 +++++-----
>  9 files changed, 37 insertions(+), 31 deletions(-)

Xen bits:
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

with a couple of nits:

> @@ -136,11 +136,17 @@ void pvclock_read_wallclock(struct pvclock_wall_clock 
> *wall_clock,
>               rmb();          /* fetch time before checking version */
>       } while ((wall_clock->version & 1) || (version != wall_clock->version));
>  
> +     /*
> +      * Note: wall_clock->sec is a u32 value, so it can only store dates
> +      * between 1970 and 2106. To allow times beyond that, we need to
> +      * create a new hypercall interface with an extended pvclock_wall_clock
> +      * structure like ARM has.
> +      */

I think this comment block should be moved up above 'now.tv_sec  =
wall_clock->sec;'


>       delta = pvclock_clocksource_read(vcpu_time);    /* time since system 
> boot */
>       delta += now.tv_sec * (u64)NSEC_PER_SEC + now.tv_nsec;

Now that tv_sec is a 64-bit quantity the cast can be dropped.

-boris

>  
>       now.tv_nsec = do_div(delta, NSEC_PER_SEC);
>       now.tv_sec = delta;
>  
> -     set_normalized_timespec(ts, now.tv_sec, now.tv_nsec);
> +     set_normalized_timespec64(ts, now.tv_sec, now.tv_nsec);
>  }
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.