fix pipe02

This commit is contained in:
Tomoki Shirasawa
2014-08-27 16:50:01 +09:00
parent bc8b441358
commit f535670100
5 changed files with 77 additions and 32 deletions

View File

@@ -390,7 +390,6 @@ static int process_msg_prepare_process(unsigned long rphys)
return -ENOMEM;
}
proc->pid = pn->pid;
proc->tid = pn->pid;
proc->pgid = pn->pgid;
proc->ftn->pid = pn->pid;
proc->vm->region.user_start = pn->user_start;
@@ -498,6 +497,7 @@ static void syscall_channel_send(struct ihk_ikc_channel_desc *c,
}
extern unsigned long do_kill(int, int, int);
extern void settid(struct process *proc, int mode, int newcpuid, int oldcpuid);
static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
void *__packet, void *ihk_os)
@@ -505,6 +505,7 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
struct ikc_scd_packet *packet = __packet;
struct ikc_scd_packet pckt;
int rc;
struct process *proc;
switch (packet->msg) {
case SCD_MSG_INIT_CHANNEL_ACKED:
@@ -529,9 +530,10 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
case SCD_MSG_SCHEDULE_PROCESS:
dkprintf("SCD_MSG_SCHEDULE_PROCESS: %lx\n", packet->arg);
proc = (struct process *)packet->arg;
runq_add_proc((struct process *)packet->arg,
ihk_mc_get_processor_id());
settid(proc, 0, ihk_mc_get_processor_id(), -1);
runq_add_proc(proc, ihk_mc_get_processor_id());
//cpu_local_var(next) = (struct process *)packet->arg;
return 0;

View File

@@ -42,12 +42,11 @@
#define ekprintf(...) kprintf(__VA_ARGS__)
#endif
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);
static int copy_user_ranges(struct process *proc, struct process *org);
void settid(struct process *proc, int mode, int newcpuid, int oldcpuid);
void hold_fork_tree_node(struct fork_tree_node *ftn)
{
@@ -1811,6 +1810,7 @@ static void do_migrate(void)
cur_v->runq_len -= 1;
old_cpu_id = req->proc->cpu_id;
req->proc->cpu_id = cpu_id;
settid(req->proc, 2, cpu_id, old_cpu_id);
list_add_tail(&req->proc->sched_list, &v->runq);
v->runq_len += 1;
@@ -2011,8 +2011,6 @@ void sched_request_migrate(int cpu_id, struct process *proc)
waitq_finish_wait(&req.wq, &entry);
}
/* Runq lock must be held here */
void __runq_add_proc(struct process *proc, int cpu_id)
{

View File

@@ -120,6 +120,7 @@ static void send_syscall(struct syscall_request *req, int cpu, int pid)
int ret;
if(req->number == __NR_exit_group ||
req->number == __NR_gettid ||
req->number == __NR_kill){ // interrupt syscall
extern int num_processors;
@@ -131,6 +132,8 @@ static void send_syscall(struct syscall_request *req, int cpu, int pid)
cpu = num_processors;
if(req->number == __NR_kill)
pid = req->args[0];
if(req->number == __NR_gettid)
pid = req->args[1];
}
else{
scp = &get_cpu_local_var(cpu)->scp;
@@ -188,6 +191,7 @@ long do_syscall(struct syscall_request *req, ihk_mc_user_context_t *ctx,
req->number);
if(req->number == __NR_exit_group ||
req->number == __NR_gettid ||
req->number == __NR_kill){ // interrupt syscall
scp = &get_cpu_local_var(0)->scp2;
islock = 1;
@@ -1121,6 +1125,20 @@ SYSCALL_DECLARE(getpid)
return cpu_local_var(current)->pid;
}
void
settid(struct process *proc, int mode, int newcpuid, int oldcpuid)
{
ihk_mc_user_context_t ctx;
unsigned long rc;
ihk_mc_syscall_arg0(&ctx) = mode;
ihk_mc_syscall_arg1(&ctx) = proc->pid;
ihk_mc_syscall_arg2(&ctx) = newcpuid;
ihk_mc_syscall_arg3(&ctx) = oldcpuid;
rc = syscall_generic_forwarding(__NR_gettid, &ctx);
proc->tid = rc;
}
SYSCALL_DECLARE(gettid)
{
return cpu_local_var(current)->tid;
@@ -1325,9 +1343,7 @@ SYSCALL_DECLARE(clone)
if (clone_flags & CLONE_VM) {
new->pid = cpu_local_var(current)->pid;
request1.number = __NR_gettid;
new->tid = do_syscall(&request1, &ctx1, cpuid, new->pid);
settid(new, 1, cpuid, -1);
}
/* fork() a new process on the host */
else {
@@ -1342,7 +1358,7 @@ SYSCALL_DECLARE(clone)
}
/* In a single threaded process TID equals to PID */
new->tid = new->pid;
settid(new, 0, cpuid, -1);
dkprintf("fork(): new pid: %d\n", new->pid);
/* clear user space PTEs and set new rpgtable so that consequent