mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Cc: y2038@lists.linaro.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Marcos Paulo de Souza" <marcos.souza.org@gmail.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"John Stultz" <john.stultz@linaro.org>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH] x86: convert x86_platform_ops to timespec64
Date: Fri, 13 Oct 2017 16:45:27 -0400	[thread overview]
Message-ID: <ae24f18e-9a48-b6c0-9073-95121a444b53@oracle.com> (raw)
In-Reply-To: <20171013183933.3757079-1-arnd@arndb.de>

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@arndb.de>
> ---
>  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@oracle.com>

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);
>  }
>

  reply	other threads:[~2017-10-13 20:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 18:37 Arnd Bergmann
2017-10-13 20:45 ` Boris Ostrovsky [this message]
2017-10-16  8:11   ` Arnd Bergmann
2017-10-16 12:08     ` Paolo Bonzini
2017-10-16 12:16       ` Arnd Bergmann
2017-10-16 12:21         ` Paolo Bonzini
2017-10-16  1:48 ` kbuild test robot

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=ae24f18e-9a48-b6c0-9073-95121a444b53@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=arnd@arndb.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=john.stultz@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcos.souza.org@gmail.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --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

all inboxes | Powered by JetHome®