diff options
| author | Bill Schwartz <whs@us.ibm.com> | 2012-10-10 10:36:29 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-10-12 16:29:17 -0500 |
| commit | b201169eeae76a7697f4f207dd583d40a2f07f66 (patch) | |
| tree | a05fa3da99dddab0491623aebc1110e73d430bf7 /src/include | |
| parent | 3536e96bd3a1d490cec900617fab6703fb7798ea (diff) | |
| download | blackbird-hostboot-b201169eeae76a7697f4f207dd583d40a2f07f66.tar.gz blackbird-hostboot-b201169eeae76a7697f4f207dd583d40a2f07f66.zip | |
Memory Leak task_end
Change-Id: Idb7a2d8d72a55f644efd0b2548eca5df5d062e6d
RTC: 47491
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2011
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/kernel/idebug.H | 46 | ||||
| -rw-r--r-- | src/include/kernel/taskmgr.H | 48 | ||||
| -rw-r--r-- | src/include/sys/task.h | 58 | ||||
| -rw-r--r-- | src/include/usr/hwas/hostbootIstep.H | 28 | ||||
| -rw-r--r-- | src/include/usr/initservice/initsvcstructs.H | 46 | ||||
| -rw-r--r-- | src/include/usr/initservice/taskargs.H | 53 | ||||
| -rw-r--r-- | src/include/usr/targeting/attrrp.H | 47 | ||||
| -rw-r--r-- | src/include/usr/util/impl/threadpool.H | 46 | ||||
| -rw-r--r-- | src/include/usr/util/threadpool.H | 51 |
9 files changed, 211 insertions, 212 deletions
diff --git a/src/include/kernel/idebug.H b/src/include/kernel/idebug.H index 584dacf80..f6ee69837 100644 --- a/src/include/kernel/idebug.H +++ b/src/include/kernel/idebug.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/kernel/idebug.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/kernel/idebug.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __KERNEL_IDEBUG_H #define __KERNEL_IDEBUG_H @@ -79,7 +79,7 @@ class InteractiveDebug /** @brief Entry point for 'task_create' of debug task. * @param[in] idebug - Pointer to this interactive-debug structure. */ - static void debugEntryPoint(void* idebug); + static void* debugEntryPoint(void* idebug); }; #endif diff --git a/src/include/kernel/taskmgr.H b/src/include/kernel/taskmgr.H index b38618d22..5af28efe5 100644 --- a/src/include/kernel/taskmgr.H +++ b/src/include/kernel/taskmgr.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/kernel/taskmgr.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2010 - 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/kernel/taskmgr.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2010,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __KERNEL_TASKMGR_H #define __KERNEL_TASKMGR_H @@ -108,7 +108,7 @@ class TaskManager static void setCurrentTask(task_t* t); /** Typedef for task entry points. */ - typedef void(*task_fn_t)(void*); + typedef void* (*task_fn_t)(void*); /** @brief Create a new task object. * @@ -158,7 +158,7 @@ class TaskManager tid_t getNextTid() { return iv_nextTid.next(); }; /** Run the idle task loop */ - static void idleTaskLoop(void*); + static void* idleTaskLoop(void*); // Internal implementations of non-static / non-_ functions. task_t* _createIdleTask(); diff --git a/src/include/sys/task.h b/src/include/sys/task.h index b86b6f4ec..0fbec617b 100644 --- a/src/include/sys/task.h +++ b/src/include/sys/task.h @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/sys/task.h $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2010 - 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/sys/task.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2010,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** @file task.h * @brief Contains the prototypes for system calls related to tasking. */ @@ -52,23 +52,27 @@ void task_yield(); * * See POSIX pthread_create. */ -tid_t task_create(void(*start_routine)(void*), void* arg); +tid_t task_create(void*(*start_routine)(void*), void* arg); /** @fn task_end * @brief End the calling task. * * See POSIX pthread_exit. * - * @note A task must call task_end when it wishes to exit. If a task were - * to simply return from its entry point function, the kernel sets up + * @note A task could call task_end when it wishes to exit. But it will likely + * cause a memory leak. It is better for a task to + * simply return from its entry point function, the kernel sets up * the initial task structure with the link-register pointing to this - * function. Therefore, returning from the entry point function will - * also cause the task to end cleanly using this function. + * function. The "NO_RETURN" does not call the destructors to clean up. + * Might be used in case of task needing to be terminated due to + * unknown cause. */ void task_end() NO_RETURN; /** @fn task_end2 * @brief End the calling task with a return value. + * Will likely cause a memory leak. Better to return the value on the + * return to the entry point. See comments on task_end. * * See POSIX pthread_exit. * diff --git a/src/include/usr/hwas/hostbootIstep.H b/src/include/usr/hwas/hostbootIstep.H index f770a0bfd..324eb4820 100644 --- a/src/include/usr/hwas/hostbootIstep.H +++ b/src/include/usr/hwas/hostbootIstep.H @@ -45,9 +45,9 @@ namespace HWAS * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void host_init_fsi( void *io_pArgs ); +void* host_init_fsi( void *io_pArgs ); /** * @brief host_set_ipl_parms Build ipl parameters @@ -56,9 +56,9 @@ void host_init_fsi( void *io_pArgs ); * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void host_set_ipl_parms( void *io_pArgs ); +void* host_set_ipl_parms( void *io_pArgs ); /** * @brief host_discover_targets Builds targeting @@ -73,9 +73,9 @@ void host_set_ipl_parms( void *io_pArgs ); * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void host_discover_targets( void *io_pArgs ); +void* host_discover_targets( void *io_pArgs ); /** * @brief host_gard Do Gard @@ -84,9 +84,9 @@ void host_discover_targets( void *io_pArgs ); * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void host_gard( void *io_pArgs ); +void* host_gard( void *io_pArgs ); /** * @brief host_cancontinue_clear Clear deconfigured status @@ -95,9 +95,9 @@ void host_gard( void *io_pArgs ); * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void host_cancontinue_clear( void *io_pArgs ); +void* host_cancontinue_clear( void *io_pArgs ); /** * @brief proc_check_slave_sbe_seeprom_complete Check Slave SBE Complete @@ -106,9 +106,9 @@ void host_cancontinue_clear( void *io_pArgs ); * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void proc_check_slave_sbe_seeprom_complete( void *io_pArgs ); +void* proc_check_slave_sbe_seeprom_complete( void *io_pArgs ); /** * @brief proc_xmit_sbe vSBE Init of Slave Chips @@ -117,9 +117,9 @@ void proc_check_slave_sbe_seeprom_complete( void *io_pArgs ); * * param[in,out] io_pArgs - (normally) a pointer to a TaskArgs struct, * or NULL. - * return none + * return any error logs to istep */ -void proc_xmit_sbe( void *io_pArgs ); +void* proc_xmit_sbe( void *io_pArgs ); } // namespace HWAS #endif // HOSTBOOTISTEP_H_ diff --git a/src/include/usr/initservice/initsvcstructs.H b/src/include/usr/initservice/initsvcstructs.H index 7daaec28b..58038bc22 100644 --- a/src/include/usr/initservice/initsvcstructs.H +++ b/src/include/usr/initservice/initsvcstructs.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/initservice/common/initsvcstructs.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/initservice/initsvcstructs.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __COMMON_INITSVCSTRUCTS_H #define __COMMON_INITSVCSTRUCTS_H /** @@ -137,7 +137,7 @@ struct TaskFlags struct TaskInfo { const char taskname[VFS_MODULE_NAME_MAX]; - void (*taskfn)(void *ptr); + void* (*taskfn)(void *ptr); const TaskFlags taskflags; }; diff --git a/src/include/usr/initservice/taskargs.H b/src/include/usr/initservice/taskargs.H index 0108d8021..580a7a203 100644 --- a/src/include/usr/initservice/taskargs.H +++ b/src/include/usr/initservice/taskargs.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/initservice/taskargs.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/initservice/taskargs.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __TASKARGS_TASKARGS_H #define __TASKARGS_TASKARGS_H @@ -59,15 +59,11 @@ * * This is not as flexible as the old TaskArgs setup but much simpler. * - * Alternatively you can call task_end2() directly from the MyInitFn: - * - * task_end2( l_errl ); - * */ #define TASK_ENTRY_MACRO( MyInitFn ) \ extern "C" \ - void _start( void *io_pArgs ) \ + void * _start( void *io_pArgs ) \ { \ errlHndl_t io_rtaskRetErrl = NULL; \ void *ret = NULL; \ @@ -75,8 +71,7 @@ MyInitFn( io_rtaskRetErrl ); \ \ ret = reinterpret_cast<void *>(io_rtaskRetErrl); \ - \ - task_end2( ret ); \ + return ret; \ } #endif diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H index ffa615580..82046b337 100644 --- a/src/include/usr/targeting/attrrp.H +++ b/src/include/usr/targeting/attrrp.H @@ -1,26 +1,25 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/include/usr/targeting/attrrp.H $ - * - * IBM CONFIDENTIAL - * - * COPYRIGHT International Business Machines Corp. 2011-2012 - * - * p1 - * - * Object Code Only (OCO) source materials - * Licensed Internal Code Source Materials - * IBM HostBoot Licensed Internal Code - * - * The source code for this program is not published or other- - * wise divested of its trade secrets, irrespective of what has - * been deposited with the U.S. Copyright Office. - * - * Origin: 30 - * - * IBM_PROLOG_END_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/attrrp.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __TARGETING_ATTRRP_H #define __TARGETING_ATTRRP_H @@ -232,7 +231,7 @@ class AttrRP * @param[in] i_pInstance * The AttrRP to call msgServiceTask on. */ - static void startMsgServiceTask(void* i_pInstance); + static void* startMsgServiceTask(void* i_pInstance); // Message Queue for VMM requests msg_q_t iv_msgQ; diff --git a/src/include/usr/util/impl/threadpool.H b/src/include/usr/util/impl/threadpool.H index 8490bb5d6..fad1b8edc 100644 --- a/src/include/usr/util/impl/threadpool.H +++ b/src/include/usr/util/impl/threadpool.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/util/impl/threadpool.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/util/impl/threadpool.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __UTIL_IMPL_THREADPOOL_H #define __UTIL_IMPL_THREADPOOL_H @@ -75,7 +75,7 @@ namespace __Util_ThreadPool_Impl worklist_itr_t; /** Typedef of function pointer passed to "start". */ - typedef void(*start_fn_t)(void*); + typedef void*(*start_fn_t)(void*); /** Typedef of function poitner passed to "remove". */ typedef worklist_itr_t(*order_fn_t)(worklist_itr_t, worklist_itr_t); diff --git a/src/include/usr/util/threadpool.H b/src/include/usr/util/threadpool.H index 4d28800fb..c04b7bede 100644 --- a/src/include/usr/util/threadpool.H +++ b/src/include/usr/util/threadpool.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/util/threadpool.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/util/threadpool.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __UTIL_THREADPOOL_H #define __UTIL_THREADPOOL_H @@ -116,7 +116,7 @@ class ThreadPool : public Util::__Util_ThreadPool_Impl::ThreadPoolImpl private: /** Entry point for worker thread. */ - static void run(ThreadPool*); + static void* run(ThreadPool*); /** Useful constant to determine FIFO vs non-FIFO behavior. */ static const bool has_comparison = Util::Traits::has_lessthan<WorkItem>::value; @@ -145,7 +145,7 @@ class ThreadPoolManager // Implementation of the worker-thread run function. template <typename WorkItem> -void ThreadPool<WorkItem>::run( +void* ThreadPool<WorkItem>::run( ThreadPool<WorkItem>* self) { while(1) @@ -168,9 +168,10 @@ void ThreadPool<WorkItem>::run( } else // No work item was given, we must be done. { - return; // task_end() called automatically by returning. + return NULL; // task_end() called automatically by returning. } } + return NULL; } }; |

