From owner-freebsd-current@FreeBSD.ORG Sat Aug 23 04:08:29 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8112C1065689 for ; Sat, 23 Aug 2008 04:08:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id EF9308FC08 for ; Sat, 23 Aug 2008 04:08:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [IPv6:2001:470:1f11:75:2a0:d2ff:fe18:8b38]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m7N48IGN011357; Sat, 23 Aug 2008 00:08:18 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Sat, 23 Aug 2008 00:03:43 -0400 User-Agent: KMail/1.9.7 References: <11617822.2511219426408994.JavaMail.coremail@bj163app64.163.com> In-Reply-To: <11617822.2511219426408994.JavaMail.coremail@bj163app64.163.com> MIME-Version: 1.0 Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808230003.44081.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:2001:470:1f11:75::1]); Sat, 23 Aug 2008 00:08:19 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8076/Fri Aug 22 18:15:54 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: kevinxlinuz Subject: Re: [BUG] I think sleepqueue need to be protected in sleepq_broadcast X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Aug 2008 04:08:29 -0000 On Friday 22 August 2008 01:33:28 pm kevinxlinuz wrote: > Hi, > I'm looking in the problem ( amd64/124200: kernel panic on mutex sleepq > chain).It troubles me for a long time.I add a KASSERT in sleepq_broadcast() > to check the sleepqueue's wait channel.At last it turn out that the > sleepqueue's wait channel was changed before sleepq_resume_thread(). In > sleepq_lookup(),We can easily find sq->sq_wchan == wchan.But after a short > time,the sq->sq_wchan nolonger equal with wchan,so I think it was changed > by other threads. The sleepq chain lock is already held for all of sleepq_broadcast() by the caller (see wakeup() and cv_broadcastpri()). That said, I don't have any other good ideas for the panic you are seeing. Do you have a crash dump? It might be interesting to see what other thread is using that sleep queue. > sleepq_broadcast(void *wchan, int flags, int pri, int queue) > { > struct sleepqueue *sq; > struct thread *td; > int wakeup_swapper; > > CTR2(KTR_PROC, "sleepq_broadcast(%p, %d)", wchan, flags); > KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", > __func__)); MPASS((queue >= 0) && (queue < NR_SLEEPQS)); > sq = sleepq_lookup(wchan); > if (sq == NULL) > return (0); > KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), > ("%s: mismatch between sleep/wakeup and cv_*", __func__)); > > /* Resume all blocked threads on the sleep queue. */ > wakeup_swapper = 0; > while (!TAILQ_EMPTY(&sq->sq_blocked[queue])) { > td = TAILQ_FIRST(&sq->sq_blocked[queue]); > thread_lock(td); > /* test */ > KASSERT(sq->sq_wchan == wchan, > ("%s:mismatch between wchan and sq_wchan in > sq",__func__)); /* I find the panic here */ > if (sleepq_resume_thread(sq, td, pri)) > wakeup_swapper = 1; > thread_unlock(td); > } > return (wakeup_swapper); > } > > Thanks, > kevin 2008/08/23 > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" -- John Baldwin