[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1503061358260.1407-100000@iolanthe.rowland.org>
Date: Fri, 6 Mar 2015 14:05:43 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Tony Lindgren <tony@...mide.com>
cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Andreas Fenkart <afenkart@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...com>,
Huiquan Zhong <huiquan.zhong@...el.com>,
Kevin Hilman <khilman@...nel.org>, NeilBrown <neilb@...e.de>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Nishanth Menon <nm@...com>,
Peter Hurley <peter@...leysoftware.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Ulf Hansson <ulf.hansson@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
<linux-kernel@...r.kernel.org>, <linux-serial@...r.kernel.org>,
<linux-omap@...r.kernel.org>,
Linux PM list <linux-pm@...r.kernel.org>
Subject: Re: [PATCH 1/4] PM / Wakeirq: Add minimal device wakeirq helper
functions
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.
Of course, if this routine is a threaded-irq bottom half then there's
no problem.
> > 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.
> 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.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists