Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix patch: fix kbl performance
- Loading branch information
1 parent
55702bf
commit c5b4f14
Showing
3 changed files
with
89 additions
and
87 deletions.
There are no files selected for viewing
168 changes: 85 additions & 83 deletions
168
kbl-ee-msr-setting.patch → ...ate-Disable-energy-efficiency-optim.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,85 @@ | ||
fix kbl performance | ||
|
||
There are complaints of performance issues, when busy workloads are | ||
executed on Kaby Lake desktop systems. Even 100% busy workload will not | ||
lead to max turbo frequency with default energy performance setting. | ||
|
||
The reason for this is that OEM's decided to turn on energy efficiency | ||
optimization feature. When this is enabled, an optimum energy efficient max | ||
P-State is calculated based on the current energy performance preference | ||
setting. This is good for performance/watt, but this will result in some | ||
loss of performance. | ||
|
||
This change disables this energy efficiency optimization feature for | ||
Kaby Lake desktop CPU models in HWP mode only as these systems tend to | ||
care more about performance than power. | ||
|
||
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | ||
--- | ||
drivers/cpufreq/intel_pstate.c | 30 ++++++++++++++++++++++++++++++ | ||
1 file changed, 30 insertions(+) | ||
|
||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c | ||
index efa7754..48592a9 100644 | ||
--- a/drivers/cpufreq/intel_pstate.c | ||
+++ b/drivers/cpufreq/intel_pstate.c | ||
@@ -1344,6 +1344,25 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) | ||
cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); | ||
} | ||
|
||
+#define MSR_IA32_POWER_CTL_BIT_EE 19 | ||
+ | ||
+/* Disable energy efficiency optimization */ | ||
+static void intel_pstate_disable_ee(int cpu) | ||
+{ | ||
+ u64 power_ctl; | ||
+ int ret; | ||
+ | ||
+ ret = rdmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, &power_ctl); | ||
+ if (ret) | ||
+ return; | ||
+ | ||
+ if (!(power_ctl & BIT(MSR_IA32_POWER_CTL_BIT_EE))) { | ||
+ pr_info("Disabling energy efficiency optimization %d\n", cpu); | ||
+ power_ctl |= BIT(MSR_IA32_POWER_CTL_BIT_EE); | ||
+ wrmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, power_ctl); | ||
+ } | ||
+} | ||
+ | ||
static int atom_get_min_pstate(void) | ||
{ | ||
u64 value; | ||
@@ -1980,6 +1999,11 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = { | ||
{} | ||
}; | ||
|
||
+static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = { | ||
+ ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, core_params), | ||
+ {} | ||
+}; | ||
+ | ||
static int intel_pstate_init_cpu(unsigned int cpunum) | ||
{ | ||
struct cpudata *cpu; | ||
@@ -2010,6 +2034,12 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | ||
cpu->cpu = cpunum; | ||
|
||
if (hwp_active) { | ||
+ const struct x86_cpu_id *id; | ||
+ | ||
+ id = x86_match_cpu(intel_pstate_cpu_ee_disable_ids); | ||
+ if (id) | ||
+ intel_pstate_disable_ee(cpunum); | ||
+ | ||
intel_pstate_hwp_enable(cpu); | ||
pid_params.sample_rate_ms = 50; | ||
pid_params.sample_rate_ns = 50 * NSEC_PER_MSEC; | ||
-- | ||
2.7.4 | ||
|
||
------------------------------------- | ||
linux-power-mgmt@eclists.intel.com | ||
https://eclists.intel.com/sympa/info/linux-power-mgmt | ||
Unsubscribe by sending email to sympa@eclists.intel.com with subject "Unsubscribe linux-power-mgmt" | ||
From 890d259c9a783e577775adef73c621416e321229 Mon Sep 17 00:00:00 2001 | ||
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | ||
Date: Wed, 1 Feb 2017 18:02:00 -0600 | ||
Subject: [PATCH] cpufreq: intel_pstate: Disable energy efficiency optimization | ||
|
||
fix kbl performance | ||
|
||
There are complaints of performance issues, when busy workloads are | ||
executed on Kaby Lake desktop systems. Even 100% busy workload will not | ||
lead to max turbo frequency with default energy performance setting. | ||
|
||
The reason for this is that OEM's decided to turn on energy efficiency | ||
optimization feature. When this is enabled, an optimum energy efficient max | ||
P-State is calculated based on the current energy performance preference | ||
setting. This is good for performance/watt, but this will result in some | ||
loss of performance. | ||
|
||
This change disables this energy efficiency optimization feature for | ||
Kaby Lake desktop CPU models in HWP mode only as these systems tend to | ||
care more about performance than power. | ||
|
||
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | ||
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> | ||
--- | ||
drivers/cpufreq/intel_pstate.c | 30 ++++++++++++++++++++++++++++++ | ||
1 file changed, 30 insertions(+) | ||
|
||
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c | ||
index 4737520ec823..9e7a5344220c 100644 | ||
--- a/drivers/cpufreq/intel_pstate.c | ||
+++ b/drivers/cpufreq/intel_pstate.c | ||
@@ -820,6 +820,25 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) | ||
wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); | ||
} | ||
|
||
+#define MSR_IA32_POWER_CTL_BIT_EE 19 | ||
+ | ||
+/* Disable energy efficiency optimization */ | ||
+static void intel_pstate_disable_ee(int cpu) | ||
+{ | ||
+ u64 power_ctl; | ||
+ int ret; | ||
+ | ||
+ ret = rdmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, &power_ctl); | ||
+ if (ret) | ||
+ return; | ||
+ | ||
+ if (!(power_ctl & BIT(MSR_IA32_POWER_CTL_BIT_EE))) { | ||
+ pr_info("Disabling energy efficiency optimization %d\n", cpu); | ||
+ power_ctl |= BIT(MSR_IA32_POWER_CTL_BIT_EE); | ||
+ wrmsrl_on_cpu(cpu, MSR_IA32_POWER_CTL, power_ctl); | ||
+ } | ||
+} | ||
+ | ||
static int atom_get_min_pstate(void) | ||
{ | ||
u64 value; | ||
@@ -1420,6 +1439,11 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = { | ||
{} | ||
}; | ||
|
||
+static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = { | ||
+ ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, core_params), | ||
+ {} | ||
+}; | ||
+ | ||
static int intel_pstate_init_cpu(unsigned int cpunum) | ||
{ | ||
struct cpudata *cpu; | ||
@@ -1435,6 +1459,12 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | ||
cpu->cpu = cpunum; | ||
|
||
if (hwp_active) { | ||
+ const struct x86_cpu_id *id; | ||
+ | ||
+ id = x86_match_cpu(intel_pstate_cpu_ee_disable_ids); | ||
+ if (id) | ||
+ intel_pstate_disable_ee(cpunum); | ||
+ | ||
intel_pstate_hwp_enable(cpu); | ||
pid_params.sample_rate_ms = 50; | ||
pid_params.sample_rate_ns = 50 * NSEC_PER_MSEC; | ||
-- | ||
2.11.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
303 | ||
305 |