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

Re: [Xen-devel] [Y2038] [PATCH] xen/pcifront: Remove usage of struct timeval



On Monday 11 May 2015 08:14:48 Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.

The patch looks correct to me, just two minor points:

> +       tv = ktime_get_real();
> +       ns_timeout = ktime_to_ns(tv) + 2 * (s64)NSEC_PER_SEC;

* We have a macro for doing this in one line, so you can just use

        ns_timeout = ktime_get_real_ns() + 2 * (s64)NSEC_PER_SEC;

* As the time is not stored anywhere and only used in a local function,
  using monotonic time instead of real time would slightly more appropriate,
  the only difference being the handling of a concurrent settimeofday()
  system call. That means calling ktime_get_ns() instead of ktime_get_real_ns().

        Arnd

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


 


Rackspace

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