Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Tina Ruchandani <ruchandani.tina@gmail.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	linux-pci@vger.kernel.org, David Vrabel <david.vrabel@citrix.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [Y2038] [PATCH] xen/pcifront: Remove usage of struct timeval
Date: Mon, 11 May 2015 17:13:08 +0200	[thread overview]
Message-ID: <2563996.ZdytTnlWmN@wuerfel> (raw)
In-Reply-To: <20150511024448.GA2836@tinar>

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

      parent reply	other threads:[~2015-05-11 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  2:44 [PATCH] xen/pcifront: Remove usage of struct timeval Tina Ruchandani
2015-05-11 13:47 ` Konrad Rzeszutek Wilk
2015-05-11 15:13 ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2563996.ZdytTnlWmN@wuerfel \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=ruchandani.tina@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox