From owner-cvs-all@FreeBSD.ORG Tue Jun 5 16:48:14 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7393716A400; Tue, 5 Jun 2007 16:48:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay01.kiev.sovam.com (relay01.kiev.sovam.com [62.64.120.200]) by mx1.freebsd.org (Postfix) with ESMTP id F2E3413C468; Tue, 5 Jun 2007 16:48:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay01.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.60) (envelope-from ) id 1HvcCR-0005Gm-PD; Tue, 05 Jun 2007 19:48:12 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l55Gle5F037980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Jun 2007 19:47:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l55Gles6019057; Tue, 5 Jun 2007 19:47:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l55Gle2H019048; Tue, 5 Jun 2007 19:47:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 5 Jun 2007 19:47:40 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20070605164740.GY2268@deviant.kiev.zoral.com.ua> References: <200706051420.l55EKEih018925@repoman.freebsd.org> <20070606003412.W35544@besplex.bde.org> <20070605150005.GW2268@deviant.kiev.zoral.com.ua> <20070605150521.GX2268@deviant.kiev.zoral.com.ua> <20070606011022.R35623@besplex.bde.org> <3bbf2fe10706050829o2d756a4cu22f98cf11c01f5e4@mail.gmail.com> <3bbf2fe10706050843x5aaafaafy284e339791bcfe42@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3CF/MBslHFRhO8r/" Content-Disposition: inline In-Reply-To: <3bbf2fe10706050843x5aaafaafy284e339791bcfe42@mail.gmail.com> User-Agent: Mutt/1.4.2.2i X-Virus-Scanned: ClamAV version 0.90.2, clamav-milter version 0.90.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on skuns.kiev.zoral.com.ua X-Scanner-Signature: eb35aeac2b84d7677a861f668fbe3b20 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1119 [June 05 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, Bruce Evans Subject: Re: cvs commit: src/sys/kern kern_mutex.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2007 16:48:14 -0000 --3CF/MBslHFRhO8r/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 05, 2007 at 05:43:03PM +0200, Attilio Rao wrote: > 2007/6/5, Attilio Rao : > >2007/6/5, Bruce Evans : > >> > >> I get a "spin lock held too long" panic during (an interrupt in?) acpi > >> initialization on booting non-PREEMPTION SCHED_4BSD SMP. Haven't tried > >> other cases. > > > >Do you have a backtrace or any other debugging stuffs available? >=20 > Mmm, I think I got the bug. > basically, in kern_mutex.c::_mtx_unlock_sleep(), in the not-preemptive > case what happens at some point is: >=20 > td =3D curthread; > if (td->td_critnest > 0 || td1->td_priority >=3D td->td_priority) > return; >=20 > thread_lock(td1); > if (!TD_IS_RUNNING(td1)) { > ... >=20 > mi_switch(SW_INVOL, NULL); > ... > } > thread_unlock(td1); >=20 > Which is wrong beacause td1 is not curthread and really curthread > should be locked too when context switching. >=20 > To a first look the idea is that td and td1 should be locked both, but > I just want more time to look better at it. With the following patch, I get the panic: mutex sched lock recursed at .../kern_synch.c:379 with backtrace mi_switch _mtx_unlock_sleep _mtx_unlock_flags vm_pagezero diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index e0592a8..bf44229 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -670,7 +670,9 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *= file, int line) "_mtx_unlock_sleep: %p switching out lock=3D%p", m, (void *)m->mtx_lock); =20 + thread_lock(td); mi_switch(SW_INVOL, NULL); + thread_unlock(td); if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p resuming lock=3D%p", m, (void *)m->mtx_lock); --3CF/MBslHFRhO8r/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGZZOsC3+MBN1Mb4gRAo9QAJ0eIEXdW7L4iv2VPwPqgE91Gk659ACgjm+t Rwu/Za9DgLmMx1OhIihjauE= =G420 -----END PGP SIGNATURE----- --3CF/MBslHFRhO8r/--