public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Nate Lawson <nate-Y6VGUYTwhu0@public.gmane.org>
To: Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
Cc: Nathan Bryant <nbryant-p32f3XyCuykqcZcGjlUOXw@public.gmane.org>,
	ACPI Developers
	<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	"Li,
	Shaohua" <shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Georg C. F. Greve" <greve-mXXj517/zsQ@public.gmane.org>
Subject: Re: acpi-20040715: functional regression on ASUS M2N
Date: Fri, 06 Aug 2004 09:38:27 -0700	[thread overview]
Message-ID: <4113B403.10700@root.org> (raw)
In-Reply-To: <1091805831.3893.6.camel@tyrosine>

Matthew Garrett wrote:
> On Thu, 2004-08-05 at 14:49 -0400, Nathan Bryant wrote:
>>The ELCR save/restore patch is causing regressions for some people. What 
>>if the problem is that we're saving/restoring registers at the wrong time?
> 
> 
> On closer investigation, I found that the system was restoring my ioapic
> state /after/ it had started the programmable interrupt timer back up.
> Changing line 310 of drivers/base/sys.c to list_for_each_entry_reverse
> seems to have greatly improved my ability to suspend and resume (which
> worked fine before the interrupt controller suspend/resume patches,
> except that I didn't get many interrupts...) 
> 
> There doesn't seem to be any fine-grained way to control the order of
> suspend/resume for individual drivers. It seems to be assumed that
> everything that devices depend on will be higher than them in the tree,
> and so everything will "just work" - I'm not sure this is true. As
> another example, I just had my wireless card fail to resume correctly.
> It tried to do a hotplug firmware load on resume. Which was difficult,
> because it was resumed before the IDE interface was. How can this sort
> of thing be avoided?

With a real device framework.  We (FreeBSD) propagate suspend requests 
throough our generic device structure.  Each parent and child has a 
method which can be overridden.  This starts at the root and is 
propagated downward.

For instance, the PCI driver has methods that save/restore BARs:
         DEVMETHOD(device_suspend,       pci_suspend),
         DEVMETHOD(device_resume,        pci_resume),

The suspend function does its work and then calls bus_generic_suspend() 
which propagates the request down to the children.  Or if it knows that 
it needs to run after all children have suspended, it calls 
bus_generic_suspend() first, then does its work.

/**
  * @brief Helper function for implementing DEVICE_SUSPEND()
  *
  * This function can be used to help implement the DEVICE_SUSPEND()
  * for a bus. It calls DEVICE_SUSPEND() for each of the device's
  * children. If any call to DEVICE_SUSPEND() fails, the suspend
  * operation is aborted and any devices which were suspended are
  * resumed immediately by calling their DEVICE_RESUME() methods.
  */
int
bus_generic_suspend(device_t dev)
{
         int             error;
         device_t        child, child2;

         TAILQ_FOREACH(child, &dev->children, link) {
                 error = DEVICE_SUSPEND(child);
                 if (error) {
                         for (child2 = TAILQ_FIRST(&dev->children);
                              child2 && child2 != child;
                              child2 = TAILQ_NEXT(child2, link))
                                 DEVICE_RESUME(child2);
                         return (error);
                 }
         }
         return (0);
}

The key helpful thing is that each driver can specify its own methods 
through its device object but they can be called in a generic way.  For 
instance, if the root bus does "device_suspend(pci_dev)", then the 
actual function call expanded at run time is "pci_suspend(pci_dev)"

-Nate


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com

  parent reply	other threads:[~2004-08-06 16:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 18:49 acpi-20040715: functional regression on ASUS M2N Nathan Bryant
     [not found] ` <4112814C.2070808-p32f3XyCuykqcZcGjlUOXw@public.gmane.org>
2004-08-06 11:21   ` Georg C. F. Greve
     [not found]     ` <m37jsc3424.fsf-glUV91rXKAHWIjgkaejU9x2eb7JE58TQ@public.gmane.org>
2004-08-06 13:36       ` Nathan Bryant
     [not found]         ` <41138944.3060309-p32f3XyCuykqcZcGjlUOXw@public.gmane.org>
2004-08-06 16:54           ` Georg C. F. Greve
     [not found]             ` <m3u0vgurzy.fsf-glUV91rXKAHWIjgkaejU9x2eb7JE58TQ@public.gmane.org>
2004-08-06 17:07               ` Nathan Bryant
     [not found]                 ` <4113BAD5.1030909-p32f3XyCuykqcZcGjlUOXw@public.gmane.org>
2004-08-06 20:50                   ` Georg C. F. Greve
2004-08-31  8:15                     ` Georg C. F. Greve
2004-08-06 15:23   ` Matthew Garrett
2004-08-06 15:50     ` Nathan Bryant
2004-08-06 16:38     ` Nate Lawson [this message]
2004-08-06 19:32     ` Nathan Bryant
  -- strict thread matches above, loose matches on Subject: below --
2004-08-31  8:45 Li, Shaohua
     [not found] ` <B44D37711ED29844BEA67908EAF36F03AC6ACF-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-08-31 13:38   ` Georg C. F. Greve
     [not found]     ` <m3zn4bbf6x.fsf-eMhNhoSsuh6q92djB/mqZw@public.gmane.org>
2004-09-01 15:16       ` Georg C. F. Greve
2004-08-09  8:10 Li, Shaohua
2004-08-02 16:45 Nathan Bryant
     [not found] ` <410E6F9C.2040904-p32f3XyCuykqcZcGjlUOXw@public.gmane.org>
2004-08-04  0:23   ` Georg C. F. Greve
2004-07-27 12:24 Li, Shaohua
     [not found] ` <B44D37711ED29844BEA67908EAF36F036BCD7C-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-07-27 13:42   ` Georg C. F. Greve
2004-07-19 23:31 Georg C. F. Greve
     [not found] ` <m3d62rzi9a.fsf-eMhNhoSsuh6q92djB/mqZw@public.gmane.org>
2004-07-20 19:03   ` Matthew Garrett
     [not found]     ` <1090350197.4828.5.camel-myFlNLNQP+Q@public.gmane.org>
2004-07-21  8:17       ` Georg C. F. Greve
     [not found]         ` <m3acxthizw.fsf-eMhNhoSsuh6q92djB/mqZw@public.gmane.org>
2004-07-27 11:14           ` Georg C. F. Greve
     [not found]             ` <m3oem1u2gg.fsf-glUV91rXKAHWIjgkaejU9x2eb7JE58TQ@public.gmane.org>
2004-07-27 11:24               ` Matthew Garrett
     [not found]                 ` <1090927462.4412.26.camel-myFlNLNQP+Q@public.gmane.org>
2004-07-27 13:40                   ` Georg C. F. Greve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4113B403.10700@root.org \
    --to=nate-y6vguytwhu0@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=greve-mXXj517/zsQ@public.gmane.org \
    --cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
    --cc=nbryant-p32f3XyCuykqcZcGjlUOXw@public.gmane.org \
    --cc=shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox