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