From owner-freebsd-current@FreeBSD.ORG Thu Mar 25 08:18:21 2010 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 85621106566C for ; Thu, 25 Mar 2010 08:18:21 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com [209.85.220.224]) by mx1.freebsd.org (Postfix) with ESMTP id 0CCA88FC0C for ; Thu, 25 Mar 2010 08:18:20 +0000 (UTC) Received: by fxm24 with SMTP id 24so2858335fxm.3 for ; Thu, 25 Mar 2010 01:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NzIjnTUD65Xd9CbvHhAyNlGdNIEwhxE4najl4Uq4wd4=; b=Gvn8So4jyLYMXJY2DVNrQDvrfaDQbrWfQw/Nc2qNFF2fVO6LBT/ZqdeYLMVYVXd7ym 9VtXSNhCoE/whZJZArgN55y0vouet5G0ihE4IBS9fL+tq+0xf81AVn8O7/SpTVC8TI24 AWLhWOEiSAffRMwSBLiZzVWYHqRgYkc5PmeIY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=UhpSZcFl5Lu9QzqUmohmizhzFajU5WFZ5zQTNE6+MgKUr5gLGOFUugJOWIOADmoX8H C527iD3+pQOpHtro5WLNczIjSOAlTSm//jS8b3XEb6Kz51mCsFLLFjsPCsh32ZXnyahE NO/0DTWRLcxnxeA5iFR5yGJUHAGUGrHw0R8FQ= MIME-Version: 1.0 Received: by 10.223.72.65 with SMTP id l1mr6440947faj.66.1269505099691; Thu, 25 Mar 2010 01:18:19 -0700 (PDT) In-Reply-To: <4e6cba831003131556t2cb787e0xc9e2d649320d6e59@mail.gmail.com> References: <7d6fde3d1003070207q621e69ado2cb64e431feacd76@mail.gmail.com> <7d6fde3d1003070224k3626a9b5y98c11a43eef1bed4@mail.gmail.com> <4e6cba831003101356i534341ffr2961b983854ab788@mail.gmail.com> <7dc40bd01003101407m605e41ey2d8ace0049cf5e61@mail.gmail.com> <7d6fde3d1003102158o7834ca67lce3eca23aa723fd1@mail.gmail.com> <7d6fde3d1003121933s4ba7b57fw6542628c16edf723@mail.gmail.com> <4e6cba831003131556t2cb787e0xc9e2d649320d6e59@mail.gmail.com> Date: Thu, 25 Mar 2010 09:18:19 +0100 Message-ID: <4e6cba831003250118q32b877c4rdef9f001d3715a84@mail.gmail.com> From: Giovanni Trematerra To: FreeBSD Current Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Garrett Cooper , Tom Couch Subject: Re: Removing USB keyboard after filesystems synced causes panic with destroyed mutex twa(4)? 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: Thu, 25 Mar 2010 08:18:21 -0000 Sorry for top posting. I report just for the record the test that Garrett kindly did. On Wed, Mar 24, 2010 at 8:45 PM, Garrett Cooper wrote: > The patch looks good for commit. No performance regression at > boot, no functional regression when the keyboard's detached, and if > I'm not mistaken it appears that performance actually improves at > reboot (seems like the window between the final fs sync and the reboot > is more along the lines of what's expected for a system that doesn't > have the RAID card). > Thanks! > -Garrett On Sun, Mar 14, 2010 at 12:56 AM, Giovanni Trematerra wrote: > On Sat, Mar 13, 2010 at 4:33 AM, Garrett Cooper wrot= e: >> On Wed, Mar 10, 2010 at 9:58 PM, Garrett Cooper >>> > > if you don't mind could you try this patch? Less dirty but always quick := ) > > Thank you for your time. > > -- > Gianni > > > diff -r 69c84861a227 sys/dev/twa/tw_cl.h > --- a/sys/dev/twa/tw_cl.h =A0 =A0 =A0 Thu Mar 11 16:18:11 2010 -0500 > +++ b/sys/dev/twa/tw_cl.h =A0 =A0 =A0 Sat Mar 13 18:50:16 2010 -0500 > @@ -66,6 +66,8 @@ > =A0#define TW_CLI_CTLR_STATE_RESET_PHASE1_IN_PROGRESS =A0 =A0 (1<<5) > =A0/* G66 register write access bug needs to be worked around. */ > =A0#define TW_CLI_CTLR_STATE_G66_WORKAROUND_NEEDED =A0 =A0 =A0 =A0(1<<6) > +/* Controller is shutting down. */ > +#define TW_CLI_CTLR_STATE_SHUTDOWN_IN_PROGRESS (1<<7) > > =A0/* Possible values of ctlr->ioctl_lock.lock. */ > =A0#define TW_CLI_LOCK_FREE =A0 =A0 =A0 =A0 =A0 =A0 =A0 0x0 =A0 =A0 /* lo= ck is free */ > diff -r 69c84861a227 sys/dev/twa/tw_cl_init.c > --- a/sys/dev/twa/tw_cl_init.c =A0Thu Mar 11 16:18:11 2010 -0500 > +++ b/sys/dev/twa/tw_cl_init.c =A0Sat Mar 13 18:50:16 2010 -0500 > @@ -598,6 +598,7 @@ tw_cl_shutdown_ctlr(struct tw_cl_ctlr_ha > =A0 =A0 =A0 =A0 * and notify the controller that we are going down. > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0ctlr->state &=3D ~TW_CLI_CTLR_STATE_ACTIVE; > + =A0 =A0 =A0 ctlr->state |=3D TW_CLI_CTLR_STATE_SHUTDOWN_IN_PROGRESS; > > =A0 =A0 =A0 =A0tw_cli_disable_interrupts(ctlr); > > diff -r 69c84861a227 sys/dev/twa/tw_cl_intr.c > --- a/sys/dev/twa/tw_cl_intr.c =A0Thu Mar 11 16:18:11 2010 -0500 > +++ b/sys/dev/twa/tw_cl_intr.c =A0Sat Mar 13 18:50:16 2010 -0500 > @@ -75,9 +75,12 @@ tw_cl_interrupt(struct tw_cl_ctlr_handle > =A0 =A0 =A0 =A0if (ctlr =3D=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto out; > > - =A0 =A0 =A0 /* If we get an interrupt while resetting, it is a shared > - =A0 =A0 =A0 =A0 =A0one for another device, so just bail */ > - =A0 =A0 =A0 if (ctlr->state & TW_CLI_CTLR_STATE_RESET_IN_PROGRESS) > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* If we get an interrupt while resetting or shutting dow= n, > + =A0 =A0 =A0 =A0* it is a shared one for another device, so just bail > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (ctlr->state & TW_CLI_CTLR_STATE_RESET_IN_PROGRESS || > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ctlr->state & TW_CLI_CTLR_STATE_SHUTDOWN_IN= _PROGRESS) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto out; > > =A0 =A0 =A0 =A0/* >