On Wed, Nov 09, 2011 at 05:25:43PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Wed Nov 9 17:25:43 2011 > New Revision: 227394 > URL: http://svn.freebsd.org/changeset/base/227394 > > Log: > Stopped process may legitimately have some threads sleeping and not > suspended, if the sleep is uninterruptible. Even more, stopped process might have some threads still running in the kernel mode, or inhibited due to wait on blockable locks. I was unable to design an expression that would assert that such thread will be stopped at the kernel->user boundary.
The assertion itself is useful and catched several bugs, but theoretically can cause false positives. If any report of the fired assert for kernel-mode thread is provided, I will remove the assertions. > > Reported and tested by: pho > MFC after: 1 week > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/i386/i386/machdep.c > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================================== > --- head/sys/amd64/amd64/machdep.c Wed Nov 9 17:15:51 2011 > (r227393) > +++ head/sys/amd64/amd64/machdep.c Wed Nov 9 17:25:43 2011 > (r227394) > @@ -2047,7 +2047,8 @@ int > fill_fpregs(struct thread *td, struct fpreg *fpregs) > { > > - KASSERT(td == curthread || TD_IS_SUSPENDED(td), > + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || > + (P_SHOULDSTOP(td->td_proc) && TD_IS_SLEEPING(td)), > ("not suspended thread %p", td)); > fpugetregs(td); > fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs); > > Modified: head/sys/i386/i386/machdep.c > ============================================================================== > --- head/sys/i386/i386/machdep.c Wed Nov 9 17:15:51 2011 > (r227393) > +++ head/sys/i386/i386/machdep.c Wed Nov 9 17:25:43 2011 > (r227394) > @@ -3299,7 +3299,8 @@ int > fill_fpregs(struct thread *td, struct fpreg *fpregs) > { > > - KASSERT(td == curthread || TD_IS_SUSPENDED(td), > + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || > + (P_SHOULDSTOP(td->td_proc) && TD_IS_SLEEPING(td)), > ("not suspended thread %p", td)); > #ifdef DEV_NPX > npxgetregs(td);
pgpWN11iIHbek.pgp
Description: PGP signature