From owner-svn-src-all@FreeBSD.ORG Fri Nov 19 21:31:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E870D106564A; Fri, 19 Nov 2010 21:31:45 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 464058FC1E; Fri, 19 Nov 2010 21:31:45 +0000 (UTC) Received: by qyk8 with SMTP id 8so109538qyk.13 for ; Fri, 19 Nov 2010 13:31:44 -0800 (PST) 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=AawVLT4gA3C2EeFSPOCNPoVcrvbrQ3owNHXTqjpeQ28=; b=KAM7SSSPqJrOCNRYQI7+0FUXX2UeHjT4HAjG5k/e/J3XCyExNOVHKr6dUMmJ+D8aRJ dw0Onvp5fDgImXTw/XG+CHnRcutiyPPwAxNCaYsysNgbytJupOdhTf+MLjzcSq7V9Bd1 GS3iCjkkM0f1/Dwmt5b67fk25OzveAehIr6iY= 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=NccZ8bI0iJdpBR6HvBUYgBsOSnNcm/q/PaLc10rFATEbGPHUUvXfwslw0FDasaT1bB pBhlcmqdDahpWM3khCU65nYy9rW6hucW42sCBLzN/YHGDEtzk9wXS2jUxzKgNqY0AIQe s/HxO1O5e7WCDZksm0d6BI0tNGdfydTs9znvU= MIME-Version: 1.0 Received: by 10.229.215.9 with SMTP id hc9mr2203820qcb.142.1290202304619; Fri, 19 Nov 2010 13:31:44 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.229.31.9 with HTTP; Fri, 19 Nov 2010 13:31:44 -0800 (PST) In-Reply-To: <201011191621.25520.jhb@freebsd.org> References: <201011191943.oAJJhv3i087205@svn.freebsd.org> <201011191609.31308.jkim@FreeBSD.org> <201011191621.25520.jhb@freebsd.org> Date: Fri, 19 Nov 2010 16:31:44 -0500 X-Google-Sender-Auth: 9Lf37lIBX17Z3pTtvtItK7o6vFQ Message-ID: From: Attilio Rao To: John Baldwin 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, Jung-uk Kim Subject: Re: svn commit: r215544 - 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: Fri, 19 Nov 2010 21:31:46 -0000 2010/11/19 John Baldwin : > On Friday, November 19, 2010 4:09:28 pm Jung-uk Kim wrote: >> On Friday 19 November 2010 02:43 pm, Attilio Rao wrote: >> > Author: attilio >> > Date: Fri Nov 19 19:43:56 2010 >> > New Revision: 215544 >> > URL: http://svn.freebsd.org/changeset/base/215544 >> > >> > Log: >> > =C2=A0 Scan the list in reverse order for the shutdown handlers of >> > loaded modules. This way, when there is a dependency between two >> > modules, the handler of the latter probed runs first. >> > >> > =C2=A0 This is a similar approach as the modules are unloaded in the >> > same linkerfile. >> > >> > =C2=A0 Sponsored by: =C2=A0 =C2=A0 Sandvine Incorporated >> > =C2=A0 Submitted by: =C2=A0 =C2=A0 Nima Misaghian >> > =C2=A0 MFC after: =C2=A0 =C2=A0 =C2=A0 =C2=A01 week >> >> Hmm... =C2=A0It is not directly related but I was thinking about doing >> similar things for sys/kern/subr_bus.c. =C2=A0What do you think about th= e >> attached patch? > > Hmm, the patches for suspend and resume that I had for this took the oppo= site > order, they did suspend in forward order, but resume in backwards order. > Like so: > > --- //depot/vendor/freebsd/src/sys/kern/subr_bus.c =C2=A0 =C2=A0 =C2=A020= 10-11-17 22:30:24.000000000 0000 > +++ //depot/user/jhb/acpipci/kern/subr_bus.c =C2=A0 =C2=A02010-11-19 17:1= 9:02.000000000 00 > @@ -3426,9 +3429,9 @@ > =C2=A0 =C2=A0 =C2=A0 =C2=A0TAILQ_FOREACH(child, &dev->children, link) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error =3D DEVICE_S= USPEND(child); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 for (child2 =3D TAILQ_FIRST(&dev->children); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0child2 && child2 !=3D child; > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0child2 =3D TAILQ_NEXT(child2, link)) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 for (child2 =3D TAILQ_PREV(child, device_list, link); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0child2 !=3D NULL; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0child2 =3D TAILQ_PREV(child2, device_list, link)= ) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DEVICE_RESUME(child2); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0return (error); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > @@ -3447,7 +3450,7 @@ > =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0device_t =C2=A0 =C2=A0 =C2=A0 =C2=A0child; > > - =C2=A0 =C2=A0 =C2=A0 TAILQ_FOREACH(child, &dev->children, link) { > + =C2=A0 =C2=A0 =C2=A0 TAILQ_FOREACH_REVERSE(child, &dev->children, devic= e_list, link) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DEVICE_RESUME(chil= d); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* if resume fails= , there's nothing we can usefully do... */ > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > (Likely mangled whitespace.) > > I couldn't convince myself which order was "more" correct for suspend and= resume. Considering loading in starting point, I think suspend should go in reverse logic and resume in the same module load logic. So that dependent modules are suspended first and resumed after. Don't you agree? Attilio --=20 Peace can only be achieved by understanding - A. Einstein