From owner-freebsd-arch@FreeBSD.ORG Fri May 24 05:08:12 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7690D72D; Fri, 24 May 2013 05:08:12 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-bk0-x235.google.com (mail-bk0-x235.google.com [IPv6:2a00:1450:4008:c01::235]) by mx1.freebsd.org (Postfix) with ESMTP id D61A69FA; Fri, 24 May 2013 05:08:11 +0000 (UTC) Received: by mail-bk0-f53.google.com with SMTP id mx1so2242152bkb.26 for ; Thu, 23 May 2013 22:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ARkcNriqJkKeuyyHZNQN0EM29rD/DrpdzfgQBx7zcDE=; b=k+lDHAiVs+Ngi4Y4JI2uaSb4mzTLJSi7jOxjx0bcWYfylgHcsQVdG/cGe/4+V/dp5k 7kijA45sLv0AqKXILlDVljTyQggW3tPdLgNgX8IPRllMLv2PujoHJbgGVvTv+9NmvRcG 3GBjGA/Mz6L/PpFh/W9UY2JVQIL7YSU8fN0uZ8bnzDIOdLoLJ+FEuhplLdYSEd3wsQuO +Q/lswUD2pFxLCbXGXmWzajGQzSEIN9EjdVIJbnGMEuOHO5MooV+Houbj3CxoRq44u+V wFN5spogukv1lFNagrjpz2vqDJutv6vYLoD6QLfTXwrjhyvZCqeznEVzz3RVqXL59LhN oEpQ== MIME-Version: 1.0 X-Received: by 10.205.34.132 with SMTP id ss4mr8324506bkb.125.1369372090844; Thu, 23 May 2013 22:08:10 -0700 (PDT) Sender: chmeeedalf@gmail.com Received: by 10.204.38.144 with HTTP; Thu, 23 May 2013 22:08:10 -0700 (PDT) In-Reply-To: <519369C4.6060402@FreeBSD.org> References: <51913B7D.1040801@freebsd.org> <288C9B9E-E943-4C5B-BCFB-15B721CBE94C@bsdimp.com> <519369C4.6060402@FreeBSD.org> Date: Thu, 23 May 2013 22:08:10 -0700 X-Google-Sender-Auth: kJLT9EJtEKjs2wuH_Yjs4O2K-So Message-ID: Subject: Re: late suspend/early resume From: Justin Hibbits To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2013 05:08:12 -0000 John, On Wed, May 15, 2013 at 3:56 AM, John Baldwin wrote: > On 5/14/13 1:14 PM, Justin Hibbits wrote: > > You are right that the late suspend could lead to silly proliferation, > and > > an ordered list is much better, but another API would need to be added to > > do that as well. > > > > My north bridge is first in the top list of the tree, right under the > > nexus, so to suspend it last I wrote the nexus suspend to traverse its > > children in reverse. The problem comes that the clock controller is > under a > > later PCI bus, not even the immediate following one, and the north bridge > > children are i2c devices, so suspending them after their clock head away > is > > problematic. We can discuss this more at bsdcan, where it may be easier > to > > describe. But essentially I need the north bridge and that pesky clock > > controller to be the last to suspend and the first to resume. I guess we > > can take this as the starting discussion for modeling this relationship > on > > all platforms, since you mention it is common in embedded platforms. > > I think you can do this by having a notion of passes with drivers having > a suspend pass level and doing passes over the tree suspending devices > at each pass level and then walking the passes back up in reverse during > resume. You could borrow from the multipass stuff used on probe/attach > for this. > > -- > John Baldwin > I have an update in the projects/pmac_pmu branch. It works for my PowerBook, but I'm not certain how well it will fare in the end, because of the way the PCI driver resumes its children. It doesn't call bus_generic_resume(), and instead suspends each child individually, which can lead to devices being resumed multiple times, but I'm uncertain how to fix that. Any ideas? One I had was to have some kind of 'bus_generic_resume_filtered' or similar, that lets bus_generic_resume run its logic, but filter through a function to determine if the child is resumable. But that doesn't quite feel right to me. - Justin