From nobody Fri Jul 24 22:56:48 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 ADA194315A; Wed, 22 Jul 2026 15:13:36 +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=1784733218; cv=none; b=nEcJQ+sxeUJka6H2E/xioO36PEU6Vx0lz95tQK1ce3XV3H/l6uvCPdMn3K0TEOFiiR1m/5qJmi2lZcwuXRRIBPjBDi1+vXNsoPl79qS/Lpr+3OEVk55nECvpIm26QK3c34doP06qTyaiBv5RIMUJOVh6ZonTPcZUJBpS7OZdye4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784733218; c=relaxed/simple; bh=y2vls3x2gNwN6HCM1KOY2Lv3qcDk+OrAfe0zg3iWYlA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AX5bpHocpBEL20XcK7vn+SBcVWuBI5MSPKZanky5IV12VWrKqhKwJWg0GRrybXNyM7JQHG1y0sj54jsnxmEmXcU/0nnrwLtT64ADPJLTEtIeArKF7wNsCiCH4lPYJ0Z/jRvWnd8LdQu94wpPg0pY/mqX31po2oDsROkCDYdakYM= 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=ZcerJhnd; 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="ZcerJhnd" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MDWO7Y1155208; Wed, 22 Jul 2026 15:13:07 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= 9m7JLQUoTvBNlHNB4ZSn/XnVf/99ICJmCO1B0yXyh3o=; b=ZcerJhndXZpktCmt Hc159U3hQXH6cH+BZzZjPr7em7z4Y+Ri+L31X9VYdzzXZbLrm/KMjsxbv2cTqPyt erYhHCDhXdiFPQN2sPnBHiZ64FvZXfDcKRterVZveyr1Mh8+OgxeU6Em1TDaYT0T TS0Fg/MkrVYTk4GrQslqAwv5iDde0SgTOd80DJgbiE5BjpoemYsQ/D8jiiVgdNjr AsGMEAj6cH809IRVCKpniwxRhCUQA1Spn/nBuxOswmDAbVYVxS7bq++uKDN0nDJ+ 9sqQ58gQ7wUO+I1LlTK3eOX5aci+eul4hoBF0ejogZNqVAVrpSd+kgCCKKqjI3fd Kx44aQ== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fjrtt23kr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2026 15:13:06 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MFD32w008354; Wed, 22 Jul 2026 15:13:03 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 4fgj3wkww7-1; Wed, 22 Jul 2026 15:13:03 +0000 (GMT) Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 66MFD2Fl008335; Wed, 22 Jul 2026 15:13:03 GMT Received: from hu-ffaruque-hyd.qualcomm.com (hu-ffaruque-hyd.qualcomm.com [10.147.245.31]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 66MFD2oF008314; Wed, 22 Jul 2026 15:13:03 +0000 (GMT) From: Faruque Ansari Date: Wed, 22 Jul 2026 20:43:00 +0530 Subject: [PATCH v2 1/3] power: reset: pscrr: add kernel panic reason tracking 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: <20260722-pscrr-reboot-reason-v2-1-495ba3005953@oss.qualcomm.com> References: <20260722-pscrr-reboot-reason-v2-0-495ba3005953@oss.qualcomm.com> In-Reply-To: <20260722-pscrr-reboot-reason-v2-0-495ba3005953@oss.qualcomm.com> To: Sebastian Reichel , Wim Van Sebroeck , Guenter Roeck , Benson Leung , Tzung-Bi Shih , Oleksij Rempel , Srinivas Kandagatla , Daniel Lezcano Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-msm@vger.org, kernel@pengutronix.de, Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , =?utf-8?q?S=C3=B8ren_Andersen?= , Guenter Roeck , Matti Vaittinen , Ahmad Fatoum , Andrew Morton , avaneesh.dwivedi@oss.qualcomm.com, Umang Chheda , linux-arm-msm@vger.kernel.org, Faruque Ansari X-Mailer: b4 0.14.3 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: ZV9FowBpCHdp6FPmHm5bqcsAPn_Q2fCZ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDE0OSBTYWx0ZWRfX0SZXPnf2UxUW TC3XB03A7i6TKmRWFRc2x9naKDOY3+u5mPaNr9NMXJEUOPbMk+rKE38QapbVqRd61rz3kNNKMky m7PXiO/C7g65xArBNYV7LMKRwK7sxrbouZiI1TBueGklAhz1C0XqrVZM7nNTNv6zZ2ZrHnlGG5m 2k9IqTj5vQoZaubL0H8ZjBNG3Cp9Tsa0wyNH6kTU53gwWe1+pvXag9w5NYAoF/Jth7vh7qaophw tJH4RZCS4UtfSmuSCOzO49d2lOB60USJ/pPPYLmSfsIp9r4RQ8nG39BGkAZHnde5Quflf0jgDw7 0pOwu+2AbFtACl/4Gnp9/qykXJJ7JlfNNepKUD7Qaf+bf7Mf9hhxcRCpewA0Mopw3WiRZDa8Zl3 M6UMX0ARfk9pJtcor4lTCKmyO4+GPNc8jc3sIkJL1oiVjFBdrbLs4O0cmVeY97Hl9xk1ce5+YeD e4TJiAA8iGhb5MJBJFg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDE0OSBTYWx0ZWRfX9nUsjz0V6ZYM YdJfY6nwCOX2/Z9ayvV0udDvvMOc5a/0VszXJxRrnX/G0fYxRCcQ6Ti82OAREQsECCtxu+QX8JW dREMYPzN0a721LxBS2C3L3PVeWIjVrQ= X-Proofpoint-GUID: ZV9FowBpCHdp6FPmHm5bqcsAPn_Q2fCZ X-Authority-Analysis: v=2.4 cv=V8lNF+ni c=1 sm=1 tr=0 ts=6a60de03 cx=c_pps a=Ou0eQOY4+eZoSc0qltEV5Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=g35WXu8YXKVBwXyYHpMA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_04,2026-07-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 adultscore=0 priorityscore=1501 malwarescore=0 clxscore=1011 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220149 Kernel panic resets are not recorded in NVMEM, causing subsequent boots to report PSCR_UNKNOWN and making post-mortem analysis more difficult. Register a panic notifier to preserve the shutdown reason across panic-triggered resets. Add PSCR_KERNEL_PANIC as a dedicated reset reason code and its corresponding reason string to identify kernel panic resets on subsequent boots. Signed-off-by: Faruque Ansari --- drivers/power/reset/pscrr.c | 32 ++++++++++++++++++++++++++++++++ include/linux/power/power_on_reason.h | 1 + include/linux/reboot.h | 1 + kernel/reboot.c | 1 + 4 files changed, 35 insertions(+) diff --git a/drivers/power/reset/pscrr.c b/drivers/power/reset/pscrr.c index 92e8ef97421c..b5906f127e88 100644 --- a/drivers/power/reset/pscrr.c +++ b/drivers/power/reset/pscrr.c @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,7 @@ struct pscrr_core { /* Kobject for sysfs */ struct kobject *kobj; struct notifier_block reboot_nb; + struct notifier_block panic_nb; }; =20 static struct pscrr_core g_pscrr =3D { @@ -136,6 +138,30 @@ static int pscrr_reboot_notifier(struct notifier_block= *nb, return NOTIFY_OK; } =20 +static int pscrr_panic_notifier(struct notifier_block *nb, + unsigned long action, void *unused) +{ + int ret; + struct pscrr_backend *backend; + + backend =3D g_pscrr.backend; + + if (!backend || !backend->ops || !backend->ops->write_reason) + return NOTIFY_OK; + + set_psc_reason(PSCR_KERNEL_PANIC); + ret =3D backend->ops->write_reason(get_psc_reason()); + if (ret) + pr_err("PSCRR: Failed to store reason %d (%s) at panic, err=3D%pe\n", + get_psc_reason(), psc_reason_to_str(get_psc_reason()), + ERR_PTR(ret)); + else + pr_debug("PSCRR: Stored reason %d (%s) at panic.\n", + get_psc_reason(), psc_reason_to_str(get_psc_reason())); + + return NOTIFY_OK; +} + /*----------------------------------------------------------------------*/ /* Sysfs Interface */ /*----------------------------------------------------------------------*/ @@ -349,6 +375,10 @@ int pscrr_core_init(const struct pscrr_backend_ops *op= s) goto err_free; } =20 + /* Setup the panic notifier to persist reason on kernel panic */ + g_pscrr.panic_nb.notifier_call =3D pscrr_panic_notifier; + atomic_notifier_chain_register(&panic_notifier_list, &g_pscrr.panic_nb); + /* Create a kobject and sysfs group under /sys/kernel/pscrr */ g_pscrr.kobj =3D kobject_create_and_add("pscrr", kernel_kobj); if (!g_pscrr.kobj) { @@ -371,6 +401,7 @@ int pscrr_core_init(const struct pscrr_backend_ops *ops) err_kobj_put: kobject_put(g_pscrr.kobj); err_unreg_reboot: + atomic_notifier_chain_unregister(&panic_notifier_list, &g_pscrr.panic_nb); unregister_reboot_notifier(&g_pscrr.reboot_nb); err_free: kfree(g_pscrr.backend); @@ -391,6 +422,7 @@ void pscrr_core_exit(void) kobject_put(g_pscrr.kobj); } =20 + atomic_notifier_chain_unregister(&panic_notifier_list, &g_pscrr.panic_nb); unregister_reboot_notifier(&g_pscrr.reboot_nb); =20 kfree(g_pscrr.backend); diff --git a/include/linux/power/power_on_reason.h b/include/linux/power/po= wer_on_reason.h index bf9501792696..4ac1bdfdc211 100644 --- a/include/linux/power/power_on_reason.h +++ b/include/linux/power/power_on_reason.h @@ -19,5 +19,6 @@ #define POWER_ON_REASON_REGULATOR_FAILURE "regulator failure" #define POWER_ON_REASON_OVER_TEMPERATURE "over temperature" #define POWER_ON_REASON_EC_PANIC "EC panic" +#define POWER_ON_REASON_KERNEL_PANIC "kernel panic" =20 #endif /* POWER_ON_REASON_H */ diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 6477910c6a9e..a492b1652038 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -236,6 +236,7 @@ enum psc_reason { PSCR_REGULATOR_FAILURE, PSCR_OVER_TEMPERATURE, PSCR_EC_PANIC, + PSCR_KERNEL_PANIC, =20 /* Number of reasons */ PSCR_REASON_COUNT, diff --git a/kernel/reboot.c b/kernel/reboot.c index 61e0027b7550..f1df52f8773a 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -1065,6 +1065,7 @@ static const char * const pscr_reason_strs[] =3D { [PSCR_REGULATOR_FAILURE] =3D POWER_ON_REASON_REGULATOR_FAILURE, [PSCR_OVER_TEMPERATURE] =3D POWER_ON_REASON_OVER_TEMPERATURE, [PSCR_EC_PANIC] =3D POWER_ON_REASON_EC_PANIC, + [PSCR_KERNEL_PANIC] =3D POWER_ON_REASON_KERNEL_PANIC, }; =20 /** --=20 2.34.1 From nobody Fri Jul 24 22:56:48 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 CA77F361DCB; Wed, 22 Jul 2026 15:13:37 +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=1784733219; cv=none; b=kL3qtHzyT01QnjSRwBTxMxypoVWj2FToiwNnT7FX9xKKsFa3lIE9vacA3/onxJ5Mqn43T9sysAr1TMmqQ6/FDcLiSfLXmocmVUO/G0OthJro0tmhjA4S/P2V1M3ysa7KYhOzLeRhQgaj12gSye/e9qWcl0yOEQjf2dRqNlcBsmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784733219; c=relaxed/simple; bh=1SEAhKVvKPt75Kqu8x9U2ZorublhrIjQuU/b9rN/V4o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VBXSDQ2vmtXzdlOjITthrpgWfHlBAXRj+juYlTELw0Ovh5zu7JrU434bAcilHR9okiXXtUvAawZDuXAv1nqq37Q27+9PAOlLhShkXXrbzINVp3/jP9/YivApCvvkJE8qR+bz27xg8OeCsSsq/c88wZiWZinjxQ49oMM9JAn37Mo= 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=jZ/4jTSF; 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="jZ/4jTSF" 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 66MDWZQf974008; Wed, 22 Jul 2026 15:13:08 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= 67DLzE/xOfBFWWlKYKzL9oJKbokILOtBIXG/f+P6T2I=; b=jZ/4jTSFBrmOKh2R tzoPUE8RG5G9T0/8VDdkatWyR8Gj1SS0K7yYZb9edtds0jkWBtVftDBYLz7qnkRZ up3PIGLV0Mm93awSbrolrO8rAPE+zxzu1HY61tWQkxwvCGBI8TaF0GOtf8E+6gm/ qTZsGuTm7p99hbrDS43PjJi3DzDUEjGf48hOW1MV0KM0ufHTmu5WqGMVzgnGX8N8 08J3LYhOSaEhTFJ8l7UYk9lSmqkrYrOg/C/grcp0gySiRaGOKoPQWOeSdMjQLY92 oJGRjTk9lHBMonnsY+p13tVI1BcS4yDLypGkXPNTzUgrx5PmXMUtEOlCgiL9uLCu aTwKpQ== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fjuu796ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2026 15:13:07 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MFD32x008354; Wed, 22 Jul 2026 15:13:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 4fgj3wkwwe-1; Wed, 22 Jul 2026 15:13:04 +0000 (GMT) Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 66MFD2Fn008335; Wed, 22 Jul 2026 15:13:04 GMT Received: from hu-ffaruque-hyd.qualcomm.com (hu-ffaruque-hyd.qualcomm.com [10.147.245.31]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 66MFD2oG008314; Wed, 22 Jul 2026 15:13:04 +0000 (GMT) From: Faruque Ansari Date: Wed, 22 Jul 2026 20:43:01 +0530 Subject: [PATCH v2 2/3] power: reset: pscrr: add watchdog pretimeout reason tracking 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: <20260722-pscrr-reboot-reason-v2-2-495ba3005953@oss.qualcomm.com> References: <20260722-pscrr-reboot-reason-v2-0-495ba3005953@oss.qualcomm.com> In-Reply-To: <20260722-pscrr-reboot-reason-v2-0-495ba3005953@oss.qualcomm.com> To: Sebastian Reichel , Wim Van Sebroeck , Guenter Roeck , Benson Leung , Tzung-Bi Shih , Oleksij Rempel , Srinivas Kandagatla , Daniel Lezcano Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-msm@vger.org, kernel@pengutronix.de, Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , =?utf-8?q?S=C3=B8ren_Andersen?= , Guenter Roeck , Matti Vaittinen , Ahmad Fatoum , Andrew Morton , avaneesh.dwivedi@oss.qualcomm.com, Umang Chheda , linux-arm-msm@vger.kernel.org, Faruque Ansari X-Mailer: b4 0.14.3 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: HSUbwy3rFfU0bnzqvy3U6UU8IadgTnxf X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDE0OSBTYWx0ZWRfX2Fe3AubvUv7g nRpf1Yfzncm/xzO7ecX8oFquwsAjrlKQ+CU3hQQ4agvIh/vzrJ5t4WR1X4nDdjUPyRF2gFNHg3N pUnZzRhF9gvpQeMZngXMNBpoa22iZpc= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDE0OSBTYWx0ZWRfX4QtQ/l6/+yFc CNWuKM0qf7lQgp04E0SSgXinNDAK6iDm1T5BlJSTqVudFTZwJwgrFNKfMahBxRVc5pEZtFhjzZ5 /hngH+9zodE2jDycvirqY1GmhEjxPFtiQuYpG+VZecmZTDE2k6z84l5P4GtrYaPRcorI0ItfjQN L62h47oWylMZ1TbtUyNcQVCq1eMKu6KWwg6TAdvQs1xmgXRVAnu/ONE9ds5PtS5BQDVXdABGDaP 6yvc62X8GFTffVs/m3D6bkSd4+7bDiamsBoFNwtYBh5AMBQz9hxOTWfcF3XmVvWc/hQ10z9wSO3 7n25n7jN2rKCKn/Cz3tJ3JPTAnh3+a2pHucSAaljkz8FVjJi3EOEH9YQSRz3Mx7Lp8jvsUaGN5K G/Eq0a9MR3lWaI03ce14GzWNaLkuVRcXyMCp/0RO2BRtE/29KIgxsr8xFi7qM9S15evsVnAmYeD p4LmXvaiUUN4l8J3gfg== X-Proofpoint-GUID: HSUbwy3rFfU0bnzqvy3U6UU8IadgTnxf X-Authority-Analysis: v=2.4 cv=JuTBas4C c=1 sm=1 tr=0 ts=6a60de04 cx=c_pps a=Ou0eQOY4+eZoSc0qltEV5Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=fOviudB5TvK5EqJ1EysA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_04,2026-07-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 adultscore=0 phishscore=0 clxscore=1011 bulkscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220149 Watchdog pretimeout resets are not recorded with a dedicated reset reason, causing subsequent boots to report PSCR_UNKNOWN and making it difficult to distinguish them from other unexpected resets. Add PSCR_WATCHDOG_PRETIMEOUT as a dedicated reset reason code and prevent the panic notifier from overwriting a watchdog pretimeout reason with PSCR_KERNEL_PANIC when the pretimeout governor triggers a panic. Signed-off-by: Faruque Ansari --- drivers/power/reset/pscrr.c | 7 ++++++- include/linux/power/power_on_reason.h | 1 + include/linux/reboot.h | 1 + kernel/reboot.c | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/reset/pscrr.c b/drivers/power/reset/pscrr.c index b5906f127e88..5b107c62fe82 100644 --- a/drivers/power/reset/pscrr.c +++ b/drivers/power/reset/pscrr.c @@ -149,7 +149,12 @@ static int pscrr_panic_notifier(struct notifier_block = *nb, if (!backend || !backend->ops || !backend->ops->write_reason) return NOTIFY_OK; =20 - set_psc_reason(PSCR_KERNEL_PANIC); + /* + * Do not overwrite a previously recorded watchdog pretimeout reason + * during panic handling. + */ + if (get_psc_reason() !=3D PSCR_WATCHDOG_PRETIMEOUT) + set_psc_reason(PSCR_KERNEL_PANIC); ret =3D backend->ops->write_reason(get_psc_reason()); if (ret) pr_err("PSCRR: Failed to store reason %d (%s) at panic, err=3D%pe\n", diff --git a/include/linux/power/power_on_reason.h b/include/linux/power/po= wer_on_reason.h index 4ac1bdfdc211..c5846c0ccde4 100644 --- a/include/linux/power/power_on_reason.h +++ b/include/linux/power/power_on_reason.h @@ -20,5 +20,6 @@ #define POWER_ON_REASON_OVER_TEMPERATURE "over temperature" #define POWER_ON_REASON_EC_PANIC "EC panic" #define POWER_ON_REASON_KERNEL_PANIC "kernel panic" +#define POWER_ON_REASON_WATCHDOG_PRETIMEOUT "watchdog pretimeout" =20 #endif /* POWER_ON_REASON_H */ diff --git a/include/linux/reboot.h b/include/linux/reboot.h index a492b1652038..fccbffc9dbef 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -237,6 +237,7 @@ enum psc_reason { PSCR_OVER_TEMPERATURE, PSCR_EC_PANIC, PSCR_KERNEL_PANIC, + PSCR_WATCHDOG_PRETIMEOUT, =20 /* Number of reasons */ PSCR_REASON_COUNT, diff --git a/kernel/reboot.c b/kernel/reboot.c index f1df52f8773a..629002a951c2 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -1066,6 +1066,7 @@ static const char * const pscr_reason_strs[] =3D { [PSCR_OVER_TEMPERATURE] =3D POWER_ON_REASON_OVER_TEMPERATURE, [PSCR_EC_PANIC] =3D POWER_ON_REASON_EC_PANIC, [PSCR_KERNEL_PANIC] =3D POWER_ON_REASON_KERNEL_PANIC, + [PSCR_WATCHDOG_PRETIMEOUT] =3D POWER_ON_REASON_WATCHDOG_PRETIMEOUT, }; =20 /** --=20 2.34.1 From nobody Fri Jul 24 22:56:48 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 391A037646C; Wed, 22 Jul 2026 15:13:37 +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=1784733219; cv=none; b=NLyDcmX0JIsnAhyNkBHchLAW6GxVbgZpMgnJww5hiMrDin6E1UPsrzDnMUB3jbe3s7eB5W2gH7QSovxRRSv1kUxBHNhmDoTkarJ3AfwBjL52fpSHzITeZdbEX++ZXRx9CX/PMogXCKJFdo5RIDE9FSRpm4ucpv289B2Nzk1X7sI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784733219; c=relaxed/simple; bh=ndjeGxQkD4uKKZwGNqT3Zawn7Cw0coTQdfp90BYZHR0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fs1BP88ipxR0yIPQcmzN5AVu3IoxCkdPxVCGi102oPZnf9/8ENaE8xb3VBkZe975DTnb9pnhhGeL30ljIDS3FKHabl0hY4MxkDnbwYUURsW+bskwk4eikv/alP09wq+duvUyJm8qVO+fVTesYF6AQM8mA1qUK+DokKdvB444v9c= 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=LvLLz8BI; 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="LvLLz8BI" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MDWYaT891466; Wed, 22 Jul 2026 15:13:08 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= Naf1jXaUY7FsoPBxaL+DYSY1VTGS3cISXibfNYXEmIo=; b=LvLLz8BIWMr8/gfW pcQoQt4BOsm1bfelBcIyoT2Nh/nYwGPrpWPlojrUT2VRv8eWaWA/ShD2OMLDNjMN Fo2y+ybDZCFUq3yXSejfNiML3amlFCAb4UjQjd++4W+EGtdes2qey44A/inJgiOY VrFcmMgXj16RI57WAtZJSWrIACAB8tLsGCKczIRcS/20nYy+OrWJNl8b9bJNvVsP zZCZLyouqHiYkhHBJo61GTr/VsZn93Vq201ga186eDG/h5VCvETrNLrMwgKSAwpY kVIXygY2KPFCOMuiht+LSiv/ptZ315aUBQyKl7hTmA+jiwyqdiL0x+EWBoHvUjNS 181kKQ== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fjxm10gue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2026 15:13:08 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 66MFD3Nt008341; Wed, 22 Jul 2026 15:13:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 4fgj3wkwwk-1; Wed, 22 Jul 2026 15:13:04 +0000 (GMT) Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 66MFD2Fp008335; Wed, 22 Jul 2026 15:13:04 GMT Received: from hu-ffaruque-hyd.qualcomm.com (hu-ffaruque-hyd.qualcomm.com [10.147.245.31]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 66MFD2oH008314; Wed, 22 Jul 2026 15:13:04 +0000 (GMT) From: Faruque Ansari Date: Wed, 22 Jul 2026 20:43:02 +0530 Subject: [PATCH v2 3/3] watchdog: pretimeout: record PSC reason on watchdog pretimeout 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: <20260722-pscrr-reboot-reason-v2-3-495ba3005953@oss.qualcomm.com> References: <20260722-pscrr-reboot-reason-v2-0-495ba3005953@oss.qualcomm.com> In-Reply-To: <20260722-pscrr-reboot-reason-v2-0-495ba3005953@oss.qualcomm.com> To: Sebastian Reichel , Wim Van Sebroeck , Guenter Roeck , Benson Leung , Tzung-Bi Shih , Oleksij Rempel , Srinivas Kandagatla , Daniel Lezcano Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-msm@vger.org, kernel@pengutronix.de, Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , =?utf-8?q?S=C3=B8ren_Andersen?= , Guenter Roeck , Matti Vaittinen , Ahmad Fatoum , Andrew Morton , avaneesh.dwivedi@oss.qualcomm.com, Umang Chheda , linux-arm-msm@vger.kernel.org, Faruque Ansari X-Mailer: b4 0.14.3 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDE0OSBTYWx0ZWRfX7ty8fhFTmhr3 W7zqqIDs+I0Motkd3awLZ65Y4y9TCY6SgoZCRPqUIPp8j5Dscrsu47n+fGmv0yquajs1RWOl+Ta GtDUS6GEtfZbkmuA0fNdb0IkcysnGFE= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDE0OSBTYWx0ZWRfXyQArMejeT2l3 zn4wn1aBgkNTjpJW8T3aA0KQ4lT4UhQDfdWf2lXHG4r4+b3NpYciIc3eWKhyDDhDGDNBcGV2KmL Q6hbsH/ua6donP/PglFrr5mjKVOlCWVi2R7sQJLk8E22YuonT0W31LE80INQWfjF4SfynKSn9py n4n1+/WD7piDV/kRy0v4OhvXTz5YmwqGxvM5sPbWp+Y0jif9dp/1Tiem9m8HDvM+wlqkFSmgkfY Xo3j2Q65zjoWHnFe8tR6SRVt2Oam/Ky0KOafY+CqhdEiS+g+NscyosZooMkBRjHEqeg1/lFIh/e FOzj1TA5pd+R/ILzu0R5uMHFipE8Lyr3l76c5BWgq4AWf8QQaIFcMgrV+5B4onlMIWhkujJRVAK 2HRk8aoRgZZ8pK/aeBF87/KLPWjbPaG0rR6eP/B1n9iQuBkSDD38u9Pgsdu0jQqPxkt+Bs5CVDX pZFR5TOvC7MzRxZIXoQ== X-Authority-Analysis: v=2.4 cv=Rsv16imK c=1 sm=1 tr=0 ts=6a60de04 cx=c_pps a=Ou0eQOY4+eZoSc0qltEV5Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=u0fiqyGv5R-uId_FV4oA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: JiITKbEK0NW0dweN4F1L-azHAo4IZkJo X-Proofpoint-ORIG-GUID: JiITKbEK0NW0dweN4F1L-azHAo4IZkJo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_04,2026-07-22_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 spamscore=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1011 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220149 Update the PSC reset reason by invoking set_psc_reason(PSCR_WATCHDOG_PRETIM= EOUT) from watchdog_notify_pretimeout() before either the panic or noop governor runs, so the reset cause is committed to persistent storage before the system goes down. Signed-off-by: Faruque Ansari --- drivers/watchdog/watchdog_pretimeout.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/watchdog/watchdog_pretimeout.c b/drivers/watchdog/watc= hdog_pretimeout.c index 02e09b9e396d..ea48d4eca4aa 100644 --- a/drivers/watchdog/watchdog_pretimeout.c +++ b/drivers/watchdog/watchdog_pretimeout.c @@ -4,6 +4,7 @@ */ =20 #include +#include #include #include #include @@ -103,6 +104,8 @@ void watchdog_notify_pretimeout(struct watchdog_device = *wdd) { unsigned long flags; =20 + set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT); + spin_lock_irqsave(&pretimeout_lock, flags); if (!wdd->gov) { spin_unlock_irqrestore(&pretimeout_lock, flags); --=20 2.34.1