summaryrefslogtreecommitdiffstats
path: root/src/kernel/syscall.C
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-07-06 15:40:43 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-07-11 08:18:41 -0500
commit14a2721d2c87dc13f1ef66818c41cd0848dd52db (patch)
tree66ae0220b0443f9a87d87075279ba9a5c08ba412 /src/kernel/syscall.C
parenta23283c6facfee055c9c6d43e23a04ca02edc467 (diff)
downloadtalos-hostboot-14a2721d2c87dc13f1ef66818c41cd0848dd52db.tar.gz
talos-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/kernel/syscall.C')
-rw-r--r--src/kernel/syscall.C36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index 1ed68624e..b6fa46f8a 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -89,8 +89,6 @@ namespace Systemcalls
void MsgSendRecv(task_t*);
void MsgRespond(task_t*);
void MsgWait(task_t*);
- void MmioMap(task_t*);
- void MmioUnmap(task_t*);
void DevMap(task_t*);
void DevUnmap(task_t*);
void TimeNanosleep(task_t*);
@@ -101,7 +99,7 @@ namespace Systemcalls
void MmAllocBlock(task_t *t);
void MmRemovePages(task_t *t);
void MmSetPermission(task_t *t);
- void MmFlushPages(task_t *t);
+ void MmAllocPages(task_t *t);
syscall syscalls[] =
@@ -135,7 +133,7 @@ namespace Systemcalls
&MmAllocBlock, // MM_ALLOC_BLOCK
&MmRemovePages, // MM_REMOVE_PAGES
&MmSetPermission, // MM_SET_PERMISSION
- &MmFlushPages, // MM_FLUSH_PAGES
+ &MmAllocPages, // MM_ALLOC_PAGES
};
};
@@ -165,6 +163,9 @@ namespace Systemcalls
Scheduler* s = t->cpu->scheduler;
s->returnRunnable();
s->setNextRunnable();
+
+ // TODO: Issue 44523 - Temporary workaround for live-lock situation.
+ CpuManager::executePeriodics(CpuManager::getCurrentCPU());
}
void TaskStart(task_t* t)
@@ -671,15 +672,30 @@ namespace Systemcalls
}
/**
- * Flush and Cast out 'old' pages
+ * Call PageManager to allocate a number of pages.
* @param[in] t: The task used.
*/
- void MmFlushPages(task_t* t)
+ void MmAllocPages(task_t* t)
{
- VmmManager::castout_t sev = (VmmManager::castout_t)TASK_GETARG0(t);
- VmmManager::flushPageTable();
- VmmManager::castOutPages(sev);
- TASK_SETRTN(t,0);
+ // Attempt to allocate the page(s).
+ void* page = PageManager::allocatePage(TASK_GETARG0(t), true);
+ TASK_SETRTN(t, reinterpret_cast<uint64_t>(page));
+
+ // If we are low on memory, call into the VMM to free some up.
+ uint64_t pcntAvail = PageManager::queryAvail();
+ if (pcntAvail < PageManager::LOWMEM_NORM_LIMIT)
+ {
+ static uint64_t one_at_a_time = 0;
+ if (!__sync_lock_test_and_set(&one_at_a_time, 1))
+ {
+ VmmManager::flushPageTable();
+ VmmManager::castout_t sev =
+ (pcntAvail < PageManager::LOWMEM_CRIT_LIMIT) ?
+ VmmManager::CRITICAL : VmmManager::NORMAL;
+ VmmManager::castOutPages(sev);
+ __sync_lock_release(&one_at_a_time);
+ }
+ }
}
};
OpenPOWER on IntegriCloud