From 97a091abd2db8e531574f31274648aa0709ce5d7 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Sat, 5 Aug 2023 04:24:38 +0800 Subject: [PATCH] [Mellanox] Use Debian reboot in Nvidia platform reboot when it is invoked from kdump capture boot (#15701) #### Why I did it When a kernel crash occurs, the system will reboot to the kdump capture kernel if kdump is enabled (`config kdump enable`). In the kdump capture boot, it only stores the crash information, and then reboot the system to a normal boot. In this boot, no SONiC service is started but it invokes `reboot` which is actually the SONiC reboot that depends on SONiC services. There is a logic to skip all SONiC stuff and invoke platform reboot in SONiC reboot to avoid issues. However, on Nvidia platforms, the platform reboot still depends on SONiC services, which can cause issues. So, the Debian reboot is called directly in platform reboot if it is invoked from the kdump capture boot. #### How I did it Manual test --- .../x86_64-mlnx_msn2700-r0/platform_reboot | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot index b2188fde6f..9b68790498 100755 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -21,13 +21,24 @@ function ParseArguments() { } function SafePwrCycle() { - sync ; sync - umount -fa > /dev/null 2&>1 + sync; sync + umount -fa > /dev/null 2>&1 echo 1 > $SYSFS_PWR_CYCLE } ParseArguments "$@" +# Reboot immediately if the kdump capture kernel is running +VMCORE_FILE=/proc/vmcore +if [ -s $VMCORE_FILE ]; then + sync; sync + umount -fa > /dev/null 2>&1 + + # Run Debian reboot because the platform reboot isn't available + /sbin/reboot +fi + + ${FW_UPGRADE_SCRIPT} --upgrade --verbose EXIT_CODE="$?" if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then