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

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


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 12 Jan 2022 12:32:59 +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=ZRtH3mRhSYg0S4bJGdHbVUkcwJZGWh4ljLRnbJYXOTM=; b=auXnnxMtjU/PrsQWJF1/JPpzHDuwDKefy76SB0gUPwn9IhzzVEC2Rxn8+EWLssk8zzCTNPq7ib4/LsDQVAxVHuDP/nDfGHXhGrlWqqS4RLNviSL/8WgGF/LYGtPRh1TSVyWLH6I1sDzzXifa9qPwCKYFYYGIg4IE8nagqrvOWGKgtvZMknaxNBd8x5rbPUy9ABzZQLpyJDfVlEKrHcqKeuUFoW+GAOfYfaEdcwFilX4AFGK9ADfFDHQL3g4eWgVqWuKSqYrBUVQXe17+dlnLXjqXIxFrXDgqbSY4oe+6Km514AbBNCh9lKkyoxZAWziX/4r7TOH3TAoGvrwcjdMzvg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=moAFYyLhTL3rbAyTRwLW/I0sxCLujoe3iGJCIdh0VSZGK+pV+mWljluFIxSjSz4ZVbIgwO1z+7KnzRxGg7KITk6v/DSmJoYn9R+oR4nBCPQOeQS/Qz8PqH/r4AqHPdW50IFJBPzWylX2/1WUQiDH/qR76SGflu64rsmM6nICRKBZ//kGaViqtZIgve3e7v3AcrLSRD+fubOz0rKvUqa+73dBavTb6Xw5U1H7FMo98CU+RyNKkG12snW4QnWLlrE2QnkaypvCANKtVkQQKFqEEwS8H2r6JwDbMADuhxpdq8hfZ10S1zmNIhi5hI2axmG4iNY3iQANQLBHdOQcZq/VaA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 12 Jan 2022 11:33:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.01.2022 11:53, Roger Pau Monné wrote:
> On Wed, Jan 12, 2022 at 09:56:12AM +0100, Jan Beulich wrote:
>> While the problem report was for extreme errors, even smaller ones would
>> better be avoided: The calculated period to run calibration loops over
>> can (and usually will) be shorter than the actual time elapsed between
>> first and last platform timer and TSC reads. Adjust values returned from
>> the init functions accordingly.
>>
>> On a Skylake system I've tested this on accuracy (using HPET) went from
>> detecting in some cases more than 220kHz too high a value to about
>> ±2kHz. On other systems (or on this system, but with PMTMR) the original
>> error range was much smaller, with less (in some cases only very little)
>> improvement.
>>
>> Reported-by: James Dingwall <james-xen@xxxxxxxxxxxxxx>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks.

>> I'm afraid I don't see a way to deal with the same issue in init_pit().
>> In particular the (multiple) specs I have to hand don't make clear
>> whether the counter would continue counting after having reached zero.
>> Obviously it wouldn't help to check this on a few systems, as their
>> behavior could still be implementation specific.
> 
> We could likely set the counter to the maximum value it can hold
> and then perform reads in a loop (like it's done for HPET or the PM
> timers) and stop when start - target is reached. Not a great solution
> either.

Not the least because reading back the counter from the PIT requires
multiple port operations, i.e. is overall quite a bit slower.

Jan




 


Rackspace

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