Index: sys/amd64/amd64/vm_machdep.c =================================================================== --- sys/amd64/amd64/vm_machdep.c +++ sys/amd64/amd64/vm_machdep.c @@ -484,13 +484,12 @@ } /* - * Set that machine state for performing an upcall that has to - * be done in thread_userret() so that those upcalls generated - * in thread_userret() itself can be done as well. + * Set that machine state for performing an upcall that starts + * the entry function with the given argument. */ void cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, - stack_t *stack) + stack_t *stack) { /* @@ -505,7 +504,7 @@ #ifdef COMPAT_FREEBSD32 if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { /* - * Set the trap frame to point at the beginning of the uts + * Set the trap frame to point at the beginning of the entry * function. */ td->td_frame->tf_rbp = 0; @@ -513,10 +512,7 @@ (((uintptr_t)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4; td->td_frame->tf_rip = (uintptr_t)entry; - /* - * Pass the address of the mailbox for this kse to the uts - * function as a parameter on the stack. - */ + /* Pass the argument to the entry point. */ suword32((void *)(td->td_frame->tf_rsp + sizeof(int32_t)), (uint32_t)(uintptr_t)arg); @@ -539,10 +535,7 @@ td->td_frame->tf_gs = _ugssel; td->td_frame->tf_flags = TF_HASSEGS; - /* - * Pass the address of the mailbox for this kse to the uts - * function as a parameter on the stack. - */ + /* Pass the argument to the entry point. */ td->td_frame->tf_rdi = (register_t)arg; } Index: sys/i386/i386/vm_machdep.c =================================================================== --- sys/i386/i386/vm_machdep.c +++ sys/i386/i386/vm_machdep.c @@ -527,13 +527,12 @@ } /* - * Set that machine state for performing an upcall that has to - * be done in thread_userret() so that those upcalls generated - * in thread_userret() itself can be done as well. + * Set that machine state for performing an upcall that starts + * the entry function with the given argument. */ void cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, - stack_t *stack) + stack_t *stack) { /* @@ -546,7 +545,7 @@ cpu_thread_clean(td); /* - * Set the trap frame to point at the beginning of the uts + * Set the trap frame to point at the beginning of the entry * function. */ td->td_frame->tf_ebp = 0; @@ -554,10 +553,7 @@ (((int)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4; td->td_frame->tf_eip = (int)entry; - /* - * Pass the address of the mailbox for this kse to the uts - * function as a parameter on the stack. - */ + /* Pass the argument to the entry point. */ suword((void *)(td->td_frame->tf_esp + sizeof(void *)), (int)arg); } Index: sys/kern/kern_thread.c =================================================================== --- sys/kern/kern_thread.c +++ sys/kern/kern_thread.c @@ -481,7 +481,7 @@ * architecture specific resources that * would not be on a new untouched process. */ - cpu_thread_exit(td); /* XXXSMP */ + cpu_thread_exit(td); /* * The last thread is left attached to the process @@ -670,11 +670,6 @@ wakeup_swapper |= sleepq_abort(td2, EINTR); break; case SINGLE_BOUNDARY: - if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) - wakeup_swapper |= thread_unsuspend_one(td2, p, false); - if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) != 0) - wakeup_swapper |= sleepq_abort(td2, ERESTART); - break; case SINGLE_NO_EXIT: if (TD_IS_SUSPENDED(td2) && (td2->td_flags & TDF_BOUNDARY) == 0) wakeup_swapper |= thread_unsuspend_one(td2, p, false); @@ -913,8 +908,8 @@ /* * The only suspension in action is a * single-threading. Single threader need not stop. - * XXX Should be safe to access unlocked - * as it can only be set to be true by us. + * It is safe to access p->p_singlethread unlocked + * because it can only be set to our address by us. */ if (p->p_singlethread == td) return (0); /* Exempt from stopping. */