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

Re: [PATCH] x86/Intel: don't log bogus frequency range on Core/Core2 processors


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 8 Feb 2022 09:54:52 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=JBjmfAf+XbdFvDrsmvH8uWVTnWzbPdjLuuvvrFFZOEM=; b=c5Yl+Um1qJPQ81NstBMgILhOdnigqACOeFMOdvrAjOSVzDYdIEQHqvzapyD6/xftulwS5dQFHclpiosHl2a4L0jqqF0BoEi6qsUtTZDMIeZQYWkooJkrerfQ3lnYYuyW7/UahNwsSRcbsyH/eqwEXz1fn3HCBtSl4BSBgWFU857BPItR1ai1jZ0643MeD01o472iCKNQSK4gfQQtMAcKTz+bajos6ttK1WFcsAs/cjsC78tma0+CuYM4g+8+eJ2ZVIm5KClf5Fk/WEmxQ+6/EMZ4PI8SBcnBFb/H8q6BzAXzVbOCB4JTmvitQSxNEErloJ92HAC+95uwZPNAfgPIhw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FH80tHKyRAGIl4iF8m+L3QkMUuEqVi/T0HxzghvsgeU8eUE+E3HaOKk+jr2Xr83NY/6G3t9aP98WgpS40TtjElxNW7Li7J4ourpUAVSTDl8ZD3Q3PEd5MmAlv/CQpnjaqIJWpHTGl82zor94YX6om2nBlmlPg6ugXRgYykWjQvsOrFrqVrF9/Zuag9Fo/Zi8RU6Zhw9RgwT9VI95n7gtPa+BaUQUqlWhXYq/ynbapiU9CnNPRojwedyo25btxX6a23fGOLmLeWz/QVn1jczwGIMnSxuNWqhNMZPo5Wt/S5BvnK/Uq1egwnTyt8US3hhtyLKy3Utzlprzn1IDRXI58g==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 08 Feb 2022 08:55:08 +0000
  • Ironport-data: A9a23:1MkFYK9tqgescJbtxXMwDrUDUnmTJUtcMsCJ2f8bNWPcYEJGY0x3m zYYWmyFOa2Ia2H3co8lb9iw8BhUu5KGn9ZnTVZpri08E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhFWeIdA970Ug5w7Rh0tYx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhP5 /p1mqfsFDwWFfP1g+QZCyJhHXBhaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcGh2hp3Z8eRJ4yY eIFcRNMTjneZScQHXY6V54shO6NiiPGJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tlaVo CfK8nr0BjkeNceD0nyV/3S0nOjNkCjnHoUIG9WQ9PRnnVmSzWw7EwANWB2wpvzRt6Klc4sBc QpOoHNo9PVsshzwJjXgY/GmiECrkSYzYIYNKNIRtjiWyq6M2D+XV3dRG1atd+canMMxQDUr0 HqAkNXoGSFjvdWpdJ6NyluHhWjsY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v0uNg19hsZRVKau4eqSySgmNKMgBKPwn/RWGXuZl7V8NNVxjCuppEitqoQ0JBoJDdBM q4ZoOfnRNjnLOR+CcJMC/9dY6JsJZTZdLZu4QXx2cGIdgutqnYbIoT+clhTwHo7kXh84UO3TNL i8WlntfcApcTkn8edxjPF/lLyL0phPieDj/DhTuH9t1MzlEgLI8OWzGID1E53UpWV2UJIAmpaA hgSlTnFzoOS/YEuHTJUrOPbY
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Feb 04, 2022 at 02:56:43PM +0100, Jan Beulich wrote:
> Models 0F and 17 don't have PLATFORM_INFO documented. While it exists on
> at least model 0F, the information there doesn't match the scheme used
> on newer models (I'm observing a range of 700 ... 600 MHz reported on a
> Xeon E5345).

Maybe it would be best to limit ourselves to the models that have the
MSR documented in the SDM?

> 
> Sadly the Enhanced Intel Core instance of the table entry is not self-
> consistent: The numeric description of the low 3 bits doesn't match the
> subsequent more textual description in some of the cases; I'm using the
> former here.
> 
> Include the older Core model 0E as well as the two other Core2 models,
> none of which have respective MSR tables in the SDM.
> 
> Fixes: f6b6517cd5db ("x86: retrieve and log CPU frequency information")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> While the SDM table for the two models lists FSB_FREQ, I'm afraid its
> information is of little use here: If anything it could serve as a
> reference for the frequency determined by calibrate_APIC_clock().
> ---
> RFC: I may want to rebase over Roger's addition of intel-family.h, but
>      first of all I wanted to see whether going this route is deemed
>      acceptable at all.
> 
> --- a/xen/arch/x86/cpu/intel.c
> +++ b/xen/arch/x86/cpu/intel.c
> @@ -435,6 +435,26 @@ static void intel_log_freq(const struct
>          if ( c->x86 == 6 )
>              switch ( c->x86_model )
>              {
> +                static const unsigned short core_factors[] =
> +                    { 26667, 13333, 20000, 16667, 33333, 10000, 40000 };
> +
> +            case 0x0e: /* Core */
> +            case 0x0f: case 0x16: case 0x17: case 0x1d: /* Core2 */
> +                /*
> +                 * PLATFORM_INFO, while not documented for these, appears to
> +                 * exist in at least some cases, but what it holds doesn't
> +                 * match the scheme used by newer CPUs.  At a guess, the min
> +                 * and max fields look to be reversed, while the scaling
> +                 * factor is encoded in FSB_FREQ.
> +                 */
> +                if ( min_ratio > max_ratio )
> +                    SWAP(min_ratio, max_ratio);
> +                if ( rdmsr_safe(MSR_FSB_FREQ, msrval) ||
> +                     (msrval &= 7) >= ARRAY_SIZE(core_factors) )
> +                    return;
> +                factor = core_factors[msrval];
> +                break;
> +
>              case 0x1a: case 0x1e: case 0x1f: case 0x2e: /* Nehalem */
>              case 0x25: case 0x2c: case 0x2f: /* Westmere */
>                  factor = 13333;

Seeing that the MSR is present on non documented models and has
unknown behavior we might want to further sanity check that min < max
before printing anything?

Thanks, Roger.



 


Rackspace

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