On Mon, Jan 24, 2022 at 10:46:17PM +0800, Tao Zhou wrote: > > +/* Called from syscall exit path and exceptions that can schedule */ > > +void umcg_sys_exit(struct pt_regs *regs) > > +{ > > + struct task_struct *tsk = current; > > + long syscall = syscall_get_nr(tsk, regs); > > + > > + if (syscall == __NR_umcg_wait || > > + syscall == __NR_umcg_ctl) > > + return; > > + > > + if (tsk->umcg_server) { > > + /* > > + * Didn't block, we done. > > + */ > > + umcg_unpin_pages(); > > + return; > > + } > > + > > + umcg_unblock_and_wait(); > > umcg_unblock_and_wait() -> umcg_enqueue_and_wake() -> > umcg_wake_server() -> umcg_wake_task(tsk->umcg_server, ...) > > tsk->umcg_server is NULL here and umcg_wake_task() use it to update > state in umcg_update_state(NULL, ...), that means tsk->umcg_clock > will happen something i do not know. I think umcg_unblock_and_wait() will repin, at which point we should have tsk->umcg_server again. > There are two places to call umcg_unblock_and_wait(). One is in > umcg_register() where the server is set. Another one is in > umcg_sys_exit() where the server is not set. May use a bool to > indicate if the server is set. I'm not sure what you're on about, but I absolutely hate redundant state, that only leads to problems.