aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/uapi/conf.c6
-rw-r--r--common/uapi/ipc.c13
2 files changed, 14 insertions, 5 deletions
diff --git a/common/uapi/conf.c b/common/uapi/conf.c
index ba48d0f..ea06e06 100644
--- a/common/uapi/conf.c
+++ b/common/uapi/conf.c
@@ -86,8 +86,8 @@ SYSCALL_DEFINE2(conf_set)(struct tcb *t, sys_arg_t param, sys_arg_t val)
break;
case CONF_CALL_STACK:
- size = align_up(val, RPC_STACK_RATIO * BASE_PAGE_SIZE);
- if (size < __rpc_stack_size * RPC_STACK_RATIO)
+ size = align_up(val, BASE_PAGE_SIZE);
+ if (size < __rpc_stack_size)
return_args(t, SYS_RET1(ERR_MISC));
__call_stack_size = size;
@@ -95,7 +95,7 @@ SYSCALL_DEFINE2(conf_set)(struct tcb *t, sys_arg_t param, sys_arg_t val)
case CONF_RPC_STACK:
size = align_up(val, BASE_PAGE_SIZE);
- if (size > __call_stack_size / RPC_STACK_RATIO)
+ if (size > __call_stack_size)
return_args(t, SYS_RET1(ERR_MISC));
__rpc_stack_size = size;
diff --git a/common/uapi/ipc.c b/common/uapi/ipc.c
index 1d48f71..9cbdce8 100644
--- a/common/uapi/ipc.c
+++ b/common/uapi/ipc.c
@@ -36,6 +36,11 @@ static void mark_rpc_inaccessible(struct tcb *t, vm_t start, vm_t end)
*/
static void mark_rpc_accessible(struct tcb *t, vm_t start, vm_t end)
{
+ /** @todo this could still be optimized with arch-specific stuff I would
+ * imagine, as set_vpage_flags() has to traverse the whole tree for each
+ * page to mark. Instead it should be possible to mark the pages
+ * continuously once they've been traversed once. Or maybe even keep
+ * around a pointer to where the last stack left off? */
size_t page_size = BASE_PAGE_SIZE;
size_t size = end - start;
size_t pages = size / page_size;
@@ -43,7 +48,7 @@ static void mark_rpc_accessible(struct tcb *t, vm_t start, vm_t end)
set_vpage_flags(t->rpc.vmem, start + pages * page_size, VM_U);
}
-/** Structure for maintaingin the required context data for an rpc call. */
+/** Structure for maintaining the required context data for an rpc call. */
struct call_ctx {
/** Execution continuation point. */
vm_t exec;
@@ -189,10 +194,14 @@ static void leave_rpc(struct tcb *t, struct sys_ret a)
*/
static bool enough_rpc_stack(struct tcb *t)
{
+ /* get top of call stack */
vm_t top = RPC_STACK_BASE + __call_stack_size;
+ /* get start of the next rpc stack instance */
vm_t rpc_stack = t->rpc_stack + BASE_PAGE_SIZE;
- return top - rpc_stack >= __call_stack_size / RPC_STACK_RATIO;
+ /* if we can still fit an rpc stack into the call stack, we can safely
+ * do the migration. */
+ return top - rpc_stack >= __rpc_stack_size;
}
/**