Skip to contentSkip to conversation

thermal: intel: powerclamp: Remove dead code for target mwait value

PATCH Applied Srinivas Pandruvada 2 participants 2 messages Jan 18, 2024 – Jan 22, 2024 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: intel: powerclamp: Remove dead code for target mwait value

After conversion of this driver to use powercap idle_inject core, this driver doesn't use target_mwait value. So remove dead code.

---
Non urgent patch. For 6.9+ kernel.

 drivers/thermal/intel/intel_powerclamp.c | 32 ------------------------
 1 file changed, 32 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +0 -32
index 5ac5cb60bae6..bc6eb0dd66a4 100644
@@ -49,7 +49,6 @@
  */
 #define DEFAULT_DURATION_JIFFIES (6)
 
-static unsigned int target_mwait;
 static struct dentry *debug_dir;
 static bool poll_pkg_cstate_enable;
 
@@ -312,34 +311,6 @@ MODULE_PARM_DESC(window_size, "sliding window in number of clamping cycles\n"
 	"\twindow size results in slower response time but more smooth\n"
 	"\tclamping results. default to 2.");
 
-static void find_target_mwait(void)
-{
-	unsigned int eax, ebx, ecx, edx;
-	unsigned int highest_cstate = 0;
-	unsigned int highest_subcstate = 0;
-	int i;
-
-	if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
-		return;
-
-	cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
-
-	if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
-	    !(ecx & CPUID5_ECX_INTERRUPT_BREAK))
-		return;
-
-	edx >>= MWAIT_SUBSTATE_SIZE;
-	for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {
-		if (edx & MWAIT_SUBSTATE_MASK) {
-			highest_cstate = i;
-			highest_subcstate = edx & MWAIT_SUBSTATE_MASK;
-		}
-	}
-	target_mwait = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
-		(highest_subcstate - 1);
-
-}
-
 struct pkg_cstate_info {
 	bool skip;
 	int msr_index;
@@ -759,9 +730,6 @@ static int __init powerclamp_probe(void)
 		return -ENODEV;
 	}
 
-	/* find the deepest mwait value */
-	find_target_mwait();
-
 	return 0;
 }
 
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 59 lines · Srinivas Pandruvada

After conversion of this driver to use powercap idle_inject core, this driver doesn't use target_mwait value. So remove dead code.

---
Non urgent patch. For 6.9+ kernel.

 drivers/thermal/intel/intel_powerclamp.c | 32 ------------------------
 1 file changed, 32 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +0 -29
index 5ac5cb60bae6..bc6eb0dd66a4 100644
@@ -49,7 +49,6 @@
  */
 #define DEFAULT_DURATION_JIFFIES (6)
 
-static unsigned int target_mwait;
 static struct dentry *debug_dir;
 static bool poll_pkg_cstate_enable;
 
@@ -312,34 +311,6 @@ MODULE_PARM_DESC(window_size, "sliding window in number of clamping cycles\n"
        "\twindow size results in slower response time but more smooth\n"
        "\tclamping results. default to 2.");
 
-static void find_target_mwait(void)
-{
-       unsigned int eax, ebx, ecx, edx;
-       unsigned int highest_cstate = 0;
-       unsigned int highest_subcstate = 0;
-       int i;
-
-       if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
-               return;
-
-       cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
-
-       if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
-           !(ecx & CPUID5_ECX_INTERRUPT_BREAK))
-               return;
-
-       edx >>= MWAIT_SUBSTATE_SIZE;
-       for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {
-               if (edx & MWAIT_SUBSTATE_MASK) {
-                       highest_cstate = i;
-                       highest_subcstate = edx & MWAIT_SUBSTATE_MASK;
-               }
-       }
-       target_mwait = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
-               (highest_subcstate - 1);
-
-}
-
 struct pkg_cstate_info {
        bool skip;
        int msr_index;

drivers/thermal/intel/intel_powerclamp.c static int __init powerclamp_probe(void)

Quoted 10 lines
drivers/thermal/intel/intel_powerclamp.c +0 -4
@@ -759,9 +730,6 @@ static int __init powerclamp_probe(void)
                return -ENODEV;
        }
 
-       /* find the deepest mwait value */
-       find_target_mwait();
-
        return 0;
 }
 
--

Applied as 6.8-rc material, thanks!