<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/power/cpupower/lib, branch master</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=master</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-12-15T19:33:28Z</updated>
<entry>
<title>tools/power cpupower: Reset errno before strtoull()</title>
<updated>2025-12-15T19:33:28Z</updated>
<author>
<name>Kaushlendra Kumar</name>
<email>kaushlendra.kumar@intel.com</email>
</author>
<published>2025-12-01T12:17:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f9bd3762cf1bd0c2465f2e6121b340883471d1bf'/>
<id>urn:sha1:f9bd3762cf1bd0c2465f2e6121b340883471d1bf</id>
<content type='text'>
cpuidle_state_get_one_value() never cleared errno before calling
strtoull(), so a prior ERANGE caused every cpuidle counter read to
return zero. Reset errno to 0 before the conversion so each sysfs read
is evaluated independently.

Link: https://lore.kernel.org/r/20251201121745.3776703-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar &lt;kaushlendra.kumar@intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tools/cpupower: Use strcspn() to strip trailing newline</title>
<updated>2025-12-15T19:33:28Z</updated>
<author>
<name>Kaushlendra Kumar</name>
<email>kaushlendra.kumar@intel.com</email>
</author>
<published>2025-11-27T04:45:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1b9aaf36b7b40235e5a529c15848c3d866362207'/>
<id>urn:sha1:1b9aaf36b7b40235e5a529c15848c3d866362207</id>
<content type='text'>
Replace manual newline removal with strcspn() which is safer and
cleaner. This avoids potential out-of-bounds access on empty strings
and handles the case where no newline exists.

Link: https://lore.kernel.org/r/20251127044536.715722-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar &lt;kaushlendra.kumar@intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tools/cpupower: Fix incorrect size in cpuidle_state_disable()</title>
<updated>2025-09-24T23:15:35Z</updated>
<author>
<name>Kaushlendra Kumar</name>
<email>kaushlendra.kumar@intel.com</email>
</author>
<published>2025-09-17T05:08:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=23199d2aa6dcaf6dd2da772f93d2c94317d71459'/>
<id>urn:sha1:23199d2aa6dcaf6dd2da772f93d2c94317d71459</id>
<content type='text'>
Fix incorrect size parameter passed to cpuidle_state_write_file() in
cpuidle_state_disable().

The function was incorrectly using sizeof(disable) which returns the
size of the unsigned int variable (4 bytes) instead of the actual
length of the string stored in the 'value' buffer.

Since 'value' is populated with snprintf() to contain the string
representation of the disable value, we should use the length
returned by snprintf() to get the correct string length for
writing to the sysfs file.

This ensures the correct number of bytes is written to the cpuidle
state disable file in sysfs.

Link: https://lore.kernel.org/r/20250917050820.1785377-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar &lt;kaushlendra.kumar@intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tools/cpupower: fix error return value in cpupower_write_sysfs()</title>
<updated>2025-09-16T22:21:50Z</updated>
<author>
<name>Kaushlendra Kumar</name>
<email>kaushlendra.kumar@intel.com</email>
</author>
<published>2025-08-28T06:30:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=57b100d4cf14276e0340eecb561005c07c129eb8'/>
<id>urn:sha1:57b100d4cf14276e0340eecb561005c07c129eb8</id>
<content type='text'>
The cpupower_write_sysfs() function currently returns -1 on
write failure, but the function signature indicates it should
return an unsigned int. Returning -1 from an unsigned function
results in a large positive value rather than indicating
an error condition.

Fix this by returning 0 on failure, which is more appropriate
for an unsigned return type and maintains consistency with typical
success/failure semantics where 0 indicates failure and non-zero
indicates success (bytes written).

Link: https://lore.kernel.org/r/20250828063000.803229-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar &lt;kaushlendra.kumar@intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>cpupower: Implement CPU physical core querying</title>
<updated>2025-03-06T20:27:57Z</updated>
<author>
<name>John B. Wyatt IV</name>
<email>jwyatt@redhat.com</email>
</author>
<published>2025-03-05T21:08:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f89cb9cba7a2557db676b507dd181d9751c7d11d'/>
<id>urn:sha1:f89cb9cba7a2557db676b507dd181d9751c7d11d</id>
<content type='text'>
This patch is also an issue report. get_cpu_topology will always save
into cpupower_topology a cores size of 0. The code to handle this looks
like it was commented out, and what is commented out is missing a curly
bracket.

