Skip to content

Commit

Permalink
Add Kernel Debug Trace for Out of Memory condition
Browse files Browse the repository at this point in the history
  - Display size of page requested if requested memory
    doesn't become available

Change-Id: I5b101ce6650cdc155be276c5d00f95bc35a0ff90
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54491
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
wghoffa authored and dcrowell77 committed Feb 23, 2018
1 parent 2674db2 commit 014e0ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/kernel/pagemgr.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2010,2017 */
/* Contributors Listed Below - COPYRIGHT 2010,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -155,6 +155,7 @@ void* PageManager::allocatePage(size_t n, bool userspace)
// In non-kernel mode, make a system-call to allocate in kernel-mode.
if (!KernelMisc::in_kernel_mode())
{
size_t attempts = 0;
while (NULL == page)
{
page = _syscall1(Systemcalls::MM_ALLOC_PAGES,
Expand All @@ -164,6 +165,12 @@ void* PageManager::allocatePage(size_t n, bool userspace)
// will eventually free up (ex. VMM flushes).
if (NULL == page)
{
attempts++;
if( attempts == 10000 ) //arbitrarily huge number
{
printk("Cannot allocate %ld pages\n", n);
MAGIC_INSTRUCTION(MAGIC_BREAK_ON_ERROR);
}
task_yield();
}
}
Expand Down

0 comments on commit 014e0ae

Please sign in to comment.