Linux IOMMU Development
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Kevin Hilman <khilman@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	iommu@lists.linux-foundation.org, Len Brown <len.brown@intel.com>,
	Pavel Machek <pavel@ucw.cz>, Heiko Stuebner <heiko@sntech.de>,
	Joerg Roedel <joro@8bytes.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [RFC PATCH 2/2] iommu: rockchip: Handle system-wide and runtime PM
Date: Thu, 11 Dec 2014 21:48:17 +0100	[thread overview]
Message-ID: <1576771.dIVCOxU0se@vostro.rjw.lan> (raw)
In-Reply-To: <CAPDyKFo6zH4__Odm+RiJCbvXquAQqaLyCAiXrSN6s3KfQhok=A@mail.gmail.com>

On Thursday, December 11, 2014 04:51:37 PM Ulf Hansson wrote:
> On 11 December 2014 at 16:31, Kevin Hilman <khilman@kernel.org> wrote:
> > [+ Laurent Pinchart]
> >
> > Tomasz Figa <tfiga@chromium.org> writes:
> >
> >> On Thu, Dec 11, 2014 at 8:58 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > [...]
> >
> >>>> @@ -988,11 +1107,28 @@ static int rk_iommu_probe(struct platform_device *pdev)
> >>>>                 return -ENXIO;
> >>>>         }
> >>>>
> >>>> +       pm_runtime_no_callbacks(dev);
> >>>> +       pm_runtime_enable(dev);
> >>>> +
> >>>> +       /* Synchronize state of the domain with driver data. */
> >>>> +       pm_runtime_get_sync(dev);
> >>>> +       iommu->is_powered = true;
> >>>
> >>> Doesn't the runtime PM status reflect the value of "is_powered", thus
> >>> why do you need to have a copy of it? Could it perpahps be that you
> >>> try to cope with the case when CONFIG_PM is unset?
> >>>
> >>
> >> It's worth noting that this driver fully relies on status of other
> >> devices in the power domain the IOMMU is in and does not enforce the
> >> status on its own. So in general, as far as my understanding of PM
> >> runtime subsystem, the status of the IOMMU device will be always
> >> suspended, because nobody will call pm_runtime_get() on it (except the
> >> get and put pair in probe). So is_powered is here to track status of
> >> the domain, not the device. Feel free to suggest a better way, though.
> >
> > I still don't like these notifiers.  I think they add ways to bypass
> > having proper runtime PM implemented for devices/subsystems.
> 
> I do agree, but I haven't found another good solution to the problem.

For the record, I'm not liking this mostly because it "fixes" a generic problem
in a way that's hidden in the genpd code and very indirect.

> > From a high-level, the IOMMU is just another device inside the PM
> > domain, so ideally it should be doing it's own _get() and _put() calls
> > so the PM domain code would just do the right thing without the need for
> > notifiers.
> 
> As I understand it, the IOMMU (or for other similar cases) shouldn't
> be doing any get() and put() at all because there are no IO API to
> serve request from.
> 
> In principle we could consider these kind devices as "parent" devices
> to those other devices that needs them. Then runtime PM core would
> take care of things for us, right!?
> 
> Now, I am not so sure using the "parent" approach is actually viable,
> since it will likely have other complications, but I haven't
> thoroughly thought it though yet.

That actually need not be a "parent".

What's needed in this case is to do a pm_runtime_get_sync() on a device
depended on every time a dependent device is runtime-resumed (and analogously
for suspending).

The core doesn't have a way to do that, but it looks like we'll need to add
it anyway for various reasons (ACPI _DEP is one of them as I mentioned some
time ago, but people dismissed it basically as not their problem).


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2014-12-11 20:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11  8:26 [RFC PATCH 0/2] Fix rockchip IOMMU driver vs PM issues Tomasz Figa
2014-12-11  8:26 ` [RFC PATCH 1/2] pm: Add PM domain notifications Tomasz Figa
2014-12-11 10:36   ` Sylwester Nawrocki
2014-12-11 11:04     ` Tomasz Figa
2014-12-11 13:54       ` Sylwester Nawrocki
     [not found]         ` <5489A227.8010907-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-12-11 15:30           ` Ulf Hansson
2014-12-11  8:26 ` [RFC PATCH 2/2] iommu: rockchip: Handle system-wide and runtime PM Tomasz Figa
2014-12-11 11:58   ` Ulf Hansson
2014-12-11 12:42     ` Tomasz Figa
     [not found]       ` <CAAFQd5CA374MF-_w=3zqsZctwTcBHz9J_0Ygg4fD_wjg8kLATg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-11 15:22         ` Ulf Hansson
2014-12-11 15:31       ` Kevin Hilman
     [not found]         ` <7h8uiemce7.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2014-12-11 15:51           ` Ulf Hansson
2014-12-11 20:48             ` Rafael J. Wysocki [this message]
2014-12-12  4:15               ` Tomasz Figa
2014-12-12 20:04                 ` Kevin Hilman
2014-12-15  2:32                   ` Tomasz Figa
     [not found]                   ` <7ha92sk533.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2014-12-15  8:35                     ` Geert Uytterhoeven
     [not found]                       ` <CAMuHMdVpCgK-hNqZ=JWjFGS53g+ZUQ5t=uBxtN1qGXJhoRg8BQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-15 18:06                         ` Kevin Hilman
     [not found]                 ` <CAAFQd5B28WiWUqmbmROJUa3H25R=Y774NuemTZDvkoa=CvZUsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-12 20:47                   ` Laurent Pinchart
2014-12-15  2:39                     ` Tomasz Figa
     [not found]                       ` <CAAFQd5A5UAYpV6Z3ii+TTuPOxJF8VFJmnUnHZWkc9dZN04qxYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-15 19:53                         ` Laurent Pinchart
2014-12-16  2:18                           ` Tomasz Figa
2014-12-17  0:15                             ` Laurent Pinchart
2014-12-18  1:32                               ` Rafael J. Wysocki
2014-12-18 19:12                                 ` Laurent Pinchart
2014-12-18 21:14                                   ` Kevin Hilman
     [not found]                                     ` <7hppbg7j9r.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2014-12-18 21:28                                       ` Laurent Pinchart
2014-12-19  2:27                                         ` Rafael J. Wysocki
2014-12-20 19:01                                           ` Laurent Pinchart

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=1576771.dIVCOxU0se@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=djkurtz@chromium.org \
    --cc=geert+renesas@glider.be \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=khilman@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=len.brown@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=pavel@ucw.cz \
    --cc=s.nawrocki@samsung.com \
    --cc=tfiga@chromium.org \
    --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