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

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

Hi Rafael,

Please pull the following cpupower update for Linux 6.20-rc1.

Fixes to miscellaneous problems in cpupower tool:

- idle_monitor: fix incorrect value logged after stop
- Fix inverted APERF capability check
- Use strcspn() to strip trailing newline
- Reset errno before strtoull()
- Show C0 in idle-info dump

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit 8f0b4cce4481fb22653697cced8d0d04027cb1e8:

   Linux 6.19-rc1 (2025-12-14 16:05:07 +1200)

are available in the Git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.20-rc1

for you to fetch changes up to ff72619e11348ab189e232c59515dd5c33780d7c:

   tools/power cpupower: Show C0 in idle-info dump (2025-12-15 12:33:29 -0700)

----------------------------------------------------------------
cpupower update for Linux 6.20-rc1

Fixes to miscellaneous problems in cpupower tool:

- idle_monitor: fix incorrect value logged after stop
- Fix inverted APERF capability check
- Use strcspn() to strip trailing newline
- Reset errno before strtoull()
- Show C0 in idle-info dump

----------------------------------------------------------------
Kaushlendra Kumar (5):
       cpupower: idle_monitor: fix incorrect value logged after stop
       tools/cpupower: Fix inverted APERF capability check
       tools/cpupower: Use strcspn() to strip trailing newline
       tools/power cpupower: Reset errno before strtoull()
       tools/power cpupower: Show C0 in idle-info dump

  tools/power/cpupower/lib/cpuidle.c                      | 7 +++----
  tools/power/cpupower/utils/cpufreq-info.c               | 2 +-
  tools/power/cpupower/utils/cpuidle-info.c               | 2 +-
  tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
  4 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------

[-- Attachment #2: linux-cpupower-6.20-rc1.diff --]
[-- Type: text/x-patch, Size: 2735 bytes --]

diff --git a/tools/power/cpupower/lib/cpuidle.c b/tools/power/cpupower/lib/cpuidle.c
index f2c1139adf71..2fcb343d8e75 100644
--- a/tools/power/cpupower/lib/cpuidle.c
+++ b/tools/power/cpupower/lib/cpuidle.c
@@ -150,6 +150,7 @@ unsigned long long cpuidle_state_get_one_value(unsigned int cpu,
 	if (len == 0)
 		return 0;
 
+	errno = 0;
 	value = strtoull(linebuf, &endp, 0);
 
 	if (endp == linebuf || errno == ERANGE)
@@ -193,8 +194,7 @@ static char *cpuidle_state_get_one_string(unsigned int cpu,
 	if (result == NULL)
 		return NULL;
 
-	if (result[strlen(result) - 1] == '\n')
-		result[strlen(result) - 1] = '\0';
+	result[strcspn(result, "\n")] = '\0';
 
 	return result;
 }
@@ -366,8 +366,7 @@ static char *sysfs_cpuidle_get_one_string(enum cpuidle_string which)
 	if (result == NULL)
 		return NULL;
 
-	if (result[strlen(result) - 1] == '\n')
-		result[strlen(result) - 1] = '\0';
+	result[strcspn(result, "\n")] = '\0';
 
 	return result;
 }
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 7d3732f5f2f6..5fe01e516817 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -270,7 +270,7 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
 {
 	unsigned long freq;
 
-	if (cpupower_cpu_info.caps & CPUPOWER_CAP_APERF)
+	if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF))
 		return -EINVAL;
 
 	freq = cpufreq_get_freq_hardware(cpu);
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c
index e0d17f0de3fe..81b4763a97d6 100644
--- a/tools/power/cpupower/utils/cpuidle-info.c
+++ b/tools/power/cpupower/utils/cpuidle-info.c
@@ -111,7 +111,7 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
 	printf(_("max_cstate:              C%u\n"), cstates-1);
 	printf(_("maximum allowed latency: %lu usec\n"), max_allowed_cstate);
 	printf(_("states:\t\n"));
-	for (cstate = 1; cstate < cstates; cstate++) {
+	for (cstate = 0; cstate < cstates; cstate++) {
 		printf(_("    C%d:                  "
 			 "type[C%d] "), cstate, cstate);
 		printf(_("promotion[--] demotion[--] "));
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
index 8b42c2f0a5b0..4225eff9833d 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
@@ -70,7 +70,7 @@ static int cpuidle_stop(void)
 			current_count[cpu][state] =
 				cpuidle_state_time(cpu, state);
 			dprint("CPU %d - State: %d - Val: %llu\n",
-			       cpu, state, previous_count[cpu][state]);
+			       cpu, state, current_count[cpu][state]);
 		}
 	}
 	return 0;

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

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

Hi Shuah,

On Wed, Jan 7, 2026 at 1:09 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> Hi Rafael,
>
> Please pull the following cpupower update for Linux 6.20-rc1.
>
> Fixes to miscellaneous problems in cpupower tool:
>
> - idle_monitor: fix incorrect value logged after stop
> - Fix inverted APERF capability check
> - Use strcspn() to strip trailing newline
> - Reset errno before strtoull()
> - Show C0 in idle-info dump
>
> diff is attached.
>
> thanks,
> -- Shuah
>
> ----------------------------------------------------------------
> The following changes since commit 8f0b4cce4481fb22653697cced8d0d04027cb1e8:
>
>    Linux 6.19-rc1 (2025-12-14 16:05:07 +1200)
>
> are available in the Git repository at:
>
>    git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.20-rc1
>
> for you to fetch changes up to ff72619e11348ab189e232c59515dd5c33780d7c:
>
>    tools/power cpupower: Show C0 in idle-info dump (2025-12-15 12:33:29 -0700)
>
> ----------------------------------------------------------------
> cpupower update for Linux 6.20-rc1
>
> Fixes to miscellaneous problems in cpupower tool:
>
> - idle_monitor: fix incorrect value logged after stop
> - Fix inverted APERF capability check
> - Use strcspn() to strip trailing newline
> - Reset errno before strtoull()
> - Show C0 in idle-info dump
>
> ----------------------------------------------------------------
> Kaushlendra Kumar (5):
>        cpupower: idle_monitor: fix incorrect value logged after stop
>        tools/cpupower: Fix inverted APERF capability check
>        tools/cpupower: Use strcspn() to strip trailing newline
>        tools/power cpupower: Reset errno before strtoull()
>        tools/power cpupower: Show C0 in idle-info dump
>
>   tools/power/cpupower/lib/cpuidle.c                      | 7 +++----
>   tools/power/cpupower/utils/cpufreq-info.c               | 2 +-
>   tools/power/cpupower/utils/cpuidle-info.c               | 2 +-
>   tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
>   4 files changed, 6 insertions(+), 7 deletions(-)
> ----------------------------------------------------------------

Pulled and added to linux-pm.git/linux-next, thanks!

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

end of thread, other threads:[~2026-01-07 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-07  0:08 [GIT PULL] cpupower update for Linux 6.20-rc1 Shuah Khan
2026-01-07 20:03 ` 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®