1From 53241d7be35fba23079504468090d770d4116831 Mon Sep 17 00:00:00 2001 2From: Artem Senichev <a.senichev@yadro.com> 3Date: Tue, 28 Jul 2020 17:38:17 +0300 4Subject: [PATCH] Stop and send SRESET for one thread only 5 6Fixes bugs preventing the host from creating a crash dump. 7 8Stopping all threads leads to errors in skiboot: 9[ 163.237293219,3] Could not stop thread 0:0:1: Thread is quiesced already. 10If the kernel has xmon support, exiting the debugger causes the kernel 11to hang: 12[ 235.694220] watchdog: CPU 97 TB:187362511366, last heartbeat TB:159120095297 (55160ms ago) 13[ 235.694276] watchdog: CPU 101 Hard LOCKUP 14 15Sending SRESET to all threads causes kernel panic: 16[ 50.495727] Kernel panic - not syncing: Unrecoverable nested System Reset 17 18Signed-off-by: Artem Senichev <a.senichev@yadro.com> 19--- 20 nmi_interface.cpp | 14 +++++++++++--- 21 1 file changed, 11 insertions(+), 3 deletions(-) 22 23diff --git a/nmi_interface.cpp b/nmi_interface.cpp 24index fcce451..d022d7e 100644 25--- a/nmi_interface.cpp 26+++ b/nmi_interface.cpp 27@@ -38,7 +38,7 @@ void NMI::nMI() 28 using InternalFailure = 29 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; 30 31- struct pdbg_target* target; 32+ struct pdbg_target* target = nullptr; 33 34 pdbg_for_each_class_target("thread", target) 35 { 36@@ -51,11 +51,19 @@ void NMI::nMI() 37 report<InternalFailure>(); 38 return; 39 } 40+ break; 41 } 42 43- if (thread_sreset_all() < 0) 44+ if (!target) 45 { 46- log<level::ERR>("Failed to sreset all threads"); 47+ log<level::ERR>("Thread not found"); 48+ report<InternalFailure>(); 49+ return; 50+ } 51+ 52+ if (thread_sreset(target) < 0) 53+ { 54+ log<level::ERR>("Failed to sreset thread"); 55 report<InternalFailure>(); 56 } 57 } 58-- 592.27.0 60 61