From owner-freebsd-current@FreeBSD.ORG Tue Jun 10 19:44:39 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 BF7F41065670 for ; Tue, 10 Jun 2008 19:44:39 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 420358FC1F for ; Tue, 10 Jun 2008 19:44:38 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so2254725fgb.35 for ; Tue, 10 Jun 2008 12:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=USWjqLfd0qDLkfKBMD7ztGW+mZlMGX62IjvPauCkHqc=; b=kOVQ4S6Q3n8RLAXUR6JjngdhIW3X4iubvJqwsFEF/nmDZqA6O1PszlOMr1TDKjuqO4 igGCRmkCT4w3gOL8jl8OjerooRAWChJ8BmDSyb28IA+kBUoSkBDqY8u+mVdSoIV6kfrA k7CT75leDR9MdYNihqBGefDaWWJGmTsm6zqDk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=tMm5I9Lk2l6pCq8xg9RFkBU0sKrvybUgAFRGSdC085U7RE2sdoUx2gPFCywdf8M3jS GzPLM2s/CWK56pXE4IbkcUd4ScQ5B/0j078tnIsg3d48ntjRvTbzJ2NXA5+yzvXGc6vF VnCik6YNTavMPPNg/euMAnxX9fXjmNr2Rb89k= Received: by 10.86.9.8 with SMTP id 8mr6103481fgi.41.1213127077769; Tue, 10 Jun 2008 12:44:37 -0700 (PDT) Received: by 10.86.2.18 with HTTP; Tue, 10 Jun 2008 12:44:37 -0700 (PDT) Message-ID: <3bbf2fe10806101244t6627d759g404df7da58c728e5@mail.gmail.com> Date: Tue, 10 Jun 2008 21:44:37 +0200 From: "Attilio Rao" Sender: asmrookie@gmail.com To: kevinxlinuz In-Reply-To: <3760478.505011213039827828.JavaMail.coremail@bj163app90.163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3760478.505011213039827828.JavaMail.coremail@bj163app90.163.com> X-Google-Sender-Auth: dd4d4ab3ae14e0fb Cc: freebsd-current@freebsd.org Subject: Re: mutex sleepq chain not owned at /usr/src/sys/kern/subr_sleepqueue.c 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: Tue, 10 Jun 2008 19:44:39 -0000 2008/6/9, kevinxlinuz : > Recently I meet a problem in freebsd 8.0/amd64. > See PR/124200 > http://www.freebsd.org/cgi/query-pr.cgi?pr=124200&cat= > > I try to find the reason. > > in cv_broadcastpri(...),it call sleepq_lock(cvp),next it call sleepq_broadcast(cvp, SLEEPQ_CONDVAR, pri, 0). > in sleepq_broadcast(void *wchan, int flags, int pri, int queue),sleepqueue sq = sleepq_lookup(wchan) /* here wchan will be checked,and sq->sq_wchan == wchan == cvp (passed from cv_broadcastpri())*/; > I add mtx_assert in /usr/src/sys/kern/subr_sleepqueue.c > sleepq_broadcast(void *wchan, int flags, int pri, int queue) > { > struct sleepqueue *sq; > struct thread *td; > > struct sleepqueue_chain *sc; > > 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); //wchan == cvp, cvp from cv_broadcastpri(...),and sleepq_lock(cvp) > //here sq->sq_wchan == wchan == cvp > if (sq == NULL) > return; > KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), > ("%s: mismatch between sleep/wakeup and cv_*", __func__)); > > /* Resume all blocked threads on the sleep queue. */ > while (!TAILQ_EMPTY(&sq->sq_blocked[queue])) { > td = TAILQ_FIRST(&sq->sq_blocked[queue]); > thread_lock(td); > /* ------test start---------- */ > sc = SC_LOOKUP(sq->sq_wchan); //sq->sq_wchan should be wchan > mtx_assert(&sc->sc_lock, MA_OWNED); //panic here,sq->sq_wchan != wchan ? or sleepq_unlock(wchan) was called by others > /* -----test end----- */ > sleepq_resume_thread(sq, td, pri); > thread_unlock(td); > } > } > Hello, We are trying to track this down but things go very slowly because I can't reproduce the bug. I would need you try some diagnostic patches, do you think you can work on that with me? Can you reproduce easilly the bug? Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein