diff options
| author | Patrick Williams <iawillia@us.ibm.com> | 2012-07-06 15:40:43 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-07-11 08:18:41 -0500 |
| commit | 14a2721d2c87dc13f1ef66818c41cd0848dd52db (patch) | |
| tree | 66ae0220b0443f9a87d87075279ba9a5c08ba412 /src/include/kernel/misc.H | |
| parent | a23283c6facfee055c9c6d43e23a04ca02edc467 (diff) | |
| download | blackbird-hostboot-14a2721d2c87dc13f1ef66818c41cd0848dd52db.tar.gz blackbird-hostboot-14a2721d2c87dc13f1ef66818c41cd0848dd52db.zip | |
Live-lock issues in memory allocator.
* Debug tool for PageManager.
* Support PageMgr allocations of non-2^k size.
* Switch page-allocation to always be in kernel-mode.
While investigating issue 44511, I noticed two problesm with the
memory page allocator (PageManager). First, the allocator did
not support allocations of pages which were not a power of 2,
which would result in pages appearing to "leak". Second, in
situations where a large allocation was requested and there was
not a large chunk available, the allocation would enter a
live-lock condition where coalescing would never occur.
Switched the PageManager so that all allocations happen in
kernel space. This allows us to force memory-release operations
on the syscall path when we are out of memory and also put in
place a task_yield call which will allow coalescing to eventually
occur. Issue 44523 is suppose to fully resolve any of these
live-lock paths.
RTC: 44511
Change-Id: Ifefd5d0996ee6914e291c862fac0c7b76980717f
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1330
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/kernel/misc.H')
| -rw-r--r-- | src/include/kernel/misc.H | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/src/include/kernel/misc.H b/src/include/kernel/misc.H index f04439748..ebec9cc48 100644 --- a/src/include/kernel/misc.H +++ b/src/include/kernel/misc.H @@ -1,25 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/kernel/misc.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/misc.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 + */ /** @file misc.H * @brief Misc. Kernel functions and utilities. */ @@ -28,6 +29,7 @@ #define __KERNEL_MISC_H #include <stdint.h> +#include <usr/vmmconst.h> namespace KernelMisc { @@ -40,5 +42,22 @@ namespace KernelMisc extern uint64_t g_payload_base; /** @brief Address from base of payload entry-point. */ extern uint64_t g_payload_entry; + + /** @fn in_kernel_mode + * @brief Determine if the code is currently in kernel mode or not. + * + * @return [true | false] + */ + inline bool in_kernel_mode() + { + uint64_t stack = 0; + asm volatile("mr %0, 1" : "=r"(stack)); + if((stack >= VMM_VADDR_STACK_SEGMENT) && + (stack < (VMM_VADDR_STACK_SEGMENT + VMM_SEGMENT_SIZE))) + { + return false; + } + return true; + } }; #endif |

