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

Re: [PATCH] x86/time: do not kill calibration timer on suspend


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 10 Apr 2026 10:22:15 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SWi+ptAh+iUNz/K24C8UzRI31s1G7n9n9MvYxXxLBQw=; b=FxS/bYiW34+v165wHA7Mm3XGutywsuN5mZAO3GAOtDWmYWS+ct2+phBjADSwrbGyOvGpQUSNoUCSZkTtumzv+5QoBrYW6vZqkR0MRKoWCeO5TmFL5jqXmMKDKkxhdfS1pLe1i6g9U2/hNx70D+QCztzAkb2qCXgTXwvMR+29oHwY3mGnIpLOOwp/g8vF3zoJFn6uJg5ZGjXnaqmlR814n5bKzogtIPn+f5w53qqdVqLfvktC1v/BRkVGqn/lagsuRZ+Ap3lKTo1wbvX/zFD7QG2r4EkDvqVgasUcMF9eWBoXp9o9hbN8lDbEosyoIEXjaf8weB+mqk65a0oPsFaGdQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hVvUCMUNanezrWEnY2/YIVMvTc1id7NFihIj6BeMfJ9s6GTcakUeoxQtU/altxO2x6iFSxb2ych+GEbvfU7mlLgPhTAhkI9B9kOJRHI6IStphJH3VRoxyMcd5PiKNUiIBTnRApVvwY0N7RhjiJM9wqxpWLb666pa2lykOjlGpYi4Z2iqurDvz+CVXuFTAaQzwEbt4LTNC0CNjPzAEFAPCpV897ZArTrnodDd1bZ1JrCDluITkZLBAQxVfObFfINypyts+juzIkxuaUmmaBLe8mRDifDEvUk9HPzKgtNbMnfuYQFAm0z086OvY0jCPpyYujj9CD741YIq5kqZuo6olw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 10 Apr 2026 09:22:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10/04/2026 9:55 am, Roger Pau Monne wrote:
> A killed timer will ignore further set_timer() calls, and hence won't be
> re-armed unless it's initialized again.  Use stop_timer() instead of
> kill_timer() in time_suspend(), so that the set_timer() call in
> time_resume() successfully re-arms the timer.  Otherwise time calibration
> is no longer scheduled (and executed) after resuming from S3 suspend.
>
> Fixes: 6d90db1a2ca1 ("x86: rendezvous-based local time calibration")
> Reported-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
>  xen/arch/x86/time.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
> index fed30a919d2c..4233ea507d40 100644
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -2728,7 +2728,7 @@ int time_suspend(void)
>      {
>          cmos_utc_offset = -get_wallclock_time();
>          cmos_utc_offset += get_sec();
> -        kill_timer(&calibration_timer);
> +        stop_timer(&calibration_timer);
>  
>          /* Sync platform timer stamps. */
>          platform_time_calibration();

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

This should definitely be stop timer and not kill timer.

However, the fact it "stops" drift after S3 really does concern me. 
There's clearly a different issue here which this is covering over.

The systems which we've been testing on all have ITSC so the TSC doesn't
drift.  Whether there's a step or not is a different question (I'd
expect firmware to arrange to avoid a step being seen), but a step would
not explain our symptoms.

Given it's only once a second, can we dump the scale/offset which the
rendezvous produced each time?

This feels suspiciously like we've gauged the frequency too fast, and
are relying on micro-fixes every second to keep time looking normal. 
(This is pure speculation; I don't any evidence).

~Andrew



 


Rackspace

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