From owner-svn-src-all@FreeBSD.ORG Sun May 9 22:27:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7730E1065672; Sun, 9 May 2010 22:27:42 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9999C8FC0C; Sun, 9 May 2010 22:27:41 +0000 (UTC) Received: by fxm15 with SMTP id 15so2333558fxm.13 for ; Sun, 09 May 2010 15:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=qoYqY+tv55oJAt/bH2ZQ+8Z8AVFfepbGGdkvp7Lfwns=; b=udQtucTxYDpe6zgf6MVMCa/00/YnGQnuNnH+wA0u8gZUsaTawdQLFk6yvhce8nFYEu EAzFcdzFOAzMQ5mOCeztL7WdYfvBqgU87+d14ZzqNiRO8hBH8q4oxm7UP9060rOk9+xi wVOSP3wYLmUAPZ5MMRjc+uoy96FEby9ZLJkb4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=ACy6MmbJhHLPUbiI0s3FyahbcteaX8zDQnE98VVm7aY+DyMkNWFNoEqbY3T2sjucry qdQai94qblDlMJ4HQCPXS5c0kssvarkstxEv8xf71y0/hPS06roGgCWO/IksE9a/It2r UGyfJvgfcARfZo3b6zOe1tTuU/9kF8cQuSupY= MIME-Version: 1.0 Received: by 10.239.136.133 with SMTP id h5mr339890hbh.47.1273444060348; Sun, 09 May 2010 15:27:40 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.239.129.207 with HTTP; Sun, 9 May 2010 15:27:40 -0700 (PDT) In-Reply-To: <20100509170414.GA35602@alchemy.franken.de> References: <201004192327.o3JNRsK4047856@svn.freebsd.org> <20100509170414.GA35602@alchemy.franken.de> Date: Mon, 10 May 2010 00:27:40 +0200 X-Google-Sender-Auth: 5de89d4bde43defc Message-ID: From: Attilio Rao To: Marius Strobl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206878 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2010 22:27:42 -0000 2010/5/9 Marius Strobl : > On Mon, Apr 19, 2010 at 11:27:54PM +0000, Attilio Rao wrote: >> Author: attilio >> Date: Mon Apr 19 23:27:54 2010 >> New Revision: 206878 >> URL: http://svn.freebsd.org/changeset/base/206878 >> >> Log: >> =C2=A0 Fix a deadlock in the shutdown code: >> =C2=A0 When performing a smp_rendezvous() or more likely, on amd64 and i= 386, >> =C2=A0 a smp_tlb_shootdown() the caller will end up with the smp_ipi_mtx >> =C2=A0 spinlock held, busy-waiting for other CPUs to acknowledge the ope= ration. >> =C2=A0 As long as CPUs are suspended (via cpu_reset()) between the activ= e mask >> =C2=A0 read and IPI sending there can be a deadlock where the caller wil= l wait >> =C2=A0 forever for a dead CPU to acknowledge the operation. >> =C2=A0 Please note that on CPU0 that is going to be someway heavier beca= use of >> =C2=A0 the spinlocks being disabled earlier than quitting the machine. >> >> =C2=A0 Fix this bug by calling cpu_reset() with the smp_ipi_mtx held. >> =C2=A0 Note that it is very likely that a saner offline/online CPUs mech= anism >> =C2=A0 will help heavilly in fixing similar cases as it is likely more b= ugs >> =C2=A0 of this type may arise in the future. >> > > This change causes a hang for me when running an SMP kernel on an > UP machine or an MP machine with SMP disabled as in these cases > smp_ipi_mtx isn't initialized (see mp_start()). The below patch > fixes this for me. Marius, thanks a lot for reporting this. However, I think that a better fix is to always initialize the mutex. Do you think the following patch is fine for you?: http://www.freebsd.org/~attilio/smpipi_fixup.diff Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein