Date: Sun, 23 Jun 2002 21:34:43 -0500 From: Jonathan Lemon <jlemon@flugsvamp.com> To: Julian Elischer <julian@elischer.org> Cc: Jonathan Lemon <jlemon@flugsvamp.com>, dillon@apollo.backplane.com, hackers@freebsd.org Subject: Re: Bug in wakeup() (stable and current) ? Message-ID: <20020623213443.K91821@prism.flugsvamp.com> In-Reply-To: <Pine.BSF.4.21.0206231840270.44896-100000@InterJet.elischer.org> References: <200206232158.g5NLw9c49030@prism.flugsvamp.com> <Pine.BSF.4.21.0206231840270.44896-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 23, 2002 at 06:42:43PM -0700, Julian Elischer wrote: > > On Sun, 23 Jun 2002, Jonathan Lemon wrote: > > The code works simply because it relies TAILQ_REMOVE() not changing > > the tqe_next pointer. I suppose that this should either be documented, > > or the loop changed back to use a temp variable: > > > > for (td = TAILQ_FIRST(qp); td != NULL; td = tdq) { > > tdq = TAILQ_NEXT(td, td_slpq); > > ... > > } > > I just added debug code in the TAILQ code that sets the forward pointor > to -1. Since Matt had this it's possible that this is what hit him? Most definitely. If you reset tqe_next, the code stops working. Try the patch below. -- Jonathan Index: kern_synch.c =================================================================== RCS file: /ncvs/src/sys/kern/kern_synch.c,v retrieving revision 1.175 diff -u -r1.175 kern_synch.c --- kern_synch.c 7 Jun 2002 05:39:16 -0000 1.175 +++ kern_synch.c 24 Jun 2002 02:42:40 -0000 @@ -605,13 +605,14 @@ register void *ident; { register struct slpquehead *qp; - register struct thread *td; + register struct thread *td, *tdn; struct proc *p; mtx_lock_spin(&sched_lock); qp = &slpque[LOOKUP(ident)]; restart: - TAILQ_FOREACH(td, qp, td_slpq) { + for (td = TAILQ_FIRST(qp); td != NULL; td = tdn) { + tdn = TAILQ_NEXT(td, td_slpq); p = td->td_proc; if (td->td_wchan == ident) { TAILQ_REMOVE(qp, td, td_slpq); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020623213443.K91821>