when mcexec is killed by SIGKILL, terminate mckernel process (BUG#259)

This commit is contained in:
Tomoki Shirasawa
2014-11-27 16:13:52 +09:00
parent 58e2e0a246
commit 8f30e16976
11 changed files with 164 additions and 8 deletions

View File

@@ -546,7 +546,8 @@ terminate(int rc, int sig, ihk_mc_user_context_t *ctx)
/* XXX: send SIGKILL to all threads in this process */
flush_process_memory(proc); /* temporary hack */
do_syscall(&request, ctx, ihk_mc_get_processor_id(), 0);
if(!proc->nohost)
do_syscall(&request, ctx, ihk_mc_get_processor_id(), 0);
#define IS_DETACHED_PROCESS(proc) (1) /* should be implemented in the future */
@@ -610,6 +611,44 @@ terminate(int rc, int sig, ihk_mc_user_context_t *ctx)
schedule();
}
void terminate_host(int pid)
{
struct cpu_local_var *v;
struct process *p;
int i;
unsigned long irqstate;
extern int num_processors;
int *tids;
int n;
siginfo_t info;
memset(&info, '\0', sizeof info);
info.si_signo = SIGKILL;
info.si_code = SI_KERNEL;
tids = kmalloc(sizeof(int) * num_processors, IHK_MC_AP_NOWAIT);
if(!tids)
return;
for(n = 0, i = 0; i < num_processors; i++){
v = get_cpu_local_var(i);
irqstate = ihk_mc_spinlock_lock(&(v->runq_lock));
list_for_each_entry(p, &(v->runq), sched_list){
if(p->ftn->pid == pid){
p->nohost = 1;
tids[n] = p->ftn->tid;
n++;
}
}
ihk_mc_spinlock_unlock(&(v->runq_lock), irqstate);
}
for(i = 0; i < n; i++){
do_kill(pid, tids[i], SIGKILL, &info);
}
kfree(tids);
}
void
interrupt_syscall(int pid, int cpuid)
{