From 57cc498bd1d752d6f5ac0446f010f7b7e480597c Mon Sep 17 00:00:00 2001 From: Josh Rispoli Date: Thu, 26 Jun 2014 13:46:33 -0500 Subject: Revisit all daemon tasks and make sure they are properly daemonizing quickly Added task_detach() to daemons not properly daemonizing Added printk to alert when detached tasks crash Change-Id: Ibc7567c7d61064627b3105f98c89c310fcfaa1c6 RTC:110382 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11829 Tested-by: Jenkins Server Reviewed-by: Brian Silver Reviewed-by: William H. Schwartz Reviewed-by: A. Patrick Williams III --- src/kernel/taskmgr.C | 17 ++++++++++++++--- src/sys/init/init_main.C | 7 ++++++- src/sys/vfs/vfs_main.C | 7 ++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/kernel/taskmgr.C b/src/kernel/taskmgr.C index 9569c7180..cb7e335dc 100644 --- a/src/kernel/taskmgr.C +++ b/src/kernel/taskmgr.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -170,9 +172,18 @@ void TaskManager::_endTask(task_t* t, void* retval, int status) t->tracker->retval = retval; t->tracker->task = NULL; // NULL signifies task is complete for now. - if (t->detached) // If detached, just clean up the tracker. + if (t->detached) { - removeTracker(t->tracker); + if(status == TASK_STATUS_CRASHED) + { + printk("Critical: Detached task %d crashed.\n", + t->tid); + kassert(false); // Hostboot shuts down + } + else + { + removeTracker(t->tracker); + } } else // If not detached, do join. { diff --git a/src/sys/init/init_main.C b/src/sys/init/init_main.C index 31ab57ad9..c446e4bcf 100644 --- a/src/sys/init/init_main.C +++ b/src/sys/init/init_main.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -36,6 +38,9 @@ void* vfs_main(void*); void* init_main(void* unused) { + // Detach this task from the parent + task_detach(); + tid_t tidrc = 0; barrier_t l_barrier; barrier_init(&l_barrier,2); diff --git a/src/sys/vfs/vfs_main.C b/src/sys/vfs/vfs_main.C index 291005945..bf31df680 100644 --- a/src/sys/vfs/vfs_main.C +++ b/src/sys/vfs/vfs_main.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -59,6 +61,9 @@ struct VfsEntry void* vfs_main(void* i_barrier) { + // Detach this task from the parent + task_detach(); + barrier_t * barrier = (barrier_t *)i_barrier; // Create message queue, register with kernel. msg_q_t vfsMsgQ = msg_q_create(); -- cgit v1.2.1