public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] xen/arm: introduce xen_read_wallclock
Date: Thu, 05 Nov 2015 19:53:50 +0100	[thread overview]
Message-ID: <23850350.L7uJax1OoN@wuerfel> (raw)
In-Reply-To: <1446743385-12848-1-git-send-email-stefano.stabellini@eu.citrix.com>

On Thursday 05 November 2015 17:09:43 Stefano Stabellini wrote:
> Read the wallclock from the shared info page at boot time.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Please use the appropriate timespec64 based functions here,
we are in the process of converting all callers of struct timespec.

> ---
> +static void xen_read_wallclock(struct timespec *ts)
> +{
> +	u32 version;
> +	u64 delta;
> +	struct timespec now;
> +	struct shared_info *s = HYPERVISOR_shared_info;
> +	struct pvclock_wall_clock *wall_clock = &(s->wc);

pvclock_wall_clock has a 'u32 sec', so that suffers from
a potential overflow. We should try to avoid introducing that
on ARM, and instead have a 64-bit seconds based version,
or alternatively a 64-bit nanoseconds version (with no
extra seconds) that is also sufficient.

>  	struct vcpu_register_vcpu_info info;
> @@ -218,6 +246,7 @@ static int __init xen_guest_init(void)
>  	struct shared_info *shared_info_page = NULL;
>  	struct resource res;
>  	phys_addr_t grant_frames;
> +	struct timespec ts;
>  
>  	if (!xen_domain())
>  		return 0;
> @@ -291,6 +320,8 @@ static int __init xen_guest_init(void)
>  
>  	pv_time_ops.steal_clock = xen_stolen_accounting;
>  	static_key_slow_inc(&paravirt_steal_enabled);
> +	xen_read_wallclock(&ts);
> +	do_settimeofday(&ts);
>  

Once you can get a 64-bit time, call do_settimeofday64()
here.

	Arnd

  reply	other threads:[~2015-11-05 18:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 17:09 [PATCH 0/3] Xen wallclock on arm and arm64 Stefano Stabellini
2015-11-05 17:09 ` [PATCH 1/3] xen/arm: introduce xen_read_wallclock Stefano Stabellini
2015-11-05 18:53   ` Arnd Bergmann [this message]
2015-11-06 15:09     ` Stefano Stabellini
2015-11-06 15:56       ` Arnd Bergmann
2015-11-09 13:53         ` Stefano Stabellini
2015-11-09 16:16           ` Arnd Bergmann
2015-11-09 17:14             ` Stefano Stabellini
2015-11-09 20:42               ` Arnd Bergmann
2015-11-06 12:26   ` Mark Rutland
2015-11-06 14:34     ` Stefano Stabellini
2015-11-05 17:09 ` [PATCH 2/3] xen/arm: introduce HYPERVISOR_dom0_op on arm and arm64 Stefano Stabellini
2015-11-05 17:21   ` [Xen-devel] " Jan Beulich
2015-11-06 14:45     ` Stefano Stabellini
2015-11-05 17:09 ` [PATCH 3/3] xen/arm: set the system time in Xen via the XENPF_settime hypercall Stefano Stabellini
2015-11-05 17:45   ` [Xen-devel] " David Vrabel
2015-11-06 14:59     ` Stefano Stabellini
2015-11-05 18:58   ` Arnd Bergmann
2015-11-09 14:10     ` Stefano Stabellini
2015-11-09 16:10       ` Arnd Bergmann
2015-11-09 17:17         ` Stefano Stabellini
2015-11-09 17:42           ` Stefano Stabellini
2015-11-09 20:45             ` Arnd Bergmann

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=23850350.L7uJax1OoN@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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