linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	<linux-leds@vger.kernel.org>, Linux PM <linux-pm@vger.kernel.org>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH 2/2] PM-runtime: allow userspace to monitor runtime_status changes
Date: Tue, 3 Sep 2019 10:31:51 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1909031017130.1859-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <CAC5umyhBkvWFaRpzJ=xtdnf_fLHe2OeJJ01sve8F6HA0=MuLMQ@mail.gmail.com>

On Tue, 3 Sep 2019, Akinobu Mita wrote:

> 2019年9月3日(火) 6:47 Rafael J. Wysocki <rafael@kernel.org>:
> >
> > On Sun, Sep 1, 2019 at 4:09 PM Akinobu Mita <akinobu.mita@gmail.com> wrote:
> > >
> > > This enables the /sys/devices/.../power/runtime_status attribute to
> > > allow the user space to get notifications via poll/select when the device
> > > runtime PM status is changed.
> > >
> > > An example use case is to avoid unnecessary accesses for device statistics
> > > (e.g. diskstats for block devices) while the device is in runtime suspend
> > > by user space LED device actitity trigger.
> > >
> > > Cc: Alan Stern <stern@rowland.harvard.edu>
> > > Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

> > There are concerns about this.
> >
> > First off, it adds overhead for devices that change the PM-runtime
> > status relatively often.  I'm not sure if that's sufficiently
> > justified.
> >
> > Second, it is called for status changes from "active" to "suspending"
> > and from "suspending" to "suspended" (and analogously for resume)
> > which may not be particularly useful.  At least, user space may not
> > have enough time to act on such notifications.
> >
> > Finally, it is racy, because at the time user space does something on
> > a device PM-runtime status change, it very well may have changed the
> > other way around already.
> 
> I withdraw this patch now.  I hope I'll retry with a real use case example
> program.

You might want to take a look at commit 7794f486ed0b ("usbfs: Add
ioctls for runtime power management") in the usb-next branch of Greg
KH's usb.git tree.  It adds a mechanism for user programs to wait until
a device has done a runtime resume, without races.

But it is not general purpose (it applies only to USB devices), it
doesn't use poll(), and it doesn't check for other kinds of runtime PM
status changes.

Alan Stern


  reply	other threads:[~2019-09-03 14:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-01 14:08 [PATCH 1/2] PM-runtime: Documentation: add runtime_status ABI document Akinobu Mita
2019-09-01 14:08 ` [PATCH 2/2] PM-runtime: allow userspace to monitor runtime_status changes Akinobu Mita
2019-09-02 21:47   ` Rafael J. Wysocki
2019-09-03 13:13     ` Akinobu Mita
2019-09-03 14:31       ` Alan Stern [this message]
2019-09-01 14:23 ` [PATCH 1/2] PM-runtime: Documentation: add runtime_status ABI document Dominik Brodowski
2019-09-02 21:39   ` 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=Pine.LNX.4.44L0.1909031017130.1859-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=akinobu.mita@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=rafael@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).