https://elixir.bootlin.com/linux/v6.13.5/source/tools/power/cpupower/lib/cpupower.c#L206-L212

Inspiration was taken from psutil to implement this by querying
core_cpu_list. Instead of using a hashmap, I used a sorted array, and
counted the number of valid unique strings. The counting of this takes
place before the qsort for .pkg as the following code says it is
dependent on the order of that sort.

The previous code claimed Intel CPUs are not numbered correctly. I was
not able to reproduce that issue and removed that comment and the code.

This commit was tested with the libcpupower SWIG Python bindings and
performed correctly on 4 different setups. The most notable is the
Framework Intel laptop; a hybrid system of 4 P cores (8 threads) and 8 E
cores (8 threads).

The 4 setups: A 4 core virt-manager VM running Fedora 41 4c/4t (specs not
listed) was tested as a sanity test for VMs. A Lenovo Ryzen 7 Pro 7840HS
8c/16t. A Supermico Intel(R) Xeon(R) Gold 6330 CPU w/ 56c/112t with 2 CPU
sockets. A Framework 12th Gen Intel(R) Core(TM) i5-1240P with hybrid
cores.

CPU(s):                   16
  On-line CPU(s) list:    0-15
Vendor ID:                AuthenticAMD
  Model name:             AMD Ryzen 7 PRO 7840HS w/ Radeon 780M Graphics
    CPU family:           25
    Model:                116
    Thread(s) per core:   2
    Core(s) per socket:   8
    Socket(s):            1
    Stepping:             1

CPU(s):                   112
  On-line CPU(s) list:    0-111
Vendor ID:                GenuineIntel
  BIOS Vendor ID:         Intel(R) Corporation
  Model name:             Intel(R) Xeon(R) Gold 6330 CPU @ 2.00GHz
    BIOS Model name:      Intel(R) Xeon(R) Gold 6330 CPU @ 2.00GHz  CPU @ 2.0GHz
    BIOS CPU family:      179
    CPU family:           6
    Model:                106
    Thread(s) per core:   2
    Core(s) per socket:   28
    Socket(s):            2
    Stepping:             6

CPU(s):                   16
  On-line CPU(s) list:    0-15
Vendor ID:                GenuineIntel
  Model name:             12th Gen Intel(R) Core(TM) i5-1240P
    CPU family:           6
    Model:                154
    Thread(s) per core:   2
    Core(s) per socket:   12
    Socket(s):            1
    Stepping:             3

Link: https://lore.kernel.org/r/20250305210901.24177-1-jwyatt@redhat.com
Signed-off-by: "John B. Wyatt IV" &lt;jwyatt@redhat.com&gt;
Signed-off-by: "John B. Wyatt IV" &lt;sageofredondo@gmail.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>cpupower: Add support for showing energy performance preference</title>
<updated>2024-12-20T16:12:07Z</updated>
<author>
<name>Mario Limonciello</name>
<email>mario.limonciello@amd.com</email>
</author>
<published>2024-12-18T19:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5f567afc283fc9e7c6a34d013c4fc6c5e8d6afae'/>
<id>urn:sha1:5f567afc283fc9e7c6a34d013c4fc6c5e8d6afae</id>
<content type='text'>
The EPP value is useful for characterization of performance. Show
it in cpupower frequency-info output.

Link: https://lore.kernel.org/r/20241218191144.3440854-6-superm1@kernel.org
Signed-off-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>cpupower: Add support for parsing 'enabled' or 'disabled' strings from table</title>
<updated>2024-12-20T16:12:07Z</updated>
<author>
<name>Mario Limonciello</name>
<email>mario.limonciello@amd.com</email>
</author>
<published>2024-12-18T19:09:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3f2eb7606eee37aea630c4b7aa42497bc36ca157'/>
<id>urn:sha1:3f2eb7606eee37aea630c4b7aa42497bc36ca157</id>
<content type='text'>
When cpufreq_get_sysfs_value_from_table() is passed a table with
kernel strings that report 'enabled' or 'disabled' it always returns 0
because these can't cleanly convert to integers.

