From nobody Fri Oct 2 04:30:17 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 C24C1391E59; Wed, 5 Aug 2026 08:55:37 +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=1785920139; cv=none; b=qcWeiOH/i7A05G9z56dOixRPBOH502e9AxkIsrZ2J1bL3aCEZsmxIBYzPMcBWpCuu7NrrumeC6Yin4CXyykehvaJ9qqXjRH5dqu8jtHBGqgdn7uh4Slmeq2rKuVKHhl6y4CRbtL+KCmv533VsTPb9nOPJtrNle9qyOXtINvaVeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785920139; c=relaxed/simple; bh=17xrdJIWU4ZH/JxF9fsfn3sGYVwjviG/2kKacoqnHRg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cziTLNMeBQOaypYWCieMRS9qFxYB5nmZQVumP/cfOkWh9UE+Ng+BojxiQ2jqBOqD+XBdpkq99MC3wmq7WY9KYTdAw7AKv6K8+Lhn0oSn/KBM4TIUfaHoC4sKpIsXrHLmH+hIFDOhu3FmKCDu9mfITOjf9lcrAEt2AQlokRV02vA= 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=VhqNp4x+; 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="VhqNp4x+" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6758db0S1713296; Wed, 5 Aug 2026 08:55:11 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= nRfsZhCcwjHwU9yHOJWvrhAiTLSvqkBHCQCwWwnd708=; b=VhqNp4x+HSOL6vT2 YtthAT4fCucVY9iVlP6enxW6laO3XiZR8wIUTtCKZOeGZ57intPflz4m7r1TxFkv DsaGOWlymZOYQjQ3MN9hjhYWHwOj98Pmih8PA+x/ZBa0t5hkgJbL2HBXg2QOju7C AMHTCgockSyQbMGr+RgFZxysd3J/Wkzj9a0xS3yP7b8QoxbV0f8QAyb16+fB66XL Xld7khvakJsYthwSqK6cn+TVjt1kxWrOmSY226zvDxgiZAlb6QOUJ1w8XOa6+SX9 IOexqys0TudCN1NmHOvMyAU/oK9u7keJNctUe+tJ0UvdvOo+n7e29/DRItWoMvtF 4Vj/gQ== Received: from aptaippmta02.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com [103.229.16.4]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fuwbqs87c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Aug 2026 08:55:11 +0000 (GMT) Received: from pps.filterd (APTAIPPMTA02.qualcomm.com [127.0.0.1]) by APTAIPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 6758t5iG007279; Wed, 5 Aug 2026 08:55:09 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APTAIPPMTA02.qualcomm.com (PPS) with ESMTP id 4fs9vje9u3-1; Wed, 05 Aug 2026 08:55:09 +0000 (GMT) Received: from APTAIPPMTA02.qualcomm.com (APTAIPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 6758t5qF007272; Wed, 5 Aug 2026 08:55:09 GMT Received: from hu-ffaruque-hyd.qualcomm.com (smtphost-taiwan.qualcomm.com [10.249.136.33]) by APTAIPPMTA02.qualcomm.com (PPS) with ESMTP id 6758t23K006999; Wed, 05 Aug 2026 08:55:09 +0000 (GMT) From: Faruque Ansari Date: Wed, 05 Aug 2026 14:24:55 +0530 Subject: [PATCH v4 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: <20260805-pscrr-reboot-reason-v4-1-54ef517084cc@oss.qualcomm.com> References: <20260805-pscrr-reboot-reason-v4-0-54ef517084cc@oss.qualcomm.com> In-Reply-To: <20260805-pscrr-reboot-reason-v4-0-54ef517084cc@oss.qualcomm.com> To: Sebastian Reichel , Wim Van Sebroeck , Guenter Roeck , Benson Leung , Tzung-Bi Shih , Oleksij Rempel , Srinivas Kandagatla , Daniel Lezcano , Pengutronix Kernel Team Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-msm@vger.kernel.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 , Faruque Ansari X-Mailer: b4 0.14.3 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: xOfMG28_w4WPmLuwkXfF6MUGX-m331ng X-Authority-Analysis: v=2.4 cv=B+uJFutM c=1 sm=1 tr=0 ts=6a72fa6f cx=c_pps a=nuhDOHQX5FNHPW3J6Bj6AA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=opvmgqTE--nunqmWsLMA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: xOfMG28_w4WPmLuwkXfF6MUGX-m331ng X-Proofpoint-Spam-Info: AW1haW4tMjYwODA1MDA2OSBTYWx0ZWRfX7AIBr8bidKi0 29zjRZX65XQOYCJOwN9wnsVpJwK3H8yPgTCiAKMUGSrCRIJsnfr73wdcBrN+ITeZUJ0YjE7Ues5 fC55MdPhxQtdA5FjmNLEGa0YoC1iCgA= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA1MDA2OSBTYWx0ZWRfXys5Sc6MjGtDQ o7y0kuvpuepV1HaXKWfRqPjRewP6sXDzlZAJxRgFkOiN6UhIgq3eqPF/DbPfJyrjDh02RAoOQpm LU+j77PLMua14YWlXT8oVEKoPhbKASIBdH+yD3ocv7XPl6HARgc7hOgsm7ag3EbGhQId230V8hk nN6B7m5oObSOBnvBkw2xskp2xjCHw1K9C1+AwFL48B+XVu/E8Jvy9vmNKveLaGmy1Wg6qVWqWb2 jFSnqZWJ3BEKFmr0hB4GBA0n8G1pZiH4vf3gnD5Zi4gR/pEUm2o/eRErxpKt8Kl8ivzet0KJNVr OPKUP5+ErnlIaMkDWy/6644xFcKa+TnczSfioyGTzdUkpyAZzBb0/vch+J+ZjOlcFjPw3wdzfiZ Qed4vRmbH/Uly7Jx2qzsGpgtt6m+lBgn7vF3T9B1GuPBoF+0O6oxMAXmcvawPkW2hZB8zASUQtq XdBWXXI1VlNEppWVFxA== 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-05_03,2026-08-04_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608050069 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/pscrr.c | 27 +++++++++++++++++++++++++++ include/linux/power/power_on_reason.h | 1 + include/linux/reboot.h | 3 +++ kernel/reboot.c | 1 + 4 files changed, 32 insertions(+) diff --git a/drivers/power/reset/pscrr/pscrr.c b/drivers/power/reset/pscrr/= pscrr.c index 6f23f4c4f590..8c45b84059a9 100644 --- a/drivers/power/reset/pscrr/pscrr.c +++ b/drivers/power/reset/pscrr/pscrr.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -519,6 +520,29 @@ static struct notifier_block pscrr_reboot_nb =3D { .notifier_call =3D pscrr_reboot_notifier, }; =20 +/* + * Panic notifier: record that the machine went down through a kernel pani= c, so + * the cause is visible on the next boot. Runs in atomic panic context, so= the + * provider list is walked without pscrr_lock - providers no longer come o= r go + * once the machine is going down. + */ +static int pscrr_panic_notifier(struct notifier_block *nb, + unsigned long action, void *unused) +{ + struct pscrr_provider_dir *dir; + + set_psc_reason(PSCR_KERNEL_PANIC); + + list_for_each_entry(dir, &pscrr_dirs, node) + pscrr_do_record(dir, get_psc_reason()); + + return NOTIFY_DONE; +} + +static struct notifier_block pscrr_panic_nb =3D { + .notifier_call =3D pscrr_panic_notifier, +}; + /*----------------------------------------------------------------------*/ /* Built-in provider: device-tree /chosen/reset-source */ /*----------------------------------------------------------------------*/ @@ -611,6 +635,8 @@ static int __init pscrr_core_init(void) return ret; } =20 + atomic_notifier_chain_register(&panic_notifier_list, &pscrr_panic_nb); + pscrr_register_reset_source(); =20 return 0; @@ -619,6 +645,7 @@ static int __init pscrr_core_init(void) static void __exit pscrr_core_exit(void) { pscrr_provider_unregister(&pscrr_reset_source_provider); + atomic_notifier_chain_unregister(&panic_notifier_list, &pscrr_panic_nb); unregister_reboot_notifier(&pscrr_reboot_nb); kobject_put(pscrr_root); pscrr_root =3D NULL; diff --git a/include/linux/power/power_on_reason.h b/include/linux/power/po= wer_on_reason.h index 13e61ace14f5..8c99bdd75021 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_EXTERNAL "external reset" +#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 13f004ad1066..a117dd5eaecd 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -241,6 +241,8 @@ extern void orderly_reboot(void); * * @PSCR_XTAL_FAIL: Reset caused by a crystal oscillator failure. * + * @PSCR_KERNEL_PANIC: Reset that followed a kernel panic. + * * @PSCR_REASON_COUNT: Number of defined power state change reasons. This * value is useful for range checking and potential future extensions * while maintaining compatibility. @@ -264,6 +266,7 @@ enum psc_reason { PSCR_RESET_BUTTON, PSCR_CPU_CLK_FAIL, PSCR_XTAL_FAIL, + PSCR_KERNEL_PANIC, =20 /* Number of reasons */ PSCR_REASON_COUNT, diff --git a/kernel/reboot.c b/kernel/reboot.c index 75af5d763465..979ecf3b093c 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -1109,6 +1109,7 @@ static const struct psc_reason_desc psc_reason_descs[= ] =3D { [PSCR_RESET_BUTTON] =3D { "reset-button", POWER_ON_REASON_RST_BTN }, [PSCR_CPU_CLK_FAIL] =3D { "cpu-clock-failure", POWER_ON_REASON_CPU_CLK_F= AIL }, [PSCR_XTAL_FAIL] =3D { "crystal-failure", POWER_ON_REASON_XTAL_FAIL }, + [PSCR_KERNEL_PANIC] =3D { "kernel-panic", POWER_ON_REASON_KERNEL_PANIC= }, }; =20 /** --=20 2.34.1 From nobody Fri Oct 2 04:30:17 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 86AF23EDE54; Wed, 5 Aug 2026 08:55:41 +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=1785920142; cv=none; b=IHTRpX7QY1eA3lKj0p5jMnef34pjMnaP9WPGMGH/0C2Kx8lgYn6Satt52iDj1sFWrnPl2dBqaQYaqKctMfD2u1ikKIDYOqttY7Q4Xm9MXT0134+WBZdBXGhvLV7OxvMTT4Yr+/Sr3SY4f5DO7UbimwzWBUmhTh86LtvkIp4991U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785920142; c=relaxed/simple; bh=NjF2VU9Ny2tzC6HpF2Z0lSuw54Cg6Xb1lz8yuOc1+7Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m1thqNCB/oSaS5Z+59bifKZctsHbgUN2I96AaKL/fOMahLNAQg/7nJj5FLoVz7tyoAZyt8R3wNmd7e4sO1ibxhLznQCvvxXxibC8CfV5rdhrDaqpmbHa+y//BbKv6Zm5xhgiUh4LM0XHMSRH0HLUzuERhFzhL4o+cw1VN1Ddb4I= 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=afUez2j6; 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="afUez2j6" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6758dGK13540227; Wed, 5 Aug 2026 08:55:15 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= wbmgDVw4Px5OxkOJSyquIQxe/s4Q8SySnQtsDIoAxD4=; b=afUez2j61Usu80m4 +W83yAx6u6VdUxtN3bwpwRi4F4/Y8F1YacijtFEXE76yGTLLuKlgprnRDKyupYdN +/3WzE8eN9N5p4Fqc84nsq+BQIFzuGcBWSmb7yfE9nzfVyfgNrxxkp8yP3t5DHwv W2St94lxMvgM4l4TUF/W/JL/NfBANYAsxCFuKqDpMCiQxUy8/BpqBb1+UXe9mSfk NJtJBQf2TE8m1MfiekckuDcfpWUJXEZttBKRSUzfefdU4PRAHMOWgqyEP4CA2It3 mPqvpKL3y+sATtsBEkEqmybVByOtnhororCtbmSHKVMTuwgnhrZHth3yyqSMeyAb sRTyyw== Received: from aptaippmta02.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com [103.229.16.4]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fuu3uhryk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Aug 2026 08:55:15 +0000 (GMT) Received: from pps.filterd (APTAIPPMTA02.qualcomm.com [127.0.0.1]) by APTAIPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 6758tCt9007341; Wed, 5 Aug 2026 08:55:12 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APTAIPPMTA02.qualcomm.com (PPS) with ESMTP id 4fs9vje9uf-1; Wed, 05 Aug 2026 08:55:12 +0000 (GMT) Received: from APTAIPPMTA02.qualcomm.com (APTAIPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 6758t5qH007272; Wed, 5 Aug 2026 08:55:12 GMT Received: from hu-ffaruque-hyd.qualcomm.com (smtphost-taiwan.qualcomm.com [10.249.136.33]) by APTAIPPMTA02.qualcomm.com (PPS) with ESMTP id 6758t23L006999; Wed, 05 Aug 2026 08:55:12 +0000 (GMT) From: Faruque Ansari Date: Wed, 05 Aug 2026 14:24:56 +0530 Subject: [PATCH v4 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: <20260805-pscrr-reboot-reason-v4-2-54ef517084cc@oss.qualcomm.com> References: <20260805-pscrr-reboot-reason-v4-0-54ef517084cc@oss.qualcomm.com> In-Reply-To: <20260805-pscrr-reboot-reason-v4-0-54ef517084cc@oss.qualcomm.com> To: Sebastian Reichel , Wim Van Sebroeck , Guenter Roeck , Benson Leung , Tzung-Bi Shih , Oleksij Rempel , Srinivas Kandagatla , Daniel Lezcano , Pengutronix Kernel Team Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-msm@vger.kernel.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 , Faruque Ansari X-Mailer: b4 0.14.3 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYwODA1MDA2OSBTYWx0ZWRfX3tqEYwWxWSTD ZfuYyAwdfbTU/qfSMwOchuhdva33gx6d+AUhOTviRm4K4kkG6HfEtYj+AcHG0HN0TJCLakXLgVE DHu8PJliWAYtXJF1PIsH/gfc5Gtb/Ns= X-Proofpoint-GUID: M_vJUxkXNkwqrLn46A89CFAhJIruwJN5 X-Authority-Analysis: v=2.4 cv=B5aJFutM c=1 sm=1 tr=0 ts=6a72fa73 cx=c_pps a=nuhDOHQX5FNHPW3J6Bj6AA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=ynidK1FTdYmqK0Z_2qMA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: M_vJUxkXNkwqrLn46A89CFAhJIruwJN5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA1MDA2OSBTYWx0ZWRfX+k4Tixd2TSpD 5XXdISWYJ868PM2ITV03t9Q+B2PNzRMQTtpYIobQ+sZwci3DGj/XRadpOetojaGsmC29FyFsCi4 RxzIq/jMWp8j2mYSv/9O8pKBvTJ5xFclHunp1hCkq+XjXAOo9spCJQ+B2t1Q7PQqmZDYiEgsd4u VJROCOL0ryLHihJ5kKBCqojQij8e3Xz5lx14zC3/8EETX8NdfP8uSCXx/4ybHhS0I23B63NuvPr EXLQTRy4lEBUA05B8+CVRPnfvBi5C0e0/FWa6nQuOqZOWyrjMEC/99FMLygTTieN6SyOoPCup9o jzj/w8kwykIgYiDFK8P/obeBW55EhuiRaCjyRO25UprhJ0CxoQG09Q0bTaxHGsKEAV/KGhJgHPo MzKk89wfruoJs7jncxz13/h1UAYqU7mWqKUDk2vJnbULkR6sAA+ndW55UVagHd0BYVOighO0/4M WqGsCW/sWdlvudfTnqg== 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-05_03,2026-08-04_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 impostorscore=0 clxscore=1015 spamscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608050069 Watchdog pretimeout resets are not recorded with a dedicated 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 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/pscrr.c | 11 +++++++---- include/linux/power/power_on_reason.h | 1 + include/linux/reboot.h | 4 ++++ kernel/reboot.c | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/power/reset/pscrr/pscrr.c b/drivers/power/reset/pscrr/= pscrr.c index 8c45b84059a9..b7e6239e207e 100644 --- a/drivers/power/reset/pscrr/pscrr.c +++ b/drivers/power/reset/pscrr/pscrr.c @@ -529,12 +529,15 @@ static struct notifier_block pscrr_reboot_nb =3D { static int pscrr_panic_notifier(struct notifier_block *nb, unsigned long action, void *unused) { - struct pscrr_provider_dir *dir; =20 - set_psc_reason(PSCR_KERNEL_PANIC); + /* + * Do not overwrite a watchdog pretimeout reason already set by the + * pretimeout path before it triggered this panic. + */ + if (get_psc_reason() !=3D PSCR_WATCHDOG_PRETIMEOUT) + set_psc_reason(PSCR_KERNEL_PANIC); =20 - list_for_each_entry(dir, &pscrr_dirs, node) - pscrr_do_record(dir, get_psc_reason()); + pscrr_record_current(); =20 return NOTIFY_DONE; } diff --git a/include/linux/power/power_on_reason.h b/include/linux/power/po= wer_on_reason.h index 8c99bdd75021..8e3889fa43ef 100644 --- a/include/linux/power/power_on_reason.h +++ b/include/linux/power/power_on_reason.h @@ -21,5 +21,6 @@ #define POWER_ON_REASON_EC_PANIC "EC panic" #define POWER_ON_REASON_EXTERNAL "external reset" #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 a117dd5eaecd..6d5ecc6cdc00 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -243,6 +243,9 @@ extern void orderly_reboot(void); * * @PSCR_KERNEL_PANIC: Reset that followed a kernel panic. * + * @PSCR_WATCHDOG_PRETIMEOUT: Recorded when a watchdog pretimeout fires, b= efore + * the pretimeout governor brings the system down. + * * @PSCR_REASON_COUNT: Number of defined power state change reasons. This * value is useful for range checking and potential future extensions * while maintaining compatibility. @@ -267,6 +270,7 @@ enum psc_reason { PSCR_CPU_CLK_FAIL, PSCR_XTAL_FAIL, PSCR_KERNEL_PANIC, + PSCR_WATCHDOG_PRETIMEOUT, =20 /* Number of reasons */ PSCR_REASON_COUNT, diff --git a/kernel/reboot.c b/kernel/reboot.c index 979ecf3b093c..fad4ef9681a6 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -1110,6 +1110,7 @@ static const struct psc_reason_desc psc_reason_descs[= ] =3D { [PSCR_CPU_CLK_FAIL] =3D { "cpu-clock-failure", POWER_ON_REASON_CPU_CLK_F= AIL }, [PSCR_XTAL_FAIL] =3D { "crystal-failure", POWER_ON_REASON_XTAL_FAIL }, [PSCR_KERNEL_PANIC] =3D { "kernel-panic", POWER_ON_REASON_KERNEL_PANIC= }, + [PSCR_WATCHDOG_PRETIMEOUT] =3D { "watchdog-pretimeout", POWER_ON_REASON_W= ATCHDOG_PRETIMEOUT }, }; =20 /** --=20 2.34.1 From nobody Fri Oct 2 04:30:17 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 B9F9B3E7BB5; Wed, 5 Aug 2026 08:55:44 +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=1785920146; cv=none; b=HldAP00NI2Ko4ltGlr5OlsWoczzjY3Bb8dQPE+8JgtbBnskViy/trj8JJ1B43IuP3L1IF1/rMyILFY2gunLLSAAyxArBDLauH66v3s1C++v9byBGu04lf/n2hHhOEH5Yqc9eiSd3xnhhmgLVvoOkOK4ofkKMAbT2e+L6XkBnR00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785920146; c=relaxed/simple; bh=+Q2bIZm/6vGOK6/QnjdCZNoOFsyw0U60p4/Bdc4+eU8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l6LPhh6fYZRXtsDeNemySbwEUNpsQT9szX3+GiP3ey7K+XPvGaqLZA9QT9wwYO9Vy+CTzKivKRFcMvibEjRlcVOuZ/crqS08JgCzBZDYH/UHBFn5prZnQpOSAL9rDBEd4zHspQi0UNKxdVviPm39H8p+qBtzW/+xELtKUcsOmFc= 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=d8PVx76u; 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="d8PVx76u" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6758dAO42128928; Wed, 5 Aug 2026 08:55:19 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= BkTJNshVqHa3mBbTpFv2gIiMyHVHhJZBrdr/LAVLnz4=; b=d8PVx76uHxKOkalm HGCBtTyZGlG8pyXaIc+v1HxRzVvnTXULM/U5mPgRw0+ajZvpqZhvRaT8cSm+Bf8X qzuu6MfahyYphD0qfdCaDyAncXeuo4YZNF3JzW3SqR7+lj0k0A5tWrfmGnzzoVzJ HRl2U73a0zyk1uSuzXqnfdNDUVxpjHluwCxh/V/0Ex8tzr3BU8had3d3RdMSLjDL F2WBAaYNgHjPmwiig2SrTf/qMk+JT1xc76Uy/h5M0ywzuOfkkQQLudujUlKuFTXy 4MFbXbPeyJXHDJ7UIgofvBUHmT4lw+rCdbbUgxhP8jjV9/n5PAaILQeLZIYBDjZF Y242xg== Received: from aptaippmta02.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com [103.229.16.4]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fv1qg83k6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Aug 2026 08:55:18 +0000 (GMT) Received: from pps.filterd (APTAIPPMTA02.qualcomm.com [127.0.0.1]) by APTAIPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 6758tGFq007373; Wed, 5 Aug 2026 08:55:16 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APTAIPPMTA02.qualcomm.com (PPS) with ESMTP id 4fs9vje9uy-1; Wed, 05 Aug 2026 08:55:16 +0000 (GMT) Received: from APTAIPPMTA02.qualcomm.com (APTAIPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 6758t5qJ007272; Wed, 5 Aug 2026 08:55:15 GMT Received: from hu-ffaruque-hyd.qualcomm.com (smtphost-taiwan.qualcomm.com [10.249.136.33]) by APTAIPPMTA02.qualcomm.com (PPS) with ESMTP id 6758t23M006999; Wed, 05 Aug 2026 08:55:15 +0000 (GMT) From: Faruque Ansari Date: Wed, 05 Aug 2026 14:24:57 +0530 Subject: [PATCH v4 3/3] watchdog: pretimeout: update PSC reason in panic pretimeout governor 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: <20260805-pscrr-reboot-reason-v4-3-54ef517084cc@oss.qualcomm.com> References: <20260805-pscrr-reboot-reason-v4-0-54ef517084cc@oss.qualcomm.com> In-Reply-To: <20260805-pscrr-reboot-reason-v4-0-54ef517084cc@oss.qualcomm.com> To: Sebastian Reichel , Wim Van Sebroeck , Guenter Roeck , Benson Leung , Tzung-Bi Shih , Oleksij Rempel , Srinivas Kandagatla , Daniel Lezcano , Pengutronix Kernel Team Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-msm@vger.kernel.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 , Faruque Ansari X-Mailer: b4 0.14.3 X-QCInternal: smtphost X-QCInternal: smtphost X-Authority-Analysis: v=2.4 cv=I+hVgtgg c=1 sm=1 tr=0 ts=6a72fa76 cx=c_pps a=nuhDOHQX5FNHPW3J6Bj6AA==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=_jlGtV7tAAAA:8 a=FYyizyoliohAzulCZuQA:9 a=QEXdDO2ut3YA:10 a=nlm17XC03S6CtCLSeiRr:22 X-Proofpoint-ORIG-GUID: VdTel7NyE5h9VEtV_l2cg_NPQRWn0vTS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA1MDA2OSBTYWx0ZWRfX0nFr1/4VJHZT JfbuNvDC0MdjauioOa+7+prQV6enqkJvELI1R1FUJoUY5wnSyy8mQhhQPeFLS4F3X1+LxcPsbdp xrByrZ7TGyJ/hGN9am8t6D00i48j4E9qq7i8e2q8Kd8zapIVsoTBpDrWi+hKqSOKNt/aW8Wzj8o /R5aPot8y3xQ5orLO3qRxNNG0rZMfxqCgWUuNUr6/851X41Ss5+bs4avmwwGKMHfecDDTm/3BB3 MHCGBYmjj9bSj3VKhe4ucGKXTVxMWK99jmyentfKeKHll3gywA/9RNrQn+BCQo6eGQHGigJ6Yqd R/oZIy8Pa1t3HlabCd5VFylCiXvnZLhqI6eiqyqI6vrNVSXsy7Xgp6p5izIgFhDhsTLh3mOmtT3 Kiyh5E2wSLUcKaPNkdG3O6kb/KMLU+A9mYCcFBiEJHzuZSLeuQsVHDXpjogcLPFWdldt2PCJzR/ XyNrzPHek+yJ3/+QozA== X-Proofpoint-Spam-Info: AW1haW4tMjYwODA1MDA2OSBTYWx0ZWRfX4po1wMm8MEoG TZWq28k5jz73/C7U96sbX3bNpYiq9T4XeS369rKwxbc9MJF4/OmCtBzLTOEpc5L8JPeuWOmBqfB ApFaO4szRJ1Lwz+8mlBZ9l03VXrYsSc= X-Proofpoint-GUID: VdTel7NyE5h9VEtV_l2cg_NPQRWn0vTS 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-05_03,2026-08-04_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 adultscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608050069 Update the PSC reset reason by invoking set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT) from the panic governor's pretimeout handler before calling panic(), so the reset cause is committed to persistent storage before the system goes down. Signed-off-by: Faruque Ansari Acked-by: Guenter Roeck --- drivers/watchdog/pretimeout_panic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/pretimeout_panic.c b/drivers/watchdog/pretime= out_panic.c index 8c3ac674dc45..819487b5e6fe 100644 --- a/drivers/watchdog/pretimeout_panic.c +++ b/drivers/watchdog/pretimeout_panic.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include =20 #include "watchdog_pretimeout.h" @@ -17,6 +18,7 @@ */ static void pretimeout_panic(struct watchdog_device *wdd) { + set_psc_reason(PSCR_WATCHDOG_PRETIMEOUT); panic("watchdog pretimeout event\n"); } =20 --=20 2.34.1