lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51A5CEF9.3050802@citrix.com>
Date:	Wed, 29 May 2013 10:48:41 +0100
From:	David Vrabel <david.vrabel@...rix.com>
To:	Jan Beulich <JBeulich@...e.com>
CC:	John Stultz <john.stultz@...aro.org>, <xen-devel@...ts.xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [Xen-devel] [PATCH 2/2] x86/xen: sync the wallclock when the
 system time changes

On 29/05/13 08:39, Jan Beulich wrote:
>>>> On 28.05.13 at 20:22, David Vrabel <david.vrabel@...rix.com> wrote:
>> +static int xen_pvclock_gtod_notify(struct notifier_block *nb, unsigned long unused,
>> +				   void *priv)
>> +{
>> +	static struct timespec last, next;
>> +	struct timespec now;
>> +	struct timekeeper *tk = priv;
>> +	struct xen_platform_op op;
>> +	int ret;
>> +
>> +	/*
>> +	 * Set the Xen wallclock from Linux system time.
>> +	 *
>> +	 * dom0 hasn't historically maintained a very accurate
>> +	 * wallclock so guests don't expect it. We can therefore
>> +	 * reduce the number of expensive hypercalls by only updating
>> +	 * the wallclock every 0.5 s.
>> +	 */
>> +
>> +	now.tv_sec = tk->xtime_sec;
>> +	now.tv_nsec = tk->xtime_nsec >> tk->shift;
>> +
>> +	if (timespec_compare(&now, &last) > 0
>> +	    && timespec_compare(&now, &next) < 0)
> 
> Is this really working the first time through (when both last and
> next are still all zeros)?

Yes. The first time through we want to set the wallclock and this test
is always false when last == next.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