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

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


  • To: David Vrabel <dvrabel@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Jan 2022 14:30: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=gpKfqx5aEEgF36yelLlI0u+lg4U2VNri6Kbi+HKlieE=; b=jfXdwNx/akJOEJpHS5ROq8D2St2xDt6WuAdhQNDL3bHq+bCgO7q+omXdN+DfaysgjQTwueb9Be0CCsqCBvJ0TVG3UAdx/mL/zN6ZOY57L+Zs0d5a1ZvRq+q+89TUkld5gRhi2W6WqZsskMgLuHCB6q0r5/aWSEO3xSUeBT2EKl0B6MAcGl06/8z8J0LmEIAbrfwHLwAFU4HRPftBVkHTwb1IeCcAAFr2M4P1OlNT63n6gkZsn4BWHiSXWx2+rTNZd8tbAoVFzS/UdDBrz1TmjS2YaEoG51mRmZHeRY4kweclPt3QHWqOvtldxLppm3xtM8BtDrAkelAax2echBty9w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+dznToF/+0U+4usy2LYRbT1Z85xXc3hYy04zuEzRKMG9ctqwnIcnFyjMxyiztcBeJAtC21SzTUSs9tIldTofzh3qANMol9ocHeJgato+3lwdq5Cerodd686CVLYVVWUfROgMqB0BN/vHQZyjzNgkwPvY16BRFmNgQ2M3z7xVCsMJCwSddVxtbd3cQeup9BPnUGc/y4DcrNIQI+gIBAlxqIFCVgKVWkpI52+OhV5KRmPOAfW7pEScnsjYcOugVuanFFtwMeSinvMG70lCbh7iGoD7yRU9axBegXZlfbb9SwF01JA4iJpNPb+DMDDJMBvcb2YGa8Mb5g0I8d8gigvpQ==
  • 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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 18 Jan 2022 13:30:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.01.2022 12:37, David Vrabel wrote:
> 
> 
> On 18/01/2022 08:50, Jan Beulich wrote:
>> 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).
> 
> Should Xen be continually or periodically recalibrating? Rather than 
> trying to get it perfect at the start of day?

I wouldn't call dealing with bad samples "getting it perfect". IOW I
think recalibrating later may be an option, but independent of what
I'm doing here.

> You may also be able to find inspiration from the design or 
> implementation of the Precision Time Protocol which has to similarly 
> filter out outliers due to transmission delays.

Thanks for the pointer.

Jan




 


Rackspace

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