Date: Wed, 15 Feb 2006 23:52:01 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/sys proc.h sleepqueue.h src/sys/kern kern_condvar.c kern_kse.c kern_sig.c kern_synch.c kern_thread.c subr_sleepqueue.c Message-ID: <200602152352.k1FNq1KU056133@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
davidxu 2006-02-15 23:52:01 UTC FreeBSD src repository Modified files: sys/sys proc.h sleepqueue.h sys/kern kern_condvar.c kern_kse.c kern_sig.c kern_synch.c kern_thread.c subr_sleepqueue.c Log: Fix a long standing race between sleep queue and thread suspension code. When a thread A is going to sleep, it calls sleepq_catch_signals() to detect any pending signals or thread suspension request, if nothing happens, it returns without holding process lock or scheduler lock, this opens a race window which allows thread B to come in and do process suspension work, however since A is still at running state, thread B can do nothing to A, thread A continues, and puts itself into actually sleeping state, but B has never seen it, and it sits there forever until B is woken up by other threads sometimes later(this can be very long delay or never happen). Fix this bug by forcing sleepq_catch_signals to return with scheduler lock held. Fix sleepq_abort() by passing it an interrupted code, previously, it worked as wakeup_one(), and the interruption can not be identified correctly by sleep queue code when the sleeping thread is resumed. Let thread_suspend_check() returns EINTR or ERESTART, so sleep queue no longer has to use SIGSTOP as a hack to build a return value. Reviewed by: jhb MFC after: 1 week Revision Changes Path 1.54 +2 -9 src/sys/kern/kern_condvar.c 1.222 +1 -1 src/sys/kern/kern_kse.c 1.323 +11 -6 src/sys/kern/kern_sig.c 1.276 +2 -8 src/sys/kern/kern_synch.c 1.229 +4 -4 src/sys/kern/kern_thread.c 1.24 +76 -81 src/sys/kern/subr_sleepqueue.c 1.453 +1 -1 src/sys/sys/proc.h 1.7 +2 -4 src/sys/sys/sleepqueue.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602152352.k1FNq1KU056133>