Merge branch 'master' of postpeta.pccluster.org:mckernel into gdb

This commit is contained in:
Naoki Hamada
2014-07-31 10:31:45 +09:00
8 changed files with 135 additions and 28 deletions

View File

@@ -84,6 +84,9 @@
//#define USE_LARGE_PAGES
#endif
#define USER_STACK_NR_PAGES 8192
#define KERNEL_STACK_NR_PAGES 25
#include <waitq.h>
#include <futex.h>
#include <rlimit.h>

View File

@@ -43,9 +43,6 @@
#endif
#define USER_STACK_NR_PAGES 8192
#define KERNEL_STACK_NR_PAGES 25
extern long do_arch_prctl(unsigned long code, unsigned long address);
static void insert_vm_range_list(struct process_vm *vm,
struct vm_range *newrange);
@@ -1787,6 +1784,7 @@ static void do_migrate(void)
ihk_mc_spinlock_lock_noirq(&cur_v->migq_lock);
list_for_each_entry_safe(req, tmp, &cur_v->migq, list) {
int cpu_id;
int old_cpu_id;
struct cpu_local_var *v;
/* 0. check if migration is necessary */
@@ -1808,9 +1806,17 @@ static void do_migrate(void)
double_rq_lock(cur_v, v);
list_del(&req->proc->sched_list);
cur_v->runq_len -= 1;
old_cpu_id = req->proc->cpu_id;
req->proc->cpu_id = cpu_id;
list_add_tail(&req->proc->sched_list, &v->runq);
v->runq_len += 1;
/* update cpu_set of the VM for remote TLB invalidation */
cpu_clear(old_cpu_id, &req->proc->vm->cpu_set,
&req->proc->vm->cpu_set_lock);
cpu_set(cpu_id, &req->proc->vm->cpu_set,
&req->proc->vm->cpu_set_lock);
if (v->runq_len == 1)
ihk_mc_interrupt_cpu(get_x86_cpu_local_variable(cpu_id)->apic_id, 0xd1);
double_rq_unlock(cur_v, v);

View File

@@ -1228,6 +1228,11 @@ SYSCALL_DECLARE(execve)
/* Unmap all memory areas of the process, userspace will be gone */
free_process_memory_ranges(cpu_local_var(current));
ihk_mc_init_user_process(&cpu_local_var(current)->ctx,
&cpu_local_var(current)->uctx,
((char *)cpu_local_var(current)) +
KERNEL_STACK_NR_PAGES * PAGE_SIZE, desc->entry, 0);
/* Create virtual memory ranges and update args/envs */
if (prepare_process_ranges_args_envs(cpu_local_var(current), desc, desc,
PTATTR_NO_EXECUTE | PTATTR_WRITABLE | PTATTR_FOR_USER,
@@ -1235,6 +1240,18 @@ SYSCALL_DECLARE(execve)
kprintf("execve(): PANIC: preparing ranges, args, envs, stack\n");
panic("");
}
/* Clear host user space PTEs */
request.number = __NR_munmap;
request.args[0] = cpu_local_var(current)->vm->region.user_start;
request.args[1] = cpu_local_var(current)->vm->region.user_end -
cpu_local_var(current)->vm->region.user_start;
dkprintf("execve(): requesting host PTE clear\n");
if (do_syscall(&request, ctx, ihk_mc_get_processor_id(), 0)) {
kprintf("execve(): ERROR: clearing PTEs in host process\n");
panic("");
}
/* Request host to transfer ELF image */
request.number = __NR_execve;
@@ -1250,8 +1267,13 @@ SYSCALL_DECLARE(execve)
panic("");
}
dkprintf("execve(): returning to new process\n");
/* Switch to new execution context */
dkprintf("execve(): switching to new process\n");
ihk_mc_switch_context(NULL, &cpu_local_var(current)->ctx,
cpu_local_var(current));
/* Never reach here */
return 0;
}