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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 4 Feb 2022 14:56:43 +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=hqXtvA8QT1El6gi/VOf+F8xHktquhDqteU2+BYDQISo=; b=B5kwYz5OdHFAFydQn3Nk0657ePZ8vjqcP2YweWhGm8c5HYiyQCGfu/m+mGbBgg0RjhOQCnj7+mEMILCRUpm+92O4xt2mKUfCjCVmhNGyqKtuMvxmLnuKqWlKAuCZy3FyaNzIx/JZOjLEnc290foFRzfLlCUP81Z69yAj4DBg6++2t5cJqrynSLSRFPNPmxDJ8bfAevfXV9m1zedY4WdziQ7EOy0csfHhU3e55EXRKG12gru+noO4R03aJ9IIp5jWn7bQgMYRX1z7lrUeGt8XF3nzG+q5l5Z3BGo83dilmnQkTsDyBjmcja0eikAYtjMI+AfOkfEUqIrz6ruFx2GHag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JsTR6wHSHp31wDxVapWvddP8JBPJqUD9c6n27atW9IWFQEevAB6keYGckNcEKdnR1br6NwZH6AotWbq37lmRlsYNq8pXcoCzbn8RSOEeNSZs+wbnvlr2eADMdIL2Xtz0634AcSpGVkA/lleYUWUqt5R4HmPTj9qfsK2/m6waZJhSvirbcxw5KsFgGqMjswKDNrR262qdejLd8lvBjwubEJATwWs7EPAYJbkWk5FBruIyI+xpR/iCyOhdsiZm6GeWRDkihahWQtuztLE2t2lZt9mWOVHNUxtU+zP0NIt94iWL6iUebpQu1cZSuR/S0zyVXd4R31KvoOx9iz5AaNc1Xw==
  • 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: Fri, 04 Feb 2022 13:56:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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).

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;




 


Rackspace

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