Explicitly look for enabled or disabled strings from the kernel to handle
this.

Link: https://lore.kernel.org/r/20241218191144.3440854-3-superm1@kernel.org
Signed-off-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>pm:cpupower: Add missing powercap_set_enabled() stub function</title>
<updated>2024-09-06T00:48:57Z</updated>
<author>
<name>John B. Wyatt IV</name>
<email>jwyatt@redhat.com</email>
</author>
<published>2024-09-05T02:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4b80294fb53845dc5c98cca0c989da09150f2ca9'/>
<id>urn:sha1:4b80294fb53845dc5c98cca0c989da09150f2ca9</id>
<content type='text'>
There was a symbol listed in the powercap.h file that was not implemented.
Implement it with a stub return of 0.

Programs like SWIG require that functions that are defined in the
headers be implemented.

Fixes: c2294c1496b7 ("cpupower: Introduce powercap intel-rapl library and powercap-info command")
Suggested-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: John B. Wyatt IV &lt;jwyatt@redhat.com&gt;
Signed-off-by: John B. Wyatt IV &lt;sageofredondo@gmail.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tools/cpupower: display residency value in idle-info</title>
<updated>2024-08-09T16:32:33Z</updated>
<author>
<name>Aboorva Devarajan</name>
<email>aboorvad@linux.ibm.com</email>
</author>
<published>2024-08-09T08:37:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=76fb981ad6774b82f06703c896b492c8659b543b'/>
<id>urn:sha1:76fb981ad6774b82f06703c896b492c8659b543b</id>
<content type='text'>
Update cpuidle tool to display the residency value of cpuidle
states. This addition provides a clearer and more detailed view
of idle state information when using cpuidle-info.

 --------------------------------
 Before Patch:
 --------------------------------
 $ cpupower idle-info
 CPUidle driver: intel_idle
 CPUidle governor: menu
 analyzing CPU 28:

 Number of idle states: 3
 Available idle states: POLL C1 C1E
 POLL:
 Flags/Description: CPUIDLE CORE POLL IDLE
 Latency: 0
 Usage: 7448
 Duration: 207170
 C1:
 Flags/Description: MWAIT 0x00
 Latency: 2
 Usage: 7023
 Duration: 3736853
 C1E:
 Flags/Description: MWAIT 0x01
 Latency: 10
 Usage: 18468
 Duration: 11396212

 --------------------------------
 After Patch:
 --------------------------------
 $ cpupower idle-info
 CPUidle driver: intel_idle
 CPUidle governor: menu
 analyzing CPU 12:

 Number of idle states: 3
 Available idle states: POLL C1 C1E
 POLL:
 Flags/Description: CPUIDLE CORE POLL IDLE
 Latency: 0
 Residency: 0
 Usage: 1950
 Duration: 38458
 C1:
 Flags/Description: MWAIT 0x00
 Latency: 2
 Residency: 2
 Usage: 10688
 Duration: 7133020
 C1E:
 Flags/Description: MWAIT 0x01
 Latency: 10
 Residency: 20
 Usage: 22356
 Duration: 15687259
 --------------------------------

Signed-off-by: Aboorva Devarajan &lt;aboorvad@linux.ibm.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>cpupower: Add is_valid_path API</title>
<updated>2023-07-18T22:06:44Z</updated>
<author>
<name>Wyes Karny</name>
<email>wyes.karny@amd.com</email>
</author>
<published>2023-06-19T19:05:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1ce5ab7c1dbfa82f0d382a48cccb51178cbf5416'/>
<id>urn:sha1:1ce5ab7c1dbfa82f0d382a48cccb51178cbf5416</id>
<content type='text'>
Add is_valid_path API to check whether the sysfs file is present or not.

Suggested-by: Gautham R. Shenoy &lt;gautham.shenoy@amd.com&gt;
Reviewed-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Wyes Karny &lt;wyes.karny@amd.com&gt;
Tested-by: Perry Yuan &lt;Perry.Yuan@amd.com&gt;
Acked-by: Huang Rui &lt;ray.huang@amd.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
