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

Re: [PATCH] x86/time: further improve TSC / CPU freq calibration accuracy


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Jan 2022 09:50:21 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=42jnB9CDBgye4KjnlWYZmpwy6JCXdP80FMVvwpSacPs=; b=X2C0uy+Ev92NKo/czakNVH11OmdgSRaeOg+UTPJWeVx5hGFt+lwy4XYGb6Df/iiirhN8Xb90SDQp5TwLNfzLCqH0zjnlIUA4gxWT7JJbKCYWHrR85TnzKW68qb9UtTtF+GXqmW2XO7MzHh4ULvLKbUAYzvw9Nhkfw1tVAV1C3E9s/HcqtyLUfUqEy+0J6f/zAngRV5J2wQYX43hy12qlTQmj6LdH5+fFotypOKkj/l+6gT66rEWL7oydg6Jos4D5KPE7h9bD4fnOrxS8tI1zO8fFXMxe67vi3KXxOwl0xm8pd9hozY+8VRmVa4Hq1SDlowEdGyBugN/Kdo04ejukcA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VHqUsJVANspelGGFnij++cLKJx0Z01jtsoEQYUuQ4K8QXMRoqQTbWJcoREK1qhSIGgCkJoTLidevmIypCi9fvd1ez1ZAw3fgljw++sH6fHLe51t+Nd3R5CsaTRBTp8pBrBd4HBOUQBhjEwoYlM6hworRgjZafUE6k1kGj6jGYJ/UAmt0uUsKyjTGGors4hWvXt6A577FtdjHCese8opFF8c5Qgi6G7WIv88ouaA5Qv5l1X/GDguTCERaqYFYHgksSzEkRlb+iLKNzCDERgOSpBCW6ytPgwpaQA89A9253ttYZgd7uCBxPRQJ2zJEj+JcDazp58348aiYSU5WpbaQkA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 18 Jan 2022 08:50:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.01.2022 14:41, Jan Beulich wrote:
> Calibration logic assumes that the platform timer (HPET or ACPI PM
> timer) and the TSC are read at about the same time. This assumption may
> not hold when a long latency event (e.g. SMI or NMI) occurs between the
> two reads. Reduce the risk of reading uncorrelated values by doing at
> least four pairs of reads, using the tuple where the delta between the
> enclosing TSC reads was smallest. From the fourth iteration onwards bail
> if the new TSC delta isn't better (smaller) than the best earlier one.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

When running virtualized, scheduling in the host would also constitute
long latency events. I wonder whether, to compensate for that, we'd want
more than 3 "base" iterations, as I would expect scheduling events to
occur more frequently than e.g. SMI (and with a higher probability of
multiple ones occurring in close succession).

Jan




 


Rackspace

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