interrupt_syscall: interrupt valid thread
This commit is contained in:
@ -1954,21 +1954,6 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
|
||||
#endif
|
||||
|
||||
case __NR_gettid:{
|
||||
int mode = w.sr.args[0];
|
||||
int remote_pid = w.sr.args[1];
|
||||
int newcpuid = w.sr.args[2];
|
||||
int oldcpuid = w.sr.args[3];
|
||||
int wtid = thread_data[newcpuid].remote_tid;
|
||||
|
||||
if(mode == 0){
|
||||
thread_data[ncpu].remote_tid = wtid;
|
||||
thread_data[newcpuid].remote_tid = remote_pid;
|
||||
}
|
||||
else if(mode == 2){
|
||||
thread_data[newcpuid].remote_tid = thread_data[oldcpuid].remote_tid;
|
||||
thread_data[oldcpuid].remote_tid = wtid;
|
||||
}
|
||||
|
||||
/*
|
||||
* Number of TIDs and the remote physical address where TIDs are
|
||||
* expected are passed in arg 4 and 5, respectively.
|
||||
@ -2002,7 +1987,7 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
|
||||
free(tids);
|
||||
}
|
||||
gettid_out:
|
||||
do_syscall_return(fd, cpu, thread_data[newcpuid].remote_tid, 0, 0, 0, 0);
|
||||
do_syscall_return(fd, cpu, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -613,8 +613,7 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
||||
dkprintf("SCD_MSG_SCHEDULE_PROCESS: %lx\n", packet->arg);
|
||||
thread = (struct thread *)packet->arg;
|
||||
proc = thread->proc;
|
||||
|
||||
settid(thread, 0, cpuid, -1, 0, NULL);
|
||||
thread->tid = proc->pid;
|
||||
proc->status = PS_RUNNING;
|
||||
thread->status = PS_RUNNING;
|
||||
chain_thread(thread);
|
||||
|
||||
@ -690,7 +690,5 @@ void chain_thread(struct thread *);
|
||||
void proc_init();
|
||||
void set_timer();
|
||||
struct sig_pending *hassigpending(struct thread *thread);
|
||||
void settid(struct thread *thread, int mode, int newcpuid, int oldcpuid,
|
||||
int nr_tids, int *tids);
|
||||
|
||||
#endif
|
||||
|
||||
@ -2551,7 +2551,6 @@ static void do_migrate(void)
|
||||
v->flags |= CPU_FLAG_NEED_RESCHED;
|
||||
ihk_mc_interrupt_cpu(get_x86_cpu_local_variable(cpu_id)->apic_id, 0xd1);
|
||||
double_rq_unlock(cur_v, v, irqstate);
|
||||
//settid(req->thread, 2, cpu_id, old_cpu_id, 0, NULL);
|
||||
|
||||
ack:
|
||||
waitq_wakeup(&req->wq);
|
||||
|
||||
@ -143,9 +143,11 @@ static void send_syscall(struct syscall_request *req, int cpu, int pid, struct s
|
||||
/* XXX: is this really going to work if multiple processes
|
||||
* exit/receive signals at the same time?? */
|
||||
cpu = num_processors;
|
||||
if(req->number == __NR_kill)
|
||||
if (req->number == __NR_kill) {
|
||||
req->rtid = -1;
|
||||
pid = req->args[0];
|
||||
if(req->number == __NR_gettid)
|
||||
}
|
||||
if (req->number == __NR_gettid)
|
||||
pid = req->args[1];
|
||||
}
|
||||
else{
|
||||
@ -1487,27 +1489,18 @@ SYSCALL_DECLARE(getppid)
|
||||
return thread->proc->ppid_parent->pid;
|
||||
}
|
||||
|
||||
void settid(struct thread *thread, int mode, int newcpuid, int oldcpuid,
|
||||
int nr_tids, int *tids)
|
||||
static void settid(struct thread *thread, int nr_tids, int *tids)
|
||||
{
|
||||
struct syscall_request request IHK_DMA_ALIGN;
|
||||
unsigned long rc;
|
||||
|
||||
request.number = __NR_gettid;
|
||||
request.args[0] = mode;
|
||||
request.args[1] = thread->proc->pid;
|
||||
request.args[2] = newcpuid;
|
||||
request.args[3] = oldcpuid;
|
||||
/*
|
||||
* If nr_tids is non-zero, tids should point to an array of ints
|
||||
* where the thread ids of the mcexec process are expected.
|
||||
*/
|
||||
request.args[4] = nr_tids;
|
||||
request.args[5] = virt_to_phys(tids);
|
||||
rc = do_syscall(&request, ihk_mc_get_processor_id(), thread->proc->pid);
|
||||
if (mode != 2) {
|
||||
thread->tid = rc;
|
||||
}
|
||||
do_syscall(&request, ihk_mc_get_processor_id(), thread->proc->pid);
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(gettid)
|
||||
@ -1930,7 +1923,7 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
settid(new, 1, cpuid, -1, num_processors, tids);
|
||||
settid(new, num_processors, tids);
|
||||
|
||||
for (i = 0; (i < num_processors) && tids[i]; ++i) {
|
||||
dkprintf("%s: tid[%d]: %d\n", __FUNCTION__, i, tids[i]);
|
||||
|
||||
Reference in New Issue
Block a user