From nobody Tue Sep 29 07:41:36 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 69DA923BD17 for ; Tue, 11 Aug 2026 05:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786427427; cv=none; b=a1gIMrslrdJsvt/tfaFlyortPLWPcOZTNRVoEx2GqXleHOq8M+40VMduX3bc3Y6KBgga/Ah3SfXqyLkyA70KRqElWxdfFtJvfQpoVo090ochlRTGdXuTB6E95q8aJUutRf+4udqT2P8LscnBYEfGHiJdLCIhw0ykdqYp8Jd7hdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786427427; c=relaxed/simple; bh=n3vG1Ouz3Z5dfG3sO3PGglSgElYx/5po7OR/QX+HXZw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RNWo4/KndAsF6xv1LUNya870bcuagCqESSpy/OdiWPEvHALQTpO13YUi+s4yNtji6YpK2XFDiGSmvDYGeBchZU/TjM1kJVhuA1mfRPRsJNvcB0R5ekc2FsmOPyVMHNxjDHelapiSJnXoPg+eUR7Pbz28i68KbUsVcggHdLeOrTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XtB4JrBo; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=NeMA9xrV; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XtB4JrBo"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="NeMA9xrV" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67AMprfb2995757 for ; Tue, 11 Aug 2026 05:50:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= koBYLSdR313PhDwt5MfsU4zfM6HkL0IaObNIbdT0org=; b=XtB4JrBo2XD0SHa3 +Kk/TxytdY7ZFEVyyc4+TfwHpqpHWjnl/tvSWiybuZaDhKzXp2IT7eCcOBorrA5C qkSyTutzdI8U4FYZ2Iumro+mnHDktR0RqhdKM9RRfjx8PsZaSpU3ug4Fl+TAQte9 rQWUf+k3lbIpw4a6od6NmlNphvD8U7/duu5+QyhBU38QWjqwoi2aQuENuM8LYQeA A0tAyUt5qDAWg0q47PqqINmc3zmsnHNieaG1LllgcApl49h3rcg0cWv4YQgn7v4x C6FONU8wa1+N9NXoiA4i+Goq++azwJ0QwswAbEADy4xJ2kislqNycJSPhYZa/tYc nxBlRQ== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fyjyf2fj2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 11 Aug 2026 05:50:24 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-38f0fe57470so647776a91.0 for ; Mon, 10 Aug 2026 22:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786427424; x=1787032224; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=koBYLSdR313PhDwt5MfsU4zfM6HkL0IaObNIbdT0org=; b=NeMA9xrVX53a89W2bxxfbQVi2zyiTfMPLDi7Q25ReQyJ8lwPtUaMJ8aNiD0X2hbzkR xPkwLTtUElEfsbXtmbYZyWh1ZbmDqhE5JKJu2aQSL7oNx2G8T+Ba6iETHWjCLVxzMAyu EV8uhThMM9LqqvXUEonYpKSuVweCKhRks9uHTx+uvWWeWS884RySXuc2/uiPf3z44hnM yT+V0I4odDzdHh/kZKFi00en4yqyB+JAMA1mfuKGIB4rQlQD5dnDWMESh/lXJTZxPGrm Qrsilqf/YBBHUt+v+ay0RkDkqWp0dG4NMdJgwnOkWQHFWsn5L+XNL87W2UjQsoH3B+TK 8IsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786427424; x=1787032224; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=koBYLSdR313PhDwt5MfsU4zfM6HkL0IaObNIbdT0org=; b=edW2n2bAzDactFyA7v1uMLJDPaFCqbYWui6QHL1tB5hq2XJuPSz09v8aUoCtbT89JI aj5cTipLb9haBQVp4O5tolvooJPQxquiMK1egyrFg8B5MODxLSufXf2iokKjEU8p1XSt cjxWZNUwgHXbnelQgy5OP5pnrm/orfJO4FEqt9sdHHCdiNbBF5lXh5RikMBkJxXiGF3I +RWjB9oPAMBpmau51efmFrfcdbkAgNbkNx+PkTnsJLnk28F1uOZvQMeK7FniLKx3WbS+ 81jNsKNDak7CiH4vZz5603IBI1X+nvubPsBtnCd+2zhAYh+y5KD6z9qV2lhA/6l5qxl/ fhCA== X-Forwarded-Encrypted: i=1; AHgh+RoHtcQwoh+OZSOwQuMb3qDSUnTEbqv2/bx39ouVW0VX8mBSsD3cTyh8pLuzNxNGwKBbZR60ssQWT7CBJyg=@vger.kernel.org X-Gm-Message-State: AOJu0YwFWm7F5EmQXpYRKFc3f5Ax3vKcnh0USjg1HElCqY4fdc3tLBwQ su/DXHE5SQDRoIFub/mbhbHzxna9UxKKAILrxbW7CvqEoO9ach3aiJ+l3YyI0n+ijRtm0RzYATa 86QvrpOFfgZLPa2WBl0pqhkQgBXn7tCFbfbt7rfgtxnUxQ61jNpwUWLRxX6t7uCxam0I= X-Gm-Gg: AR+sD10aUH6d6q+09Io7bjCbzO4Zy4oH7SLz1edzrcjj9UPMrYFI8kq64d0eqkglJCT qMlA40GhQq27J/s7HQMZ4L1ruyNbgk2s0kkb2Lj8YFZLj/3LMrShiI+Dn9h1/Mu+nRIamo9Jb+R kClOCh8kA3DGf7SK7GP2Yxjbbjq94ipE9lD1ojsqvQ4ZmtfECCi6AmURb4/JZCvL6rti/RC9Mo1 AzMWP3X1+L+h4H/OJVrQNpsFfhPMwfx4jY/ED/zOR4035xttNRE9cUvAjHg1LoepNzzMyUbrOJA 1gNyhb87flS+a18YusxGv4V0QFERls00cLuI3tAmYveHWVhuGYaqUJh61+Cfk8WzXXxEuhKsjfZ x889vWdnuRhPH0PUUzI8/subyvAFf X-Received: by 2002:a17:90b:442f:b0:38e:42f5:d096 with SMTP id 98e67ed59e1d1-392ed2b2696mr174460a91.0.1786427423705; Mon, 10 Aug 2026 22:50:23 -0700 (PDT) X-Received: by 2002:a17:90b:442f:b0:38e:42f5:d096 with SMTP id 98e67ed59e1d1-392ed2b2696mr174449a91.0.1786427423254; Mon, 10 Aug 2026 22:50:23 -0700 (PDT) Received: from hu-mkshah-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-392d534ab78sm2062289a91.12.2026.08.10.22.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 22:50:22 -0700 (PDT) From: Maulik Shah Date: Tue, 11 Aug 2026 11:20:01 +0530 Subject: [PATCH 1/2] cpuidle: psci: Start CPU-cluster pmdomain OFF when OSI is used Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260811-domain_off_ss3-v1-1-6a0a0fc023f5@oss.qualcomm.com> References: <20260811-domain_off_ss3-v1-0-6a0a0fc023f5@oss.qualcomm.com> In-Reply-To: <20260811-domain_off_ss3-v1-0-6a0a0fc023f5@oss.qualcomm.com> To: Ulf Hansson , "Rafael J. Wysocki" , Daniel Lezcano , Christian Loehle , Sudeep Holla , "Rafael J. Wysocki" , Dmitry Osipenko Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Maulik Shah X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786427415; l=3853; i=maulik.shah@oss.qualcomm.com; s=20240109; h=from:subject:message-id; bh=n3vG1Ouz3Z5dfG3sO3PGglSgElYx/5po7OR/QX+HXZw=; b=hp47SzX2oSIQQDth+AiGTQrZv0cU9EsBKhRwhlX8jToxrRKHixorXMnct9hWJVur1NdokWpa4 oPSV85nibLFCpBmWqKbcVkB8G0dsd9tujf0ueoPWX8fdo6vvEH5wG+u X-Developer-Key: i=maulik.shah@oss.qualcomm.com; a=ed25519; pk=bd9h5FIIliUddIk8p3BlQWBlzKEQ/YW5V+fe759hTWQ= X-Proofpoint-ORIG-GUID: WSdeYIopqq7jxxN444YBea8NSC36gInT X-Proofpoint-Spam-Info: AW1haW4tMjYwODExMDA0NiBTYWx0ZWRfX4b2wuwkGDRNs s1NDC/bpH7L60NrPUV4Z3TeU9d8jIKcUtDK9U+UEOGPXERxggRGm62ezOkD2HZB+CkF3Nb8GnNp YeLdlen8qGGH8bKjXjfaFt0SKIn0DHo= X-Proofpoint-GUID: WSdeYIopqq7jxxN444YBea8NSC36gInT X-Authority-Analysis: v=2.4 cv=NqnhtcdJ c=1 sm=1 tr=0 ts=6a7ab820 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=Ub2yIDUOchdfQrooBeMA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODExMDA0NiBTYWx0ZWRfX30xi/DZOOyqi zzSaT/xtC1gMk4PUiQk1Q/pNNJ+yZXNadgvZk1ILE20d4AG5S9Wo81b/TakWX4CAiF1wvio5ofq 67WEj5RKUDkQa9IhJIZH3ZXObU5BnZGI2nmQml/njFKR1mZ1kFlhpGbNvhAqUQGrVFMuF3RhEIB MdZwUreaGtUMkYDALXFDe62AtNeI2pOtPDSyTnvyUfkSDv0W9Q+u0zo3dqq+FX8TEdrwZB0JVGE 04+b7xqywCTwEE41VC/rl9VZwQe7B0mta0BEYFg/iffB0rXovL+BF+bt5zFwIDj9WrDj2DqgQYg dudgXH4jF864/vM0n0zKfFOT4hB8DRbVaFBkyi6+OFbv73bhL6zrouh0J4L0JJTVR7Ne6jWRsNv Ru9n0ci4Ahs7vNnsjVcnoes4EY/p2jkVyXRrP7JDbDGbDpmnWYOi/CtvcGtU2GVRhV+oB0ieHVV ko+Ftv4bjaIrzaVf/Ig== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-10_06,2026-08-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 impostorscore=0 spamscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608110046 psci_pd_init() always calls pm_genpd_init() with is_off=3Dfalse, so a CPU-cluster pmdomain is marked ON at creation regardless of whether any CPU has actually powered it on yet. The pmdomain's own status tracking (and the power-on notifier chain fired from _genpd_power_on()) is therefore wrong from the outset for OSI mode. A concrete example: hamoa has 3 CPU clusters, each with 4 CPUs, under a single parent system-level pmdomain. Passing "maxcpus=3D4" on the kernel command line limits boot to the first 4 CPUs, so only cluster0 is ever actually powered on. Without this fix, cluster1 and cluster2 are still marked ON at creation regardless, since is_off is always false. Because none of their CPUs ever come online, neither dt_idle_attach_cpu() nor psci_idle_cpuhp_up() ever fires for them, so nothing subsequently drives those two domains to OFF - they stay marked ON for as long as the system runs. When cluster0's CPUs go idle and its pmdomain is powered off, the parent system-level pmdomain still sees cluster1 and cluster2 as ON and therefore never selects a system-level idle state, even though no CPU in those two clusters ever executed. Starting the domain OFF is safe under OSI: - For CPUs already online by the time this driver probes, dt_idle_attach_cpu() explicitly checks cpu_online() and calls pm_runtime_get_sync() on the CPU's attach device, which resolves to this same pmdomain and drives a real power-on immediately. This runs from psci_cpuidle_probe(), a device_initcall, strictly after psci_idle_init_domains()'s core_initcall has already created and marked off every pmdomain, so there is no window where an online CPU's domain is left off with nothing left to turn it on. - For CPUs that come online later, psci_idle_cpuhp_up() (registered via cpuhp_setup_state_nocalls(), which never invokes the callback for already-online CPUs at registration time) powers the domain on through the normal cpuhp AP_ONLINE path. Gate this on use_osi rather than applying it unconditionally: in non-OSI mode psci_pd_init() sets GENPD_FLAG_ALWAYS_ON, which independently blocks genpd_power_off() regardless of is_off, so the domain can never really be off there and marking it is_off=3Dtrue would be misleading noise with no effect. Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using ge= npd") Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Maulik Shah --- drivers/cpuidle/cpuidle-psci-domain.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidl= e-psci-domain.c index b9e4ad7d43a3..fab9de648b17 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -78,7 +78,19 @@ static int psci_pd_init(struct device_node *np, bool use= _osi) /* Use governor for CPU PM domains if it has some states to manage. */ pd_gov =3D pd->states ? &pm_domain_cpu_gov : NULL; =20 - ret =3D pm_genpd_init(pd, pd_gov, false); + /* + * Start the domain in the OFF state when OSI is in use, so that + * genpd's own status tracking (and its power-on notifier chain) + * reflects reality from the outset instead of reporting ON before + * any CPU in the domain has actually requested it. This is safe: + * dt_idle_attach_cpu() runtime-resumes the domain for every CPU + * that is already online by the time this driver probes, and the + * PSCI cpuidle cpuhp callbacks power it on/off for CPUs that come + * online/offline afterwards. When OSI isn't in use, GENPD_FLAG_ALWAYS_ON + * above keeps the domain powered regardless of is_off, so this has + * no effect there. + */ + ret =3D pm_genpd_init(pd, pd_gov, use_osi); if (ret) goto free_pd_prov; =20 --=20 2.43.0 From nobody Tue Sep 29 07:41:36 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 A71A53115BC for ; Tue, 11 Aug 2026 05:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786427431; cv=none; b=R9pzhwCseGHWy99u676f/8Glj6LJNftA23N14AhOzm8dIckHXktPVffB0yZRgpP1TLPqMoV91wFV6Te7HLv+mxkSRpgM1U8gngasFRNTdvBto75Sw7Z7Sfyvpx7iEgOBdESD/ew8lbLpEDjhV50FaPsmZsHDIt1Ww6rYj/w61t8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786427431; c=relaxed/simple; bh=noGCtlEhc01PRgl/TejE7Msr9fur7y8T+UGMXIwtm0c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gBWmqpnZejW00C5orcbmFpWhxfWOHgNFQXpVeOZF0MpoJOStLunDx7nGU8QIeAAKA5DsiGw4JmXT8kq6rAEv0eG7Xjz/CoMMlwEwnocam+tutroBK+GZU1/vxCzrv0lFgi/ZBJ9TEFg7RTaH6zwi9hbsvp5wy9qgB0xgxPyRRvE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=kf2O3pQM; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UziucGwE; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kf2O3pQM"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UziucGwE" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67AMpwfe3047714 for ; Tue, 11 Aug 2026 05:50:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= fGCMCudQPIfNSyE/z15lzExG5h5W9AfLeMiFY/ee9OY=; b=kf2O3pQMYB8pi+MU QHMlTa26UGMqs8WDovc57l/bDQQ9CN/FrrP6q/wywiLDVR6soh5+OLFyFM5dOvfM Opi6f3z8ejQcGvLDFoyOJEvMYupTNBL5H+JGv4rmVJoYWLRATUCiGbOZqpMq4jJT SttIB7ytPmea8fRq4sXoK5tS6rnn1zduX7SXOeiFYen4B4KlCyAO9To6rXOZmuqU y78V+VRO8M6ooH++UXxJWPPulbvY9gMLVuw1vAQwckXroaT7p2OfRYQaY+DCVgEr qIUgNmesNMSdXzHBrS43NMwZnquSz8IaaH1rQZUVuJ4J5pXOHT6jrvuwtMsK8Oq6 Ypq7Ww== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fyjk22kke-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 11 Aug 2026 05:50:28 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c856470fe9fso2039071a12.2 for ; Mon, 10 Aug 2026 22:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786427428; x=1787032228; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fGCMCudQPIfNSyE/z15lzExG5h5W9AfLeMiFY/ee9OY=; b=UziucGwEJGD4XCwhOXPUZyd6iW3VEl5E8AFBOnegRaY4z7nDuJv/5sTcwa8UQoWUg2 4+d2YCMoCixtNBdP14awg9uxnOCTnNWbY9IWAzNbF7DkkHnAymdRBqfzyacwHAiaTXtb M/85cR/ertmUd7ekSZrBcyE+5mLVq5VGzuVPL3zngiFkHZmdYSv2zL1K9afdfRCLFQNM POCxs7L0smOU1JOaDrdTK6LVmV3qSFh8bHaJHbW4RFZ/mo4P2rv9VREmKf2ao5TbMg2I +3Ebm0NCfTWMlYg/NJDa4h4D/JNHThDb9jqEdfsI7VVbSfDlZT1kwwQGVq89c+FtctnW xqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786427428; x=1787032228; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=fGCMCudQPIfNSyE/z15lzExG5h5W9AfLeMiFY/ee9OY=; b=LS7kM3zqHU4q1k4lmYf0ykl6eaHbBIGGhGpptIVWqCDKYJI9lyBRTLsTCzcqZ5vNYy p5chsadvz8wqcFEvzX1K0XrUc9IhVbYa3352YFYULqQO0McLqjtS5DmSEOKIBKRnVq5O JMjHhIrWGe/ShE2xL581winfCzB3lt3ZSL2z75Oe9yshukuzgJJoS/9BM5+Qu/BGM/NQ wbWV0PG3XaKaclz7OwaomkL+DsYSTYeAHmqwePdniE+cNhNTxHB6EoA9rxTx3UarmW42 lJaKjf4aDFq855CPGU3dH0McjQGmSv+xdVNp9IiwspH7rQ6lu1rSbGutjN22FvZh6CLa 7Y2w== X-Forwarded-Encrypted: i=1; AHgh+RodEQduCXk4VlxjxaGRprXBkhYuw/Vt9rLXbdORfQgEyvxQfW8C5D/3sX3gf10rdsrsw3g2FZi2xIybgh4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1/EV3tKH9kt9O2y+b6vvvuuOlfa/mFCcVuuSxXOuRWDJPvfnc 6wDZkRsWXc8b0ZFS8te0lzj9/T561vMAWrrw6Ybm6rYWt2mOMdam3SdoSsNXLWOoLQ51hkzs+dZ OtrMOIss8mYBRi9GoCRlmasWw2NeeinpRqaBP7YRF9r4grkFgl5Kb32TFsyhqsXw0OcQ= X-Gm-Gg: AR+sD10W4/5NvLdREOIgo0SC870q2pdAZPKu0AwNdB20L69dfNmC4GErlUYVVdElGAE VPiX6MBzPSFZpOM9eZGpBHnm9kFc+hJ6is4suN7GmOFJccW7gUBfScpm2nFNnI0hNNJZ2Z19hU3 I99PO72eUJPDLNh4/Aw0beK5M0AQXzY4G0YnoE+FQUV+ekBZPRtDY+fTdwgzCjaroMHmCjfnhJB vOB5Qz7TEfjZ6yHTErHJKq2QK6EvhpwUPWA6LnSn5YV5yHu4Gy6uMb3UOg8IYtTecVoeeMOcGGp 6sKUJGUxzSAf8asFzp/DmiRRpzNql9WRZbwm7f1mrf+79kP2gcO47lTlrrplYCLXhtiD60/kG25 oPR7EEI/iC+fqP8w/7GAhQ50Q2B9P X-Received: by 2002:a17:90b:2689:b0:37f:e1b6:4c7d with SMTP id 98e67ed59e1d1-392ec37c01cmr966947a91.6.1786427428008; Mon, 10 Aug 2026 22:50:28 -0700 (PDT) X-Received: by 2002:a17:90b:2689:b0:37f:e1b6:4c7d with SMTP id 98e67ed59e1d1-392ec37c01cmr966903a91.6.1786427427551; Mon, 10 Aug 2026 22:50:27 -0700 (PDT) Received: from hu-mkshah-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-392d534ab78sm2062289a91.12.2026.08.10.22.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 22:50:27 -0700 (PDT) From: Maulik Shah Date: Tue, 11 Aug 2026 11:20:02 +0530 Subject: [PATCH 2/2] pmdomain: core: Initialize state_idx to deepest state for OFF domains Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260811-domain_off_ss3-v1-2-6a0a0fc023f5@oss.qualcomm.com> References: <20260811-domain_off_ss3-v1-0-6a0a0fc023f5@oss.qualcomm.com> In-Reply-To: <20260811-domain_off_ss3-v1-0-6a0a0fc023f5@oss.qualcomm.com> To: Ulf Hansson , "Rafael J. Wysocki" , Daniel Lezcano , Christian Loehle , Sudeep Holla , "Rafael J. Wysocki" , Dmitry Osipenko Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Maulik Shah X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786427415; l=3169; i=maulik.shah@oss.qualcomm.com; s=20240109; h=from:subject:message-id; bh=noGCtlEhc01PRgl/TejE7Msr9fur7y8T+UGMXIwtm0c=; b=D9am7/oqe122qna9Nn9H1nPHIpqFD1bL2sZOvl7tLN25181E35dmbfujCBe2tD9iPkJPBih/E KbnrOgeVBnNB64D06CJkjFUXgMU5qpDK66xl5dgHjd0dxpUt8CF9pNm X-Developer-Key: i=maulik.shah@oss.qualcomm.com; a=ed25519; pk=bd9h5FIIliUddIk8p3BlQWBlzKEQ/YW5V+fe759hTWQ= X-Proofpoint-Spam-Info: AW1haW4tMjYwODExMDA0NiBTYWx0ZWRfX0YCbkHYv2eHD jv/fYFSewjBgEzScAcnquHVkVwwPZMAZ2BFLsqW2hTyZKzEMBlUKo9wPbaa4t9t54HxRmhaZpuN AMYkbCO+5FfMgOVuTqVDeT/PyB0YZZk= X-Proofpoint-GUID: 3dZHXB4atbnXRSAzC_xf2jN7TaalVDM1 X-Proofpoint-ORIG-GUID: 3dZHXB4atbnXRSAzC_xf2jN7TaalVDM1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODExMDA0NiBTYWx0ZWRfX3MjodgsbRfkO pBltnCYcEj6R5KjYaHRN91jbkFLfEzLIKdfRCIMBt3HQ2q3IQeBNBisp81yECdpgTD4mJIQgFph XYQ5RdRsDqzV0v/LHqVS5A46LviszxrK/n/2cThAje44TlpbbeI4sEUPxAYVZt0232zqxpxVDC4 CVsXuXLNoGYBaDbuW+6tdHbi4Kh4kAX68dcMTUeDUnT96lNbwXK1e0yljQSkTqnkXhGJQILSgbQ z6NrsItqcosH/jLRxot/LIKflSyUkP9u5mzMKvq7L4A1nJwvqPAjI4Sz+KjFcaPETnJwVyfgkiH ETqH+7GKnGq3m1RBPGtIJzL/4gyozR1/wk+B/SEKIegy+KQqOY98c/BJexw4KMjrGomdsh4EHTP nqOcCQTbTC6Al27UGZkyAz/U4hnafT2y24TpLpSgpdJ5UGeNTslRYyNLAlR/ZAOc+qPINEsjgDP d++JS40NFiC5j41Jc6Q== X-Authority-Analysis: v=2.4 cv=eJ4jSnp1 c=1 sm=1 tr=0 ts=6a7ab824 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=Z6difoz2d0IOI9WDWMkA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-10_06,2026-08-10_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608110046 pm_genpd_init() sets genpd->status from is_off but never touches state_idx, which stays at its kzalloc'd value of 0 (dt_idle_pd_alloc()) regardless of is_off. A domain that starts OFF without ever having gone through an actual power-off sequence is therefore left looking like it's parked at its shallowest idle state (state_idx=3D0) instead of its deepest one, even thou= gh it is fully powered down. This is visible on hamoa, where cluster0/1/2 each expose two idle states, CL4 (state_idx=3D0) and CL5 (state_idx=3D1, the deepest). When CPU-cluster genpds are initialised directly into GENPD_STATE_OFF under OSI mode ("cpuidle: psci: Start CPU-cluster pmdomain OFF when OSI is used"), clusters whose CPUs are excluded at boot (e.g. maxcpus=3D4, leaving clusters 1 and 2 untouched) never go through a power-off path, so their state_idx remains 0 instead of the deepest 1. debugfs reports this as "off-0", meaning the domain is off but parked at idle-state 0 (CL4) rather than "off-1", idle-state 1 (CL5): genpd_power_off() and genpd_sync_power_off() both gate parent power-off on every child being at its deepest state index: if (child->state_idx < child->state_count - 1) return; so the parent's check treats these fully-off children as "not yet at deepest state" and refuses to power off, blocking the deepest system-level low-power mode (SS3) from ever being entered. Without this change: $ cat .../power-domain-cpu-cluster1/current_state off-0 $ cat /sys/kernel/debug/qcom_stats/apss Count: 0 Last Entered At: 0 Last Exited At: 0 Accumulated Duration: 0 Fix this at the source: when a domain is initialised OFF, set its state_idx to its deepest state (state_count - 1) instead of leaving it at 0. This makes genpd's reported state consistent with reality for every is_off=3Dtrue caller of pm_genpd_init(), not just the PSCI CPU-cluster case, and requires no special-casing in the parent power-off checks. With this change, the domain correctly reports its deepest state and SS3 is entered normally: $ cat .../power-domain-cpu-cluster1/current_state off-1 $ cat /sys/kernel/debug/qcom_stats/apss Count: 218 Last Entered At: 726792712 Last Exited At: 726950687 Accumulated Duration: 199888773 Fixes: e7d90cfac551 ("PM: domains: Prevent power off for parent unless chil= d is in deepest state") Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Maulik Shah --- drivers/pmdomain/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 842c4169e290..5d96d9eabc1f 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -2409,6 +2409,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn); atomic_set(&genpd->sd_count, 0); genpd->status =3D is_off ? GENPD_STATE_OFF : GENPD_STATE_ON; + if (is_off && genpd->state_count) + genpd->state_idx =3D genpd->state_count - 1; genpd_set_stay_on(genpd, is_off); genpd->sync_state =3D GENPD_SYNC_STATE_OFF; genpd->device_count =3D 0; --=20 2.43.0