Fix deadlock on thread->times_update in getrusage()
Set thread->in_kernel properly on exiting interrupt handler when entering it from kernel mode. Conflicts: arch/x86_64/kernel/cpu.c kernel/mem.c
This commit is contained in:
@ -1007,7 +1007,7 @@ void handle_interrupt(int vector, struct x86_user_context *regs)
|
||||
}
|
||||
|
||||
interrupt_exit(regs);
|
||||
set_cputime(0);
|
||||
set_cputime(interrupt_from_user(regs)? 0: 1);
|
||||
|
||||
--v->in_interrupt;
|
||||
}
|
||||
@ -1023,7 +1023,7 @@ void gpe_handler(struct x86_user_context *regs)
|
||||
}
|
||||
set_signal(SIGSEGV, regs, NULL);
|
||||
interrupt_exit(regs);
|
||||
set_cputime(0);
|
||||
set_cputime(interrupt_from_user(regs)? 0: 1);
|
||||
panic("GPF");
|
||||
}
|
||||
|
||||
@ -1052,7 +1052,7 @@ void debug_handler(struct x86_user_context *regs)
|
||||
info.si_code = si_code;
|
||||
set_signal(SIGTRAP, regs, &info);
|
||||
interrupt_exit(regs);
|
||||
set_cputime(0);
|
||||
set_cputime(interrupt_from_user(regs)? 0: 1);
|
||||
}
|
||||
|
||||
void int3_handler(struct x86_user_context *regs)
|
||||
@ -1070,7 +1070,7 @@ void int3_handler(struct x86_user_context *regs)
|
||||
info.si_code = TRAP_BRKPT;
|
||||
set_signal(SIGTRAP, regs, &info);
|
||||
interrupt_exit(regs);
|
||||
set_cputime(0);
|
||||
set_cputime(interrupt_from_user(regs)? 0: 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -1225,7 +1225,7 @@ out:
|
||||
check_need_resched();
|
||||
check_signal(0, regs, 0);
|
||||
}
|
||||
set_cputime(0);
|
||||
set_cputime(interrupt_from_user(regs)? 0: 1);
|
||||
#ifdef PROFILE_ENABLE
|
||||
if (thread->profile)
|
||||
profile_event_add(PROFILE_page_fault, (rdtsc() - t_s));
|
||||
|
||||
@ -407,6 +407,9 @@ clone_thread(struct thread *org, unsigned long pc, unsigned long sp,
|
||||
ihk_atomic_set(&thread->refcount, 2);
|
||||
memcpy(&thread->cpu_set, &org->cpu_set, sizeof(thread->cpu_set));
|
||||
|
||||
/* New thread is in kernel until jumping to enter_user_mode */
|
||||
thread->in_kernel = org->in_kernel;
|
||||
|
||||
/* NOTE: sp is the user mode stack! */
|
||||
ihk_mc_init_user_process(&thread->ctx, &thread->uctx, ((char *)thread) +
|
||||
KERNEL_STACK_NR_PAGES * PAGE_SIZE, pc, sp);
|
||||
|
||||
Reference in New Issue
Block a user