diff --git a/arch/x86/kernel/syscall.c b/arch/x86/kernel/syscall.c index 782e282b..84797b00 100644 --- a/arch/x86/kernel/syscall.c +++ b/arch/x86/kernel/syscall.c @@ -1302,7 +1302,7 @@ done: if (status != PS_RUNNING) { if(sig == SIGKILL){ /* Wake up the target only when stopped by ptrace-reporting */ - sched_wakeup_thread(tthread, PS_TRACED | PS_STOPPED); + sched_wakeup_thread(tthread, PS_TRACED | PS_STOPPED | PS_INTERRUPTIBLE); } else if(sig == SIGCONT || ptracecont == 1){ /* Wake up the target only when stopped by SIGSTOP */ diff --git a/kernel/process.c b/kernel/process.c index a7c55683..1f63f209 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -2716,9 +2716,11 @@ sched_wakeup_thread(struct thread *thread, int valid_states) int spin_slept = 0; unsigned long irqstate; struct cpu_local_var *v = get_cpu_local_var(thread->cpu_id); + struct process *proc = thread->proc; + struct mcs_rwlock_node updatelock; dkprintf("sched_wakeup_process,proc->pid=%d,valid_states=%08x,proc->status=%08x,proc->cpu_id=%d,my cpu_id=%d\n", - thread->proc->pid, valid_states, thread->status, thread->cpu_id, ihk_mc_get_processor_id()); + proc->pid, valid_states, thread->status, thread->cpu_id, ihk_mc_get_processor_id()); irqstate = ihk_mc_spinlock_lock(&(thread->spin_sleep_lock)); if (thread->spin_sleep > 0) { @@ -2738,7 +2740,10 @@ sched_wakeup_thread(struct thread *thread, int valid_states) irqstate = ihk_mc_spinlock_lock(&(v->runq_lock)); if (thread->status & valid_states) { - xchg4((int *)(&thread->proc->status), PS_RUNNING); + mcs_rwlock_writer_lock_noirq(&proc->update_lock, &updatelock); + if(proc->status != PS_EXITED) + proc->status = PS_RUNNING; + mcs_rwlock_writer_unlock_noirq(&proc->update_lock, &updatelock); xchg4((int *)(&thread->status), PS_RUNNING); status = 0; }