<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/cpuidle/driver.c, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-11-25T18:06:38+00:00</updated>
<entry>
<title>cpuidle: Warn instead of bailing out if target residency check fails</title>
<updated>2025-11-25T18:06:38+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2025-11-25T16:23:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4bf944f3fcb6c192af1ea73e3d183b6364458b25'/>
<id>urn:sha1:4bf944f3fcb6c192af1ea73e3d183b6364458b25</id>
<content type='text'>
It turns out that the change in commit 76934e495cdc ("cpuidle: Add
sanity check for exit latency and target residency") goes too far
because there are systems in the field on which the check introduced
by that commit does not pass.

For this reason, change __cpuidle_driver_init() return type back to void
and make it print a warning when the check mentioned above does not
pass.

Fixes: 76934e495cdc ("cpuidle: Add sanity check for exit latency and target residency")
Reported-by: Val Packett &lt;val@packett.cool&gt;
Closes: https://lore.kernel.org/linux-pm/20251121010756.6687-1-val@packett.cool/
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Christian Loehle &lt;christian.loehle@arm.com&gt;
Link: https://patch.msgid.link/2808566.mvXUDI8C0e@rafael.j.wysocki
</content>
</entry>
<entry>
<title>cpuidle: Add sanity check for exit latency and target residency</title>
<updated>2025-11-12T20:00:00+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2025-11-07T19:07:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=76934e495cdc31942b53b513cee4290750578a9a'/>
<id>urn:sha1:76934e495cdc31942b53b513cee4290750578a9a</id>
<content type='text'>
Make __cpuidle_driver_init() fail if the exit latency of one of the
driver's idle states is less than its target residency which would
break cpuidle assumptions.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Reviewed-by: Christian Loehle &lt;christian.loehle@arm.com&gt;
[ rjw: Changelog fix ]
Link: https://patch.msgid.link/12779486.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: Correct some typos in comments</title>
<updated>2024-10-18T16:44:32+00:00</updated>
<author>
<name>Shen Lichuan</name>
<email>shenlichuan@vivo.com</email>
</author>
<published>2024-09-27T08:10:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ee702fdaf1563078758065aca7beb5e5d89367e5'/>
<id>urn:sha1:ee702fdaf1563078758065aca7beb5e5d89367e5</id>
<content type='text'>
Fixed some confusing typos that were currently identified with codespell,
the details are as follows:

 -in the code comments:
  drivers/cpuidle/cpuidle-arm.c:142: registeration ==&gt; registration
  drivers/cpuidle/cpuidle-qcom-spm.c:51: accidently ==&gt; accidentally
  drivers/cpuidle/cpuidle.c:409: dependant ==&gt; dependent
  drivers/cpuidle/driver.c:264: occuring ==&gt; occurring
  drivers/cpuidle/driver.c:299: occuring ==&gt; occurring

Signed-off-by: Shen Lichuan &lt;shenlichuan@vivo.com&gt;
Link: https://patch.msgid.link/20240927081018.8608-1-shenlichuan@vivo.com
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: Avoid potential overflow in integer multiplication</title>
<updated>2024-02-12T16:07:49+00:00</updated>
<author>
<name>C Cheng</name>
<email>C.Cheng@mediatek.com</email>
</author>
<published>2023-12-19T03:14:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=88390dd788db485912ee7f9a8d3d56fc5265d52f'/>
<id>urn:sha1:88390dd788db485912ee7f9a8d3d56fc5265d52f</id>
<content type='text'>
In detail:

In C language, when you perform a multiplication operation, if
both operands are of int type, the multiplication operation is
performed on the int type, and then the result is converted to
the target type. This means that if the product of int type
multiplication exceeds the range that int type can represent,
an overflow will occur even if you store the result in a
variable of int64_t type.

For a multiplication of two int values, it is better to use
mul_u32_u32() rather than s-&gt;exit_latency_ns = s-&gt;exit_latency *
NSEC_PER_USEC to avoid potential overflow happenning.

Signed-off-by: C Cheng &lt;C.Cheng@mediatek.com&gt;
Signed-off-by: Bo Ye &lt;bo.ye@mediatek.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
[ rjw: New subject ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: driver: Update microsecond values of state parameters as needed</title>
<updated>2023-02-13T15:08:44+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2023-02-07T19:59:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=41204a607679ccca7eabff9f2871b969d6ef2ce3'/>
<id>urn:sha1:41204a607679ccca7eabff9f2871b969d6ef2ce3</id>
<content type='text'>
If the cpuidle driver provides the target residency and exit latency in
nanoseconds, the corresponding values in microseconds need to be set to
reflect the provided numbers in order for the sysfs interface to show
them correctly, so make __cpuidle_driver_init() do that.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Tested-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: Use s64 as exit_latency_ns and target_residency_ns data type</title>
<updated>2021-04-07T17:26:44+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2021-03-29T18:15:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2ab80d46fead0309d7f190d8023c8d64b2ffcbd5'/>
<id>urn:sha1:2ab80d46fead0309d7f190d8023c8d64b2ffcbd5</id>
<content type='text'>
Subsequent changes will cause the exit_latency_ns and target_residency_ns
fields in struct cpuidle_state to be used in computations in which data
type conversions to u64 may turn a negative number close to zero into
a verly large positive number leading to incorrect results.

In preparation for that, change the data type of the fields mentioned
above to s64, but ensure that they will not be negative themselves.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: Drop unused cpuidle_driver_ref/unref() functions</title>
<updated>2020-01-09T15:47:22+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2020-01-02T20:42:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=577a2f41f4c7aced4fed41b20ee77cedd8c197cf'/>
<id>urn:sha1:577a2f41f4c7aced4fed41b20ee77cedd8c197cf</id>
<content type='text'>
The cpuidle_driver_ref() and cpuidle_driver_unref() functions are not
used and the refcnt field in struct cpuidle_driver operated by them
is not updated anywhere else (so it is permanently equal to 0), so
drop both of them along with refcnt.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
</content>
</entry>
<entry>
<title>cpuidle: Fix cpuidle_driver_state_disabled()</title>
<updated>2019-12-10T22:41:20+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2019-12-10T11:48:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b0142d66f4edb8578b7772d6d7ad731836b82ddb'/>
<id>urn:sha1:b0142d66f4edb8578b7772d6d7ad731836b82ddb</id>
<content type='text'>
It turns out that cpuidle_driver_state_disabled() can be called
before registering the cpufreq driver on some platforms, which
was not expected when it was introduced and which leads to a NULL
pointer dereference when trying to walk the CPUs associated with
the given cpuidle driver.

Fix the problem by making cpuidle_driver_state_disabled() check if
the driver's mask of CPUs associated with it is present and to set
CPUIDLE_FLAG_UNUSABLE for the given idle state in the driver's states
list if that is not the case to cause __cpuidle_register_device() to
set CPUIDLE_STATE_DISABLED_BY_DRIVER for that state for all cpuidle
devices registered by it later.

Fixes: cbda56d5fefc ("cpuidle: Introduce cpuidle_driver_state_disabled() for driver quirks")
Reported-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
Tested-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: Introduce cpuidle_driver_state_disabled() for driver quirks</title>
<updated>2019-11-19T09:35:13+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2019-11-18T11:11:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cbda56d5fefcebc01448982a55836c88a825b34c'/>
<id>urn:sha1:cbda56d5fefcebc01448982a55836c88a825b34c</id>
<content type='text'>
Commit 99e98d3fb100 ("cpuidle: Consolidate disabled state checks")
overlooked the fact that the imx6q and tegra20 cpuidle drivers use
the "disabled" field in struct cpuidle_state for quirks which trigger
after the initialization of cpuidle, so reading the initial value of
that field is not sufficient for those drivers.

In order to allow them to implement the quirks without using the
"disabled" field in struct cpuidle_state, introduce a new helper
function and modify them to use it.

Fixes: 99e98d3fb100 ("cpuidle: Consolidate disabled state checks")
Reported-by: Len Brown &lt;lenb@kernel.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpuidle: Use nanoseconds as the unit of time</title>
<updated>2019-11-11T20:56:07+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2019-11-07T14:25:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c1d51f684c72b5eb2aecbbd47be3a2977a2dc903'/>
<id>urn:sha1:c1d51f684c72b5eb2aecbbd47be3a2977a2dc903</id>
<content type='text'>
Currently, the cpuidle subsystem uses microseconds as the unit of
time which (among other things) causes the idle loop to incur some
integer division overhead for no clear benefit.

In order to allow cpuidle to measure time in nanoseconds, add two
new fields, exit_latency_ns and target_residency_ns, to represent the
exit latency and target residency of an idle state in nanoseconds,
respectively, to struct cpuidle_state and initialize them with the
help of the corresponding values in microseconds provided by drivers.
Additionally, change cpuidle_governor_latency_req() to return the
idle state exit latency constraint in nanoseconds.

Also meeasure idle state residency (last_residency_ns in struct
cpuidle_device and time_ns in struct cpuidle_driver) in nanoseconds
and update the cpuidle core and governors accordingly.

However, the menu governor still computes typical intervals in
microseconds to avoid integer overflows.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Doug Smythies &lt;dsmythies@telus.net&gt;
Tested-by: Doug Smythies &lt;dsmythies@telus.net&gt;
</content>
</entry>
</feed>
