linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: x86@kernel.org, Linux PM Mailing List <linux-pm@vger.kernel.org>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 2/3] x86/umwait: Increase tpause and umwait quanta
Date: Mon,  6 Mar 2023 14:34:17 +0200	[thread overview]
Message-ID: <20230306123418.720679-3-dedekind1@gmail.com> (raw)
In-Reply-To: <20230306123418.720679-1-dedekind1@gmail.com>

From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

== Background ==

The 'umwait' and 'tpause' instructions both put the CPU in a low power
state while they wait.  They amount of time they wait is influenced by
an explicit deadline value passed in a register and an implicit value
written to an shared MSR (MSR_IA32_UMWAIT_CONTROL).

Existing 'tpause' users (udelay()) can tolerate a wide range of
MSR_IA32_UMWAIT_CONTROL MSR values.  The explicit deadline trumps the
MSR for short delays.  Longer delays will see extra wakeups, but no
functional issues.

== Problem ==

Extra wakeups mean extra power.  That translates into worse idle power
when 'umwait' gets used for idle.

== Solution ==

Increase MSR_IA32_UMWAIT_CONTROL by factor of 100 to decrease idle power
when using 'umwait'.  Make 'tpause' rely on its explicit deadline more
often and reduce the number of wakeups and save power during long delays.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 arch/x86/kernel/cpu/umwait.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/umwait.c b/arch/x86/kernel/cpu/umwait.c
index ec8064c0ae03..17c23173da0f 100644
--- a/arch/x86/kernel/cpu/umwait.c
+++ b/arch/x86/kernel/cpu/umwait.c
@@ -14,9 +14,9 @@
 
 /*
  * Cache IA32_UMWAIT_CONTROL MSR. This is a systemwide control. By default,
- * umwait max time is 100000 in TSC-quanta and C0.2 is enabled
+ * umwait max time is 10,000,000 in TSC-quanta and C0.2 is enabled.
  */
-static u32 umwait_control_cached = UMWAIT_CTRL_VAL(100000, UMWAIT_C02_ENABLE);
+static u32 umwait_control_cached = UMWAIT_CTRL_VAL(10000000, UMWAIT_C02_ENABLE);
 
 /*
  * Cache the original IA32_UMWAIT_CONTROL MSR value which is configured by
-- 
2.38.1


  parent reply	other threads:[~2023-03-06 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 12:34 [PATCH 0/3] Sapphire Rapids C0.x idle states support Artem Bityutskiy
2023-03-06 12:34 ` [PATCH 1/3] x86/mwait: Add support for idle via umwait Artem Bityutskiy
2023-03-06 14:55   ` Peter Zijlstra
2023-03-07 11:55     ` Rafael J. Wysocki
2023-03-08 12:35       ` Peter Zijlstra
2023-03-06 12:34 ` Artem Bityutskiy [this message]
2023-03-06 12:34 ` [PATCH 3/3] intel_idle: add C0.2 state for Sapphire Rapids Xeon Artem Bityutskiy
2023-03-06 15:32   ` Peter Zijlstra
2023-03-07 12:39     ` Rafael J. Wysocki
2023-03-08 12:32       ` Peter Zijlstra
2023-03-09  8:01         ` Artem Bityutskiy
2023-03-14 12:24           ` Peter Zijlstra
2023-03-17  8:42             ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230306123418.720679-3-dedekind1@gmail.com \
    --to=dedekind1@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).