Skip to content

Commit aaaece3

Browse files
spandruvadarafaeljw
authored andcommitted
cpufreq: intel_pstate: New sysfs entry to control HWP boost
A new attribute is added to intel_pstate sysfs to enable/disable HWP dynamic performance boost. Reported-by: Mel Gorman <[email protected]> Tested-by: Giovanni Gherdovich <[email protected]> Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 52ccc43 commit aaaece3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,30 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
10331033
return count;
10341034
}
10351035

1036+
static ssize_t show_hwp_dynamic_boost(struct kobject *kobj,
1037+
struct attribute *attr, char *buf)
1038+
{
1039+
return sprintf(buf, "%u\n", hwp_boost);
1040+
}
1041+
1042+
static ssize_t store_hwp_dynamic_boost(struct kobject *a, struct attribute *b,
1043+
const char *buf, size_t count)
1044+
{
1045+
unsigned int input;
1046+
int ret;
1047+
1048+
ret = kstrtouint(buf, 10, &input);
1049+
if (ret)
1050+
return ret;
1051+
1052+
mutex_lock(&intel_pstate_driver_lock);
1053+
hwp_boost = !!input;
1054+
intel_pstate_update_policies();
1055+
mutex_unlock(&intel_pstate_driver_lock);
1056+
1057+
return count;
1058+
}
1059+
10361060
show_one(max_perf_pct, max_perf_pct);
10371061
show_one(min_perf_pct, min_perf_pct);
10381062

@@ -1042,6 +1066,7 @@ define_one_global_rw(max_perf_pct);
10421066
define_one_global_rw(min_perf_pct);
10431067
define_one_global_ro(turbo_pct);
10441068
define_one_global_ro(num_pstates);
1069+
define_one_global_rw(hwp_dynamic_boost);
10451070

10461071
static struct attribute *intel_pstate_attributes[] = {
10471072
&status.attr,
@@ -1082,6 +1107,11 @@ static void __init intel_pstate_sysfs_expose_params(void)
10821107
rc = sysfs_create_file(intel_pstate_kobject, &min_perf_pct.attr);
10831108
WARN_ON(rc);
10841109

1110+
if (hwp_active) {
1111+
rc = sysfs_create_file(intel_pstate_kobject,
1112+
&hwp_dynamic_boost.attr);
1113+
WARN_ON(rc);
1114+
}
10851115
}
10861116
/************************** sysfs end ************************/
10871117

0 commit comments

Comments
 (0)