All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Linux Documentation <linux-doc@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: Re: [Resend][PATCH 2/3] PM / core / docs: Convert sleep states API document to reST
Date: Tue, 10 Jan 2017 02:41:02 +0100	[thread overview]
Message-ID: <20170110014102.GA23533@wunner.de> (raw)
In-Reply-To: <3016250.oKr138Ysat@aspire.rjw.lan>

Hi Rafael,

I've perused devices.rst up until section "Entering System Suspend"
so far, about half of the document.  Here are my comments, I'll read
the remainder of the document later.


On Fri, Jan 06, 2017 at 02:41:38AM +0100, Rafael J. Wysocki wrote:
> +.. |struct| replace:: :c:type:`struct`
[...]
> +|struct| :c:type:`dev_pm_ops` defined in :file:`include/linux/pm.h`.

I don't know what the proper markup for structs is, but this renders
differently than what the DRM folks use, e.g.:

:c:type:`struct drm_driver <drm_driver>`


> +++ linux-pm/Documentation/driver-api/pm/index.rst
> @@ -0,0 +1,15 @@
> +=======================
> +Device Power Management
> +=======================
> +
> +.. toctree::
> +
> +   types
> +   devices

I'd invert the order of these two, seems better didactically to have
the prose introduction in devices.rst first, then the gory details
in types.rst.


> +There also is a deprecated "old" or "legacy" interface for power management
> +operations available at least for some subsystems.  This approach does not use
> +|struct| :c:type`dev_pm_ops` objects and it is suitable only for implementing

~~~~~~~~~~~~~~~~~~~^
                   missing colon, renders incorrectly


> +:c:member`power.wakeup` field is a pointer to an object of type

~~~~~~~~~~~~^
            missing colon, renders incorrectly


> +Call Sequence Guarantees
> +------------------------
> +
> +To ensure that bridges and similar links needing to talk to a device are
> +available when the device is suspended or resumed, the device hierarchy is
> +walked in a bottom-up order to suspend devices.  A top-down order is
> +used to resume those devices.
> +
> +The ordering of the device hierarchy is defined by the order in which devices
> +get registered:  a child can never be registered, probed or resumed before
> +its parent; and can't be removed or suspended after that parent.
> +
> +The policy is that the device hierarchy should match hardware bus topology.
> +[Or at least the control bus, for devices which use multiple busses.]
> +In particular, this means that a device registration may fail if the parent of
> +the device is suspending (i.e. has been chosen by the PM core as the next
> +device to suspend) or has already suspended, as well as after all of the other
> +devices have been suspended.  Device drivers must be prepared to cope with such
> +situations.

Hm, "device registration may fail if the parent of the device is
suspending".  Why would a device be registered at all during the
system sleep process?  My understanding was that new devices are not
*allowed* to be registered during system sleep.  We sort of enforce that
in the driver core since 4.5 in so far as newly registered devices are
not bound until after ->complete.  (So there's no hard rule that
registering new devices is forbidden, but binding drivers is postponed.)

Confusingly, device_resume() contains a comment suggesting that
registering new children is already allowed from ->resume.

        /*
         * This is a fib.  But we'll allow new children to be added below
         * a resumed device, even if the device hasn't been completed yet.
         */
        dev->power.is_prepared = false;

My understanding was also that the purpose of the ->prepare hook is to
disable recognition and registration of new child devices, e.g. by
disabling hotplug interrupts.  For this reason, the device hierarchy is
walked top-down during ->prepare, the opposite of the following ->suspend
hooks.  Since ->complete mirrors ->prepare and is supposed to undo
its effects (i.e. re-enable registration of children), it walks the
device hierarchy bottom-up (which again is the opposite direction of
the preceding ->resume hooks.  That's what Alan Stern told me in a mailing
list conversation last year, it might be worth to add the information to
this paragraph.

Thanks,

Lukas

  reply	other threads:[~2017-01-10  1:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06  1:38 [PATCH 0/3] PM / docs: linux/pm.h kerneldocs update and conversion of two docs to reST Rafael J. Wysocki
2017-01-06  1:39 ` [Resend][PATCH 1/3] PM / core: Update kerneldoc comments in pm.h Rafael J. Wysocki
2017-01-06  1:41 ` [Resend][PATCH 2/3] PM / core / docs: Convert sleep states API document to reST Rafael J. Wysocki
2017-01-10  1:41   ` Lukas Wunner [this message]
2017-01-11  2:58     ` Rafael J. Wysocki
2017-01-06  1:44 ` [PATCH 3/3] PM / sleep / docs: Convert PM notifiers " Rafael J. Wysocki
2017-01-09  1:34 ` [PATCH 0/3] PM / docs: linux/pm.h kerneldocs update and conversion of two docs " Lukas Wunner
2017-02-02  0:06   ` Rafael J. Wysocki

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=20170110014102.GA23533@wunner.de \
    --to=lukas@wunner.de \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=rjw@rjwysocki.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.