From de2312a44b13b46a9dded3e60aeca6a13f8662de Mon Sep 17 00:00:00 2001 From: Nick Bofferding Date: Sat, 30 Mar 2019 21:29:38 -0500 Subject: Fix deadlock in ECC error shutdown path There is a scenario wherein if a PNOR ECC UE occurs when attempting to service a page fault, the kernel will deadlock when it attempts to kill the task that triggered the fault. This is due to the kill routine being called while holding the VMM spinlock and then collecting a backtrace, which also performs a nested acquire of the same spinlock. This fix inhibits invoking the backtrace if the kill routine holds the VMM spinlock. Change-Id: I75bf1f248740a08fd485379d88e146096edf65a9 CQ: SW461429 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75264 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Ilya Smirnov Reviewed-by: Michael Baiocchi Reviewed-by: Matthew Raybuck Reviewed-by: William G. Hoffa --- src/kernel/msghandler.C | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/msghandler.C b/src/kernel/msghandler.C index 200f9c028..fe653e174 100644 --- a/src/kernel/msghandler.C +++ b/src/kernel/msghandler.C @@ -33,7 +33,7 @@ #include #include #include - +#include void MessageHandler::sendMessage(msg_sys_types_t i_type, void* i_key, void* i_data, task_t* i_task) @@ -186,7 +186,12 @@ int MessageHandler::recvMessage(msg_t* i_msg) printk("Unhandled msg rc %d (%s) for key %p on task %d @ %p\n", msg_rc, ErrnoToString(msg_rc), key, deferred_task->tid, deferred_task->context.nip); - KernelMisc::printkBacktrace(deferred_task); + // Kernel will deadlock if the message handler has the VMM spinlock + // locked and then attempts to print the backtrace + if(VmmManager::getLock() != iv_lock) + { + KernelMisc::printkBacktrace(deferred_task); + } MAGIC_INSTRUCTION(MAGIC_BREAK_ON_ERROR); endTaskList.insert(deferred_task); } -- cgit v1.2.3