<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/power/energy_model.c, branch linux-rolling-stable</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-rolling-stable</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-rolling-stable'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2026-01-08T15:55:21Z</updated>
<entry>
<title>PM: EM: Fix memory leak in em_create_pd() error path</title>
<updated>2026-01-08T15:55:21Z</updated>
<author>
<name>Malaya Kumar Rout</name>
</author>
<published>2026-01-05T10:37:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e25348c5405c38c7b5e7b833898f2d205289186a'/>
<id>urn:sha1:e25348c5405c38c7b5e7b833898f2d205289186a</id>
<content type='text'>
When ida_alloc() fails in em_create_pd(), the function returns without
freeing the previously allocated 'pd' structure, leading to a memory leak.
The 'pd' pointer is allocated either at line 436 (for CPU devices with
cpumask) or line 442 (for other devices) using kzalloc().

Additionally, the function incorrectly returns -ENOMEM when ida_alloc()
fails, ignoring the actual error code returned by ida_alloc(), which can
fail for reasons other than memory exhaustion.

Fix both issues by:
 1. Freeing the 'pd' structure with kfree() when ida_alloc() fails
 2. Returning the actual error code from ida_alloc() instead of -ENOMEM

This ensures proper cleanup on the error path and accurate error reporting.

Fixes: cbe5aeedecc7 ("PM: EM: Assign a unique ID when creating a performance domain")
Signed-off-by: Malaya Kumar Rout &lt;mrout@redhat.com&gt;
Reviewed-by:  Changwoo Min &lt;changwoo@igalia.com&gt;
Link: https://patch.msgid.link/20260105103730.65626-1-mrout@redhat.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Add to em_pd_list only when no failure</title>
<updated>2025-10-29T12:37:00Z</updated>
<author>
<name>Peng Fan</name>
</author>
<published>2025-10-28T14:23:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=65df3a9629c10d70593bc90b2ca6b235b7a24909'/>
<id>urn:sha1:65df3a9629c10d70593bc90b2ca6b235b7a24909</id>
<content type='text'>
When em_create_perf_table() returns failure, pd is freed, there dev-&gt;em_pd
is not valid. Then accessing dev-&gt;em_pd-&gt;node will trigger kernel panic
in em_dev_register_pd_no_update(). So return early if 'ret' is non-zero.

Kernel dump:
cpu cpu0: EM: invalid power: 0
Unable to handle kernel NULL pointer dereference at virtual address
0000000000000008
Mem abort info:
pc : em_dev_register_pd_no_update+0xb4/0x79c
lr : em_dev_register_pd_no_update+0x9c/0x79c
Call trace:
 em_dev_register_pd_no_update+0xb4/0x79c (P)
 em_dev_register_perf_domain+0x18/0x58
 scmi_cpufreq_register_em+0x84/0xb8
 cpufreq_online+0x48c/0xb74
 cpufreq_add_dev+0x80/0x98
 subsys_interface_register+0x100/0x11c
 cpufreq_register_driver+0x158/0x278
 scmi_cpufreq_probe+0x1f8/0x2e0
 scmi_dev_probe+0x28/0x3c
 really_probe+0xbc/0x29c
 __driver_probe_device+0x78/0x12c
 driver_probe_device+0x3c/0x15c
 __device_attach_driver+0xb8/0x134
 bus_for_each_drv+0x84/0xe4

Fixes: cbe5aeedecc7 ("PM: EM: Assign a unique ID when creating a performance domain")
Signed-off-by: Peng Fan &lt;peng.fan@nxp.com&gt;
Reviewed-by: Changwoo Min &lt;changwoo@igalia.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://patch.msgid.link/20251028-fix-energy-v1-1-ab854fd6a97c@nxp.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Notify an event when the performance domain changes</title>
<updated>2025-10-22T19:44:38Z</updated>
<author>
<name>Changwoo Min</name>
</author>
<published>2025-10-20T22:09:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1b17c9ac87a21b677077bc47d7579a2897a13f3'/>
<id>urn:sha1:a1b17c9ac87a21b677077bc47d7579a2897a13f3</id>
<content type='text'>
Send an event to userspace when a performance domain is created or deleted,
or its energy model is updated.

Signed-off-by: Changwoo Min &lt;changwoo@igalia.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://patch.msgid.link/20251020220914.320832-11-changwoo@igalia.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Add an iterator and accessor for the performance domain</title>
<updated>2025-10-22T19:44:37Z</updated>
<author>
<name>Changwoo Min</name>
</author>
<published>2025-10-20T22:09:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7928339cfe7d80f35bca905f0a2358271a4e6aa7'/>
<id>urn:sha1:7928339cfe7d80f35bca905f0a2358271a4e6aa7</id>
<content type='text'>
Add an iterator function (for_each_em_perf_domain) that iterates all the
performance domains in the global list. A passed callback function (cb) is
called for each performance domain.

Additionally, add a lookup function (em_perf_domain_get_by_id) that
searches for a performance domain by matching the ID in the global list.

Signed-off-by: Changwoo Min &lt;changwoo@igalia.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://patch.msgid.link/20251020220914.320832-6-changwoo@igalia.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Expose the ID of a performance domain via debugfs</title>
<updated>2025-10-22T19:44:37Z</updated>
<author>
<name>Changwoo Min</name>
</author>
<published>2025-10-20T22:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ee50b8bb6b5d62fc2ebff872ee7ecb3a9380ec64'/>
<id>urn:sha1:ee50b8bb6b5d62fc2ebff872ee7ecb3a9380ec64</id>
<content type='text'>
For ease of debugging, let's expose the assigned ID of a performance
domain through debugfs (e.g., /sys/kernel/debug/energy_model/cpu0/id).

Signed-off-by: Changwoo Min &lt;changwoo@igalia.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://patch.msgid.link/20251020220914.320832-3-changwoo@igalia.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Assign a unique ID when creating a performance domain</title>
<updated>2025-10-22T19:44:37Z</updated>
<author>
<name>Changwoo Min</name>
</author>
<published>2025-10-20T22:09:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cbe5aeedecc72314c3a8fd0d41d9b270f576aee1'/>
<id>urn:sha1:cbe5aeedecc72314c3a8fd0d41d9b270f576aee1</id>
<content type='text'>
It is necessary to refer to a specific performance domain from a
userspace. For example, the energy model of a particular performance
domain is updated.

To this end, assign a unique ID to each performance domain to address it,
and manage them in a global linked list to look up a specific one by
matching ID. IDA is used for ID assignment, and the mutex is used to
protect the global list from concurrent access.

Note that the mutex (em_pd_list_mutex) is not supposed to hold while
holding em_pd_mutex to avoid ABBA deadlock.

Signed-off-by: Changwoo Min &lt;changwoo@igalia.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Link: https://patch.msgid.link/20251020220914.320832-2-changwoo@igalia.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Fix late boot with holes in CPU topology</title>
<updated>2025-09-15T10:02:24Z</updated>
<author>
<name>Christian Loehle</name>
</author>
<published>2025-08-31T21:43:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1ebe8f7e782523e62cd1fa8237f7afba5d1dae83'/>
<id>urn:sha1:1ebe8f7e782523e62cd1fa8237f7afba5d1dae83</id>
<content type='text'>
Commit e3f1164fc9ee ("PM: EM: Support late CPUs booting and capacity
adjustment") added a mechanism to handle CPUs that come up late by
retrying when any of the `cpufreq_cpu_get()` call fails.

However, if there are holes in the CPU topology (offline CPUs, e.g.
nosmt), the first missing CPU causes the loop to break, preventing
subsequent online CPUs from being updated.

Instead of aborting on the first missing CPU policy, loop through all
and retry if any were missing.

Fixes: e3f1164fc9ee ("PM: EM: Support late CPUs booting and capacity adjustment")
Suggested-by: Kenneth Crudup &lt;kenneth.crudup@gmail.com&gt;
Reported-by: Kenneth Crudup &lt;kenneth.crudup@gmail.com&gt;
Link: https://lore.kernel.org/linux-pm/40212796-734c-4140-8a85-854f72b8144d@panix.com/
Cc: 6.9+ &lt;stable@vger.kernel.org&gt; # 6.9+
Signed-off-by: Christian Loehle &lt;christian.loehle@arm.com&gt;
Link: https://patch.msgid.link/20250831214357.2020076-1-christian.loehle@arm.com
[ rjw: Drop the new pr_debug() message which is not very useful ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Add function for registering a PD without capacity update</title>
<updated>2025-09-10T10:03:19Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2025-09-05T13:44:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e0423541477dfb684fbc6e6b5386054bc650f264'/>
<id>urn:sha1:e0423541477dfb684fbc6e6b5386054bc650f264</id>
<content type='text'>
The intel_pstate driver manages CPU capacity changes itself and it does
not need an update of the capacity of all CPUs in the system to be
carried out after registering a PD.

Moreover, in some configurations (for instance, an SMT-capable
hybrid x86 system booted with nosmt in the kernel command line) the
em_check_capacity_update() call at the end of em_dev_register_perf_domain()
always fails and reschedules itself to run once again in 1 s, so
effectively it runs in vain every 1 s forever.

To address this, introduce a new variant of em_dev_register_perf_domain(),
called em_dev_register_pd_no_update(), that does not invoke
em_check_capacity_update(), and make intel_pstate use it instead of the
original.

Fixes: 7b010f9b9061 ("cpufreq: intel_pstate: EAS support for hybrid platforms")
Closes: https://lore.kernel.org/linux-pm/40212796-734c-4140-8a85-854f72b8144d@panix.com/
Reported-by: Kenneth R. Crudup &lt;kenny@panix.com&gt;
Tested-by: Kenneth R. Crudup &lt;kenny@panix.com&gt;
Cc: 6.16+ &lt;stable@vger.kernel.org&gt; # 6.16+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM: EM: Introduce em_adjust_cpu_capacity()</title>
<updated>2025-05-13T12:34:18Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2025-05-06T20:41:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4a6b1cf0d4c02d6da2976c6314c264d20672937e'/>
<id>urn:sha1:4a6b1cf0d4c02d6da2976c6314c264d20672937e</id>
<content type='text'>
Add a function for updating the Energy Model for a CPU after its
capacity has changed, which subsequently will be used by the
intel_pstate driver.

An EM_PERF_DOMAIN_ARTIFICIAL check is added to em_recalc_and_update()
to prevent it from calling em_compute_costs() for an "artificial" perf
domain with a NULL cb parameter which would cause it to crash.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Tested-by: Christian Loehle &lt;christian.loehle@arm.com&gt;
Reviewed-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Link: https://patch.msgid.link/3637203.iIbC2pHGDl@rjwysocki.net
</content>
</entry>
<entry>
<title>PM: EM: Move CPU capacity check to em_adjust_new_capacity()</title>
<updated>2025-05-13T12:34:18Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2025-05-06T20:39:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3e3ba654d3097e0031f2add215b12ff81c23814e'/>
<id>urn:sha1:3e3ba654d3097e0031f2add215b12ff81c23814e</id>
<content type='text'>
Move the check of the CPU capacity currently stored in the energy model
against the arch_scale_cpu_capacity() value to em_adjust_new_capacity()
so it will be done regardless of where the latter is called from.

This will be useful when a new em_adjust_new_capacity() caller is added
subsequently.

While at it, move the pd local variable declaration in
em_check_capacity_update() into the loop in which it is used.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Lukasz Luba &lt;lukasz.luba@arm.com&gt;
Tested-by: Christian Loehle &lt;christian.loehle@arm.com&gt;
Reviewed-by: Dietmar Eggemann &lt;dietmar.eggemann@arm.com&gt;
Link: https://patch.msgid.link/7810787.EvYhyI6sBW@rjwysocki.net
</content>
</entry>
</feed>
