Send a signal to mcexec after switching to that process.

Change-Id: Ia882ef5027931009ee65febd0cbe22022a755c4a
Refs: #1505
This commit is contained in:
Tomoki Shirasawa
2021-02-08 17:02:55 +09:00
committed by Masamichi Takagi
parent b0bd1feefb
commit afea6af667
8 changed files with 189 additions and 47 deletions

View File

@ -252,6 +252,7 @@ long do_syscall(struct syscall_request *req, int cpu)
unsigned long flags;
DECLARE_WAITQ_ENTRY(scd_wq_entry, cpu_local_var(current));
check_sig_pending();
cpu_pause();
/* Spin if not preemptable */
@ -11110,8 +11111,8 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
return l;
}
static int
check_sig_pending_thread(struct thread *thread)
void
check_sig_pending()
{
int found = 0;
struct list_head *head;
@ -11123,9 +11124,22 @@ check_sig_pending_thread(struct thread *thread)
__sigset_t x;
int sig = 0;
struct k_sigaction *k;
struct cpu_local_var *v;
struct thread *thread;
if (clv == NULL)
return;
thread = cpu_local_var(current);
if (thread == NULL || thread == &cpu_local_var(idle)) {
return;
}
if (thread->in_syscall_offload == 0) {
return;
}
if (thread->proc->group_exit_status & 0x0000000100000000L) {
return;
}
v = get_this_cpu_local_var();
w = thread->sigmask.__val[0];
lock = &thread->sigcommon->lock;
@ -11174,16 +11188,14 @@ check_sig_pending_thread(struct thread *thread)
}
if (found == 2) {
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
terminate_mcexec(0, sig);
return 1;
return;
}
else if (found == 1) {
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
interrupt_syscall(thread, 0);
return 1;
return;
}
return 0;
return;
}
struct sig_pending *
@ -11270,38 +11282,6 @@ hassigpending(struct thread *thread)
return getsigpending(thread, 0);
}
void
check_sig_pending(void)
{
struct thread *thread;
struct cpu_local_var *v;
if (clv == NULL)
return;
v = get_this_cpu_local_var();
repeat:
v->runq_irqstate = ihk_mc_spinlock_lock(&v->runq_lock);
list_for_each_entry(thread, &(v->runq), sched_list) {
if (thread == NULL || thread == &cpu_local_var(idle)) {
continue;
}
if (thread->in_syscall_offload == 0) {
continue;
}
if (thread->proc->group_exit_status & 0x0000000100000000L) {
continue;
}
if (check_sig_pending_thread(thread))
goto repeat;
}
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
}
static void
__check_signal(unsigned long rc, void *regs0, int num, int irq_disabled)
{