From: Aboorva Devarajan <aboorvad@linux.ibm.com>
To: rafael@kernel.org, christian.loehle@arm.com, daniel.lezcano@linaro.org
Cc: aboorvad@linux.ibm.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/4] cpuidle: Skip governor when only one idle state is available
Date: Tue, 17 Feb 2026 00:20:02 +0530 [thread overview]
Message-ID: <20260216185005.1131593-2-aboorvad@linux.ibm.com> (raw)
In-Reply-To: <20260216185005.1131593-1-aboorvad@linux.ibm.com>
On certain platforms (PowerNV systems without a power-mgt DT node),
cpuidle may register only a single idle state. In cases where that
single state is a polling state (state 0), the ladder governor may
incorrectly treat state 1 as the first usable state and pass an
out-of-bounds index. This can lead to a NULL enter callback being
invoked, ultimately resulting in a system crash.
[ 13.342636] cpuidle-powernv : Only Snooze is available
[ 13.351854] Faulting instruction address: 0x00000000
[ 13.376489] NIP [0000000000000000] 0x0
[ 13.378351] LR [c000000001e01974] cpuidle_enter_state+0x2c4/0x668
Fix this by adding a bail-out in cpuidle_select() that returns state 0
directly when state_count <= 1, bypassing the governor and keeping the
tick running.
Fixes: dc2251bf98c6 ("cpuidle: Eliminate the CPUIDLE_DRIVER_STATE_START symbol")
Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
---
drivers/cpuidle/cpuidle.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index c7876e9e024f..65fbb8e807b9 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -359,6 +359,16 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
bool *stop_tick)
{
+ /*
+ * If there is only a single idle state (or none), there is nothing
+ * meaningful for the governor to choose. Skip the governor and
+ * always use state 0 with the tick running.
+ */
+ if (drv->state_count <= 1) {
+ *stop_tick = false;
+ return 0;
+ }
+
return cpuidle_curr_governor->select(drv, dev, stop_tick);
}
--
2.52.0
next prev parent reply other threads:[~2026-02-16 18:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 18:50 [PATCH v2 0/4] cpuidle: Fix crash with single idle state Aboorva Devarajan
2026-02-16 18:50 ` Aboorva Devarajan [this message]
2026-02-17 14:36 ` [PATCH v2 1/4] cpuidle: Skip governor when only one idle state is available Christian Loehle
2026-02-17 14:53 ` Rafael J. Wysocki
2026-03-05 16:53 ` Guenter Roeck
2026-03-05 17:06 ` Rafael J. Wysocki
2026-03-05 17:09 ` Guenter Roeck
2026-02-16 18:50 ` [PATCH v2 2/4] cpuidle: haltpoll: Remove single state handling Aboorva Devarajan
2026-02-17 14:37 ` Christian Loehle
2026-02-16 18:50 ` [PATCH v2 3/4] cpuidle: teo: " Aboorva Devarajan
2026-02-16 18:50 ` [PATCH v2 4/4] cpuidle: menu: " Aboorva Devarajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260216185005.1131593-2-aboorvad@linux.ibm.com \
--to=aboorvad@linux.ibm.com \
--cc=christian.loehle@arm.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®