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

[PATCH v2 2/2] x86/mwait-idle: add core C6 optimization for SPR


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 2 Jun 2022 12:27:07 +0200
  • 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=hOkAYeO56s7DN3Ugv7AOWjHMw56rkbVwFSJU6mwMhW8=; b=crdzozB4sXO0+TAH3Yg1CWbQMaYLiVo1Z1y+/G/WObSjZFMuBAptCtnf5Hxzu/mA1hrJDtTac7bGK3JRdzjNEA2B56cl3o06GH3AgvflyjZdqNpT+sYVAP8HYmPk8l1nOfaNiOXWsv6N/H2AajLsDJqF+s169YL+HQxSyi73BLdQlkolOWG+vxB80yu4v+b8HJdyXNWpUKQBGjRGFqaSwmorRkYlhJQqjmZa3KuyuyXMg8xJ0DtFWX5hGuCKgCbs9mNeN1cP6xsthtEkr4Bdlbiw0AVYYxiz6c07Ds5TAAqESAgcch/86G2ArSatb1dl3vlhZTGpicBoxwBjQTeKTg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZB87gY55xfno4q7V9873D5mGVVn8NPC4TTkDayZsQZWuW198JNtndCAJYSbbD8T3rRmUZaBmdSUwetJDzX4s1SzyErmUpnxU7dgydd8rpTQIHEHKRSnMj29BKyx19EH152eHL2WnpCmVHEzdU0pXLpwx5gn3sjbhNz2UHXUIvQGYjnsEqAABUjNM8lFdQ0d0ALHRT5w105crZqP+oUhwAIVcAwOHZaApsIa0aCbrZXKFCfK20fXX7zZTy3Ka5UWNOWTFtrM4xEvCpLwR5hRtvlmWLRFKqoT/uVyD5AcJY/TxMlrfd5RDNoG+/rdJTWhW6qq7QLlfa+ptu1t6/Rjy1g==
  • 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: Thu, 02 Jun 2022 10:27:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>

Add a Sapphire Rapids Xeon C6 optimization, similar to what we have for Sky Lake
Xeon: if package C6 is disabled, adjust C6 exit latency and target residency to
match core C6 values, instead of using the default package C6 values.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@xxxxxxxxxxxxxxx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
3a9cf77b60dc

Make sure a contradictory "preferred-cstates" wouldn't cause bypassing
of the added logic.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
v2: Sync with the Linux side fix to the noticed issue. Re-base over
    change to earlier patch.

--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -1273,18 +1273,31 @@ static void __init skx_idle_state_table_
  */
 static void __init spr_idle_state_table_update(void)
 {
-       /* Check if user prefers C1E over C1. */
-       if (preferred_states_mask & BIT(2, U)) {
-               if (preferred_states_mask & BIT(1, U))
-                       /* Both can't be enabled, stick to the defaults. */
-                       return;
+       uint64_t msr;
 
+       /* Check if user prefers C1E over C1. */
+       if (preferred_states_mask & BIT(2, U) &&
+           !(preferred_states_mask & BIT(1, U))) {
+               /* Disable C1 and enable C1E. */
                spr_cstates[0].flags |= CPUIDLE_FLAG_DISABLED;
                spr_cstates[1].flags &= ~CPUIDLE_FLAG_DISABLED;
 
                /* Request enabling C1E using the "C1E promotion" bit. */
                idle_cpu_spr.c1e_promotion = C1E_PROMOTION_ENABLE;
        }
+
+       /*
+        * By default, the C6 state assumes the worst-case scenario of package
+        * C6. However, if PC6 is disabled, we update the numbers to match
+        * core C6.
+        */
+       rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr);
+
+       /* Limit value 2 and above allow for PC6. */
+       if ((msr & 0x7) < 2) {
+               spr_cstates[2].exit_latency = 190;
+               spr_cstates[2].target_residency = 600;
+       }
 }
 
 /*




 


Rackspace

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