From: Jack Allister <jalliste@amazon.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<dave.hansen@linux.intel.com>, <hpa@zytor.com>,
<rafael@kernel.org>, <len.brown@intel.com>
Cc: Jack Allister <jalliste@amazon.com>,
Paul Durrant <pdurrant@amazon.com>, Jue Wang <juew@amazon.com>,
Usama Arif <usama.arif@bytedance.com>, <x86@kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: intel_epb: Add earlyparam option to keep bias at performance
Date: Mon, 4 Dec 2023 17:28:48 +0000 [thread overview]
Message-ID: <20231204172849.18753-1-jalliste@amazon.com> (raw)
There are certain scenarios where it may be intentional that the EPB was
set at to 0/ENERGY_PERF_BIAS_PERFORMANCE on kernel boot. For example, in
data centers a kexec/live-update of the kernel may be performed regularly.
Usually this live-update is time critical and defaulting of the bias back
to ENERGY_PERF_BIAS_NORMAL may actually be detrimental to the overall
update time if processors' time to ramp up/boost are affected.
This patch introduces a kernel command line "intel_epb_keep_performance"
which will leave the EPB at performance if during the restoration code path
it is detected as such.
Signed-off-by: Jack Allister <jalliste@amazon.com>
Cc: Paul Durrant <pdurrant@amazon.com>
Cc: Jue Wang <juew@amazon.com>
Cc: Usama Arif <usama.arif@bytedance.com>
---
arch/x86/kernel/cpu/intel_epb.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_epb.c b/arch/x86/kernel/cpu/intel_epb.c
index e4c3ba91321c..0c7dd092f723 100644
--- a/arch/x86/kernel/cpu/intel_epb.c
+++ b/arch/x86/kernel/cpu/intel_epb.c
@@ -50,7 +50,8 @@
* the OS will do that anyway. That sometimes is problematic, as it may cause
* the system battery to drain too fast, for example, so it is better to adjust
* it on CPU bring-up and if the initial EPB value for a given CPU is 0, the
- * kernel changes it to 6 ('normal').
+ * kernel changes it to 6 ('normal'). This however is overridable via
+ * intel_epb_keep_performance if required.
*/
static DEFINE_PER_CPU(u8, saved_epb);
@@ -75,6 +76,8 @@ static u8 energ_perf_values[] = {
[EPB_INDEX_POWERSAVE] = ENERGY_PERF_BIAS_POWERSAVE,
};
+static bool intel_epb_keep_performance __read_mostly;
+
static int intel_epb_save(void)
{
u64 epb;
@@ -107,8 +110,12 @@ static void intel_epb_restore(void)
*/
val = epb & EPB_MASK;
if (val == ENERGY_PERF_BIAS_PERFORMANCE) {
- val = energ_perf_values[EPB_INDEX_NORMAL];
- pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
+ if (!intel_epb_keep_performance) {
+ val = energ_perf_values[EPB_INDEX_NORMAL];
+ pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
+ } else {
+ pr_warn_once("ENERGY_PERF_BIAS: Kept at 'performance', no change\n");
+ }
}
}
wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val);
@@ -213,6 +220,12 @@ static const struct x86_cpu_id intel_epb_normal[] = {
{}
};
+static __init int intel_epb_keep_performance_setup(char *str)
+{
+ return kstrtobool(str, &intel_epb_keep_performance);
+}
+early_param("intel_epb_keep_performance", intel_epb_keep_performance_setup);
+
static __init int intel_epb_init(void)
{
const struct x86_cpu_id *id = x86_match_cpu(intel_epb_normal);
--
2.40.1
next reply other threads:[~2023-12-04 17:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 17:28 Jack Allister [this message]
2023-12-04 17:44 ` [PATCH] x86: intel_epb: Add earlyparam option to keep bias at performance Dave Hansen
2023-12-05 9:00 ` Durrant, Paul
2023-12-05 12:00 ` David Woodhouse
2023-12-05 12:12 ` Rafael J. Wysocki
2023-12-05 12:15 ` David Woodhouse
2023-12-05 12:31 ` Rafael J. Wysocki
2023-12-05 12:32 ` David Woodhouse
2023-12-05 12:43 ` Rafael J. Wysocki
2023-12-05 15:19 ` Dave Hansen
2023-12-05 15:27 ` Dave Hansen
2023-12-05 10:23 ` Jack Allister
2023-12-05 12:48 ` Rafael J. Wysocki
2023-12-05 13:13 ` Jack Allister
2023-12-05 13:23 ` [PATCH v3] " Jack Allister
2023-12-05 15:26 ` Dave Hansen
2023-12-05 13:30 ` [PATCH] " Rafael J. Wysocki
2023-12-05 15:14 ` [PATCH v4] " Jack Allister
2023-12-05 16:17 ` Dave Hansen
2024-01-02 14:46 ` Jack Allister
2024-01-02 15:09 ` Dave Hansen
2024-01-03 14:46 ` [PATCH v5] " Jack Allister
2024-01-03 15:17 ` Dave Hansen
2024-01-04 9:05 ` [PATCH v6] " Jack Allister
2024-01-04 9:22 ` Durrant, Paul
2024-01-03 15:18 ` [External] [PATCH v5] " Usama Arif
2024-01-04 9:00 ` Jack Allister
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=20231204172849.18753-1-jalliste@amazon.com \
--to=jalliste@amazon.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=hpa@zytor.com \
--cc=juew@amazon.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pdurrant@amazon.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
--cc=usama.arif@bytedance.com \
--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