From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72A0F35AC12 for ; Sat, 28 Feb 2026 18:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772302765; cv=none; b=on9/kk917kLN0bLfZCUmb/zgoyriowndZObbFCHhZK6V9w53TZ0oXl5Tdny/1w+PVqttkkBGU8ejwRWj8ocWWaujZPaJYJPTzAjapueRWLxhd7Oyy/xfUfFHfONFCaW0TWQxprwsMQE1uEIGhdElWumQky0Qlx5fVw+4Z08SoZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772302765; c=relaxed/simple; bh=ySeU4MZWgjb+iyF4sqYsbUi4Gd2a1WwGpqCVfbx80ys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YAuFvz4qdfrQC076cVQXj85SvbOerVQ9Uuj/3/HII5LSmdTXkzLNKQFiIz7+SjBaMRsaCH1e353zQ/5XCodhEW7kE46m3o+2e/zMb2cGSdD1LgM4D1YxhnVLLgt5aIwZwZy0fWVo/elkmiDyWbPmCUA15bwClrTRVWbKn7JgDZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dwFzcXeH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dwFzcXeH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CB2BC19423; Sat, 28 Feb 2026 18:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772302765; bh=ySeU4MZWgjb+iyF4sqYsbUi4Gd2a1WwGpqCVfbx80ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwFzcXeH/aJykQWotNQFTb5Oc+W92blXb6Jk+JYts0amn/SX8lgNiWUNiCXV4HTHA Jl7xRuFdCAAomYwNC65/qiNnitwXnlz+GVdajVOH9AITPf/fJMmK+GjXUxXTaH2gNh 93tPbuM1bxEQsdS2ikRFbOZ7ild4VHWa7fFeicEbK7JWeHQMAFKPYYEQmNCWYuSuoo 33RHLDTFZPMvAyvdeZgVImbdn5PQEUenisiwkWj5iunFlWBxHnwHUgfdXOONTNFz/3 137cyjCog4n6P4FPmIhyhhYnFPq/Jio0hgwgzDfmfwvoxBNclZGn8uf6o362J+HksD O7VjZonEXT3NQ== From: Sasha Levin To: patches@lists.linux.dev Cc: Aboorva Devarajan , Christian Loehle , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.10 136/147] cpuidle: Skip governor when only one idle state is available Date: Sat, 28 Feb 2026 13:17:24 -0500 Message-ID: <20260228181736.1605592-136-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228181736.1605592-1-sashal@kernel.org> References: <20260228181736.1605592-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Aboorva Devarajan [ Upstream commit e5c9ffc6ae1bcdb1062527d611043681ac301aca ] 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 Reviewed-by: Christian Loehle Link: https://patch.msgid.link/20260216185005.1131593-2-aboorvad@linux.ibm.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 1c1fa6ac9244a..87a57cee40fcb 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -319,6 +319,16 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, 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.51.0