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

Re: [PATCH 1/2] x86/time: use relative counts in calibration loops


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 13 Jan 2022 10:37:53 +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=xM+QfnSElr65gkmYPfZbeGLhJ/h9r8nonqYSF85w40o=; b=oaAbz4Nr1WF8w+ZstvZ7zZGKF0EMqvyq6bMIxgD2KlCkzkHDzpDWs1voAGL8+PipnUkeCaaOFmiQOJjcuM3DL3/lit+gNA4Y/JLJAyu7Z+3chEsapKEbN+d0FXem6ZCe8DSXYD7YwRyzaodNbqIq4LBIOKSn4y8mxJkGPuGUwuVtUdzslhvCd6LTXgt5PNugH+XvPUKiUHWJ6TI7oBu6xmOzZAab2E8jZWrqB+DELLrSgyVeDuceZ8MPZFeHZEvpYxoLHioNS2nfp6Ms3lYniHWt2q8RjtwhW846WQiDodPiAqj5PMx0NlSIcvki7ucAn8Y1rwLAkKxNwVNA2FBkiQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G3rRAz5QoIhAuTtbdgB7ZekU9vbtY4oe+C2FW5DiTgqaAUE3Ce6J3p+5PjBEUidR2kZ0mdgDkkoIQTkPHV6/q5dx1mosjJi1t/H0B9bgw6tU58VjMnsuymNajR4B+NajVJK8m+CBkihSpNyK2GnFArrqZ0HUIfScWxl9pVcKYjNaXlD2eL54pKZnlkDRSbPbdWY9xSB4WAipEmSCr08VJDwwehXx70DmA0s1U+38ZyKdfoedKIEAqTq8h+xarjzN2P3J2/xac0S/HsPUyaSZoZJriw3SCGembyrpvLtqBVR1Zwc6/WH9+whTkXbvrgClaT1yq00tkefKrpyacystfQ==
  • 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>
  • Delivery-date: Thu, 13 Jan 2022 09:38:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.01.2022 09:55, Jan Beulich wrote:
> @@ -504,11 +501,8 @@ static s64 __init init_pmtimer(struct pl
>  
>      count = inl(pmtmr_ioport) & mask;
>      start = rdtsc_ordered();
> -    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
> -    if ( target < count )
> -        while ( (inl(pmtmr_ioport) & mask) >= count )
> -            continue;
> -    while ( (inl(pmtmr_ioport) & mask) < target )
> +    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
> +    while ( (elapsed = (inl(pmtmr_ioport) & mask) - count) < target )

I think this is wrong, and instead needs to be

    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )

There no similar issue with HPET as there we always have full 32 bits
available.

Roger - you gave your R-b. If you agree, I'd like to retain that with
the fix in place. But I'm not going to commit either variant ahead of
hearing back from you.

Jan

>          continue;
>  
>      return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
> 
> 




 


Rackspace

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