mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] cpupower fixes update for Linux 7.0-rc4
@ 2026-03-06 20:44 Shuah Khan
  2026-03-09 17:47 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2026-03-06 20:44 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Shuah Khan, shuah, John B. Wyatt IV, John Kacur,
	Thomas Renninger, linux-kernel, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

Hi Rafael,

Please pull the following cpupower fixes update for Linux 7.0-rc4.

- Adds support for setting EPP via systemd service
- Fixes swapped power/energy unit labels
- Adds intel_pstate turbo boost support for Intel platforms

diff is attached. These aren't very critical. Please send them
when you send your next PR.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f:

   Linux 7.0-rc1 (2026-02-22 13:18:59 -0800)

are available in the Git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-7.0-rc4

for you to fetch changes up to 3817b1d34432d3d83a61576719570d04c341b7cd:

   cpupower: Add intel_pstate turbo boost support for Intel platforms (2026-03-03 11:18:53 -0700)

----------------------------------------------------------------
linux-cpupower-7.0-rc4

- Adds support for setting EPP via systemd service
- Fixes swapped power/energy unit labels
- Adds intel_pstate turbo boost support for Intel platforms

----------------------------------------------------------------
Jan Kiszka (1):
       cpupower: Add support for setting EPP via systemd service

Kaushlendra Kumar (1):
       cpupower: fix swapped power/energy unit labels

Zhang Rui (1):
       cpupower: Add intel_pstate turbo boost support for Intel platforms

  tools/power/cpupower/cpupower-service.conf   |  5 ++++
  tools/power/cpupower/cpupower.sh             |  6 ++++
  tools/power/cpupower/utils/cpupower-set.c    |  6 +++-
  tools/power/cpupower/utils/helpers/helpers.h |  5 +++-
  tools/power/cpupower/utils/helpers/misc.c    | 41 ++++++++++++++++++++++++++--
  tools/power/cpupower/utils/powercap-info.c   |  4 +--
  6 files changed, 61 insertions(+), 6 deletions(-)

----------------------------------------------------------------

[-- Attachment #2: linux-cpupower-7.0-rc4.diff --]
[-- Type: text/x-patch, Size: 5612 bytes --]

diff --git a/tools/power/cpupower/cpupower-service.conf b/tools/power/cpupower/cpupower-service.conf
index 02eabe8e3614..abbb46967565 100644
--- a/tools/power/cpupower/cpupower-service.conf
+++ b/tools/power/cpupower/cpupower-service.conf
@@ -30,3 +30,8 @@
 # its policy for the relative importance of performance versus energy savings to
 # the processor. See man CPUPOWER-SET(1) for additional details
 #PERF_BIAS=
+
+# Set the Energy Performance Preference
+# Available options can be read from
+# /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences
+#EPP=
diff --git a/tools/power/cpupower/cpupower.sh b/tools/power/cpupower/cpupower.sh
index a37dd4cfdb2b..6283e8bf275d 100644
--- a/tools/power/cpupower/cpupower.sh
+++ b/tools/power/cpupower/cpupower.sh
@@ -23,4 +23,10 @@ then
     cpupower set -b "$PERF_BIAS" > /dev/null || ESTATUS=1
 fi
 
+# apply Energy Performance Preference
+if test -n "$EPP"
+then
+    cpupower set -e "$EPP" > /dev/null || ESTATUS=1
+fi
+
 exit $ESTATUS
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index c2117e5650dd..550a942e72ce 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -124,7 +124,11 @@ int cmd_set(int argc, char **argv)
 	}
 
 	if (params.turbo_boost) {
-		ret = cpupower_set_turbo_boost(turbo_boost);
+		if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL)
+			ret = cpupower_set_intel_turbo_boost(turbo_boost);
+		else
+			ret = cpupower_set_generic_turbo_boost(turbo_boost);
+
 		if (ret)
 			fprintf(stderr, "Error setting turbo-boost\n");
 	}
diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h
index 82ea62bdf5a2..a3ad80b9c2c2 100644
--- a/tools/power/cpupower/utils/helpers/helpers.h
+++ b/tools/power/cpupower/utils/helpers/helpers.h
@@ -104,7 +104,7 @@ extern struct cpupower_cpu_info cpupower_cpu_info;
 /* cpuid and cpuinfo helpers  **************************/
 
 int cpufreq_has_generic_boost_support(bool *active);
-int cpupower_set_turbo_boost(int turbo_boost);
+int cpupower_set_generic_turbo_boost(int turbo_boost);
 
 /* X86 ONLY ****************************************/
 #if defined(__i386__) || defined(__x86_64__)
@@ -143,6 +143,7 @@ extern int decode_pstates(unsigned int cpu, int boost_states,
 
 int cpufreq_has_x86_boost_support(unsigned int cpu, int *support,
 				  int *active, int *states);
+int cpupower_set_intel_turbo_boost(int turbo_boost);
 
 /* AMD P-State stuff **************************/
 bool cpupower_amd_pstate_enabled(void);
@@ -189,6 +190,8 @@ static inline int cpupower_set_amd_pstate_mode(char *mode)
 static inline int cpufreq_has_x86_boost_support(unsigned int cpu, int *support,
 						int *active, int *states)
 { return -1; }
+static inline int cpupower_set_intel_turbo_boost(int turbo_boost)
+{ return -1; }
 
 static inline bool cpupower_amd_pstate_enabled(void)
 { return false; }
diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c
index 166dc1e470ea..eebfc79a4889 100644
--- a/tools/power/cpupower/utils/helpers/misc.c
+++ b/tools/power/cpupower/utils/helpers/misc.c
@@ -19,6 +19,9 @@ int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, int *active,
 {
 	int ret;
 	unsigned long long val;
+	char linebuf[MAX_LINE_LEN];
+	char path[SYSFS_PATH_MAX];
+	char *endp;
 
 	*support = *active = *states = 0;
 
@@ -42,8 +45,42 @@ int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, int *active,
 		}
 	} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) {
 		amd_pstate_boost_init(cpu, support, active);
-	} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA)
+	} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) {
 		*support = *active = 1;
+
+		snprintf(path, sizeof(path), PATH_TO_CPU "intel_pstate/no_turbo");
+
+		if (!is_valid_path(path))
+			return 0;
+
+		if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0)
+			return -1;
+
+		val = strtol(linebuf, &endp, 0);
+		if (endp == linebuf || errno == ERANGE)
+			return -1;
+
+		*active = !val;
+	}
+	return 0;
+}
+
+int cpupower_set_intel_turbo_boost(int turbo_boost)
+{
+	char path[SYSFS_PATH_MAX];
+	char linebuf[2] = {};
+
+	snprintf(path, sizeof(path), PATH_TO_CPU "intel_pstate/no_turbo");
+
+	/* Fallback to generic solution when intel_pstate driver not running */
+	if (!is_valid_path(path))
+		return cpupower_set_generic_turbo_boost(turbo_boost);
+
+	snprintf(linebuf, sizeof(linebuf), "%d", !turbo_boost);
+
+	if (cpupower_write_sysfs(path, linebuf, 2) <= 0)
+		return -1;
+
 	return 0;
 }
 
@@ -274,7 +311,7 @@ void print_speed(unsigned long speed, int no_rounding)
 	}
 }
 
-int cpupower_set_turbo_boost(int turbo_boost)
+int cpupower_set_generic_turbo_boost(int turbo_boost)
 {
 	char path[SYSFS_PATH_MAX];
 	char linebuf[2] = {};
diff --git a/tools/power/cpupower/utils/powercap-info.c b/tools/power/cpupower/utils/powercap-info.c
index 3ea4486f1a0e..e53033488218 100644
--- a/tools/power/cpupower/utils/powercap-info.c
+++ b/tools/power/cpupower/utils/powercap-info.c
@@ -38,11 +38,11 @@ static int powercap_print_one_zone(struct powercap_zone *zone)
 	printf(" (%s)\n", mode ? "enabled" : "disabled");
 
 	if (zone->has_power_uw)
-		printf(_("%sPower can be monitored in micro Jules\n"),
+		printf(_("%sPower can be monitored in micro Watts\n"),
 		       pr_prefix);
 
 	if (zone->has_energy_uj)
-		printf(_("%sPower can be monitored in micro Watts\n"),
+		printf(_("%sPower can be monitored in micro Jules\n"),
 		       pr_prefix);
 
 	printf("\n");

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [GIT PULL] cpupower fixes update for Linux 7.0-rc4
  2026-03-06 20:44 [GIT PULL] cpupower fixes update for Linux 7.0-rc4 Shuah Khan
@ 2026-03-09 17:47 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-03-09 17:47 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Rafael J. Wysocki, shuah, John B. Wyatt IV, John Kacur,
	Thomas Renninger, linux-kernel, linux-pm

Hi Shuah,

On Fri, Mar 6, 2026 at 9:44 PM Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> Hi Rafael,
>
> Please pull the following cpupower fixes update for Linux 7.0-rc4.
>
> - Adds support for setting EPP via systemd service
> - Fixes swapped power/energy unit labels
> - Adds intel_pstate turbo boost support for Intel platforms
>
> diff is attached. These aren't very critical. Please send them
> when you send your next PR.

Pulled and added to my linux-next branch, thanks!


> ----------------------------------------------------------------
> The following changes since commit 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f:
>
>    Linux 7.0-rc1 (2026-02-22 13:18:59 -0800)
>
> are available in the Git repository at:
>
>    git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-7.0-rc4
>
> for you to fetch changes up to 3817b1d34432d3d83a61576719570d04c341b7cd:
>
>    cpupower: Add intel_pstate turbo boost support for Intel platforms (2026-03-03 11:18:53 -0700)
>
> ----------------------------------------------------------------
> linux-cpupower-7.0-rc4
>
> - Adds support for setting EPP via systemd service
> - Fixes swapped power/energy unit labels
> - Adds intel_pstate turbo boost support for Intel platforms
>
> ----------------------------------------------------------------
> Jan Kiszka (1):
>        cpupower: Add support for setting EPP via systemd service
>
> Kaushlendra Kumar (1):
>        cpupower: fix swapped power/energy unit labels
>
> Zhang Rui (1):
>        cpupower: Add intel_pstate turbo boost support for Intel platforms
>
>   tools/power/cpupower/cpupower-service.conf   |  5 ++++
>   tools/power/cpupower/cpupower.sh             |  6 ++++
>   tools/power/cpupower/utils/cpupower-set.c    |  6 +++-
>   tools/power/cpupower/utils/helpers/helpers.h |  5 +++-
>   tools/power/cpupower/utils/helpers/misc.c    | 41 ++++++++++++++++++++++++++--
>   tools/power/cpupower/utils/powercap-info.c   |  4 +--
>   6 files changed, 61 insertions(+), 6 deletions(-)
>
> ----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-09 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-06 20:44 [GIT PULL] cpupower fixes update for Linux 7.0-rc4 Shuah Khan
2026-03-09 17:47 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®