From: Tony Lindgren <tony@atomide.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Andreas Fenkart <afenkart@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <balbi@ti.com>,
Huiquan Zhong <huiquan.zhong@intel.com>,
Kevin Hilman <khilman@kernel.org>, NeilBrown <neilb@suse.de>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Nishanth Menon <nm@ti.com>,
Peter Hurley <peter@hurleysoftware.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-omap@vger.kernel.org,
Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 1/4] PM / Wakeirq: Add minimal device wakeirq helper functions
Date: Fri, 6 Mar 2015 15:05:40 -0800 [thread overview]
Message-ID: <20150306230539.GA2651@atomide.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1503061358260.1407-100000@iolanthe.rowland.org>
* Alan Stern <stern@rowland.harvard.edu> [150306 11:05]:
> On Fri, 6 Mar 2015, Tony Lindgren wrote:
>
> > > > + struct wakeirq_source *wirq = _wirq;
> > > > + irqreturn_t ret = IRQ_NONE;
> > > > +
> > > > + /* We don't want RPM_ASYNC or RPM_NOWAIT here */
> > > > + if (pm_runtime_suspended(wirq->dev)) {
> > >
> > > What if the device is resumed on a different CPU right here?
> >
> > Good point, sounds like we need to do this in some pm_runtime
> > function directly for the locking.
> >
> > > > + pm_runtime_mark_last_busy(wirq->dev);
> > > > + pm_runtime_resume(wirq->dev);
> > >
> > > Calling this with disabled interrupts is a bad idea in general.
> > > Is the device guaranteed to have power.irq_safe set?
> >
> > Well right now it's using threaded irq, and I'd like to get rid of
> > the pm_runtime calls in the regular driver interrupts completely.
> > We need to ensure the device runtime_resume is completed before
> > returning IRQ_HANDLED here.
>
> In general, runtime_resume methods are allowed to sleep. They can't be
> used in an interrupt handler top half unless the driver has
> specifically promised they are IRQ-safe. That's what Rafael was
> getting at.
Yes I understand, otherwise things certainly would not work :)
> Of course, if this routine is a threaded-irq bottom half then there's
> no problem.
Right this is threaded-irq bottom half because the devices may
need to restore state and start regulators.
> > > I guess what you want to call here is pm_request_resume() and
> > > I wouldn't say that calling pm_runtime_mark_last_busy() on a
> > > suspended device was valid.
> >
> > I'll verify again, but I believe the issue was that without doing
> > mark_last_busy here the device falls back asleep right away.
> > That probably should be fixed in pm_runtime in general if that's
> > the case.
>
> It's up to the subsystem to handle this. For example, the USB
> subsystem's runtime-resume routine calls pm_runtime_mark_last_busy.
Hmm.. OK thanks this probably explains why pm_request_resume() did
not work.
For omaps, I could call this from the interconnect related code,
but then how dow we deal with the subsystems that don't call it?
> > Considering the above, should we add a new function something like
> > pm_resume_complete() that does not need irq_safe set but does
> > not return until the device has completed resume?
>
> That doesn't make sense. You're asking for a routine that is allowed
> to sleep but can safely be called in interrupt context.
Oh it naturally would not work in irq context, it's for the bottom
half again. But I'll take a look if we can just call
pm_request_resume() and disable_irq() on the wakeirq in without
waiting for the device driver runtime_suspend to disable the wakeirq.
That would minimize the interface to just dev_pm_request_wakeirq()
and dev_pm_free_wakeirq().
Regards,
Tony
next prev parent reply other threads:[~2015-03-06 23:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1425602049-2674-1-git-send-email-tony@atomide.com>
[not found] ` <1425602049-2674-2-git-send-email-tony@atomide.com>
2015-03-06 2:02 ` [PATCH 1/4] PM / Wakeirq: Add minimal device wakeirq helper functions Rafael J. Wysocki
2015-03-06 12:41 ` Rafael J. Wysocki
2015-03-06 16:19 ` Tony Lindgren
2015-03-06 19:05 ` Alan Stern
2015-03-06 23:05 ` Tony Lindgren [this message]
2015-03-07 0:43 ` Rafael J. Wysocki
2015-03-07 1:09 ` Tony Lindgren
2015-03-08 15:43 ` Alan Stern
2015-03-09 14:09 ` Rafael J. Wysocki
2015-03-08 15:41 ` Alan Stern
2015-03-09 15:09 ` Tony Lindgren
2015-03-09 15:42 ` Alan Stern
2015-03-09 16:41 ` Tony Lindgren
2015-03-06 23:30 ` Rafael J. Wysocki
2015-03-08 15:34 ` Alan Stern
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=20150306230539.GA2651@atomide.com \
--to=tony@atomide.com \
--cc=afenkart@gmail.com \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=huiquan.zhong@intel.com \
--cc=khilman@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=neilb@suse.de \
--cc=nm@ti.com \
--cc=peter@hurleysoftware.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
--cc=tglx@linutronix.de \
--cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).