linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Vivek Gautam <vivek.gautam@codeaurora.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>, Linux PM <linux-pm@vger.kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Will Deacon <will.deacon@arm.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"list@263.net:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	Joerg Roedel <joro@8bytes.org>, Rob Herring <robh+dt@kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	freedreno <freedreno@lists.freedesktop.org>
Subject: Re: [PATCH v12 1/4] iommu/arm-smmu: Add pm_runtime/sleep ops
Date: Mon, 16 Jul 2018 12:23:12 +0200	[thread overview]
Message-ID: <CAJZ5v0irayU5cWBHtE=YVVqK_4gnue9bGopLkPY9P7-bEsixCA@mail.gmail.com> (raw)
In-Reply-To: <010cb56a-36e8-e729-1fe7-738048eb551d@codeaurora.org>

Hi,

On Mon, Jul 16, 2018 at 12:11 PM, Vivek Gautam
<vivek.gautam@codeaurora.org> wrote:
> HI Rafael,
>
>
>
> On 7/16/2018 2:21 PM, Rafael J. Wysocki wrote:
>>
>> On Thu, Jul 12, 2018 at 12:57 PM, Vivek Gautam
>> <vivek.gautam@codeaurora.org> wrote:

[cut]

>>>> Although, given the PM
>>>> subsystem internals, the suspend function wouldn't be called on SMMU
>>>> implementation needed power control (since they would have runtime PM
>>>> enabled) and on others, it would be called but do nothing (since no
>>>> clocks).
>>>>
>>>>> Honestly, I just don't know. :-)
>>>>>
>>>>> It just looks odd the way it is done.  I think the clock should be
>>>>> gated during system-wide suspend too, because the system can spend
>>>>> much more time in a sleep state than in the working state, on average.
>>>>>
>>>>> And note that you cannot rely on runtime PM to always do it for you,
>>>>> because it may be disabled at a client device or even blocked by user
>>>>> space via power/control in sysfs and that shouldn't matter for
>>>>> system-wide PM.
>>>>
>>>> User space blocking runtime PM through sysfs is a good point. I'm not
>>>> 100% sure how the PM subsystem deals with that in case of system-wide
>>>> suspend. I guess for consistency and safety, we should have the
>>>> suspend callback.
>>>
>>> Will add the following suspend callback (same as
>>> arm_smmu_runtime_suspend):
>>>
>>>   static int __maybe_unused arm_smmu_pm_suspend(struct device *dev)
>>>   {
>>>           struct arm_smmu_device *smmu = dev_get_drvdata(dev);
>>>
>>>           clk_bulk_disable(smmu->num_clks, smmu->clks);
>>>
>>>           return 0;
>>>   }
>>
>> I think you also need to check if the clock has already been disabled
>> by runtime PM.  Otherwise you may end up disabling it twice in a row.
>
>
> Should I rather call a pm_runtime_put() in suspend callback?

That wouldn't work as runtime PM may be effectively disabled by user
space via sysfs.  That's one of the reasons why you need the extra
system-wide suspend callback in the first place. :-)

> Or an expanded form something similar to:
> https://elixir.bootlin.com/linux/v4.18-rc5/source/drivers/slimbus/qcom-ctrl.c#L695

Yes, you can do something like that, but be careful to make sure that
the state of the device after system-wide resume is consistent with
its runtime PM status in all cases.

  reply	other threads:[~2018-07-16 10:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-08 17:34 [PATCH v12 0/4] iommu/arm-smmu: Add runtime pm/sleep support Vivek Gautam
2018-07-08 17:34 ` [PATCH v12 1/4] iommu/arm-smmu: Add pm_runtime/sleep ops Vivek Gautam
2018-07-11  9:50   ` Rafael J. Wysocki
2018-07-11 10:55     ` Vivek Gautam
2018-07-11 11:11       ` Rafael J. Wysocki
2018-07-11 12:51         ` Tomasz Figa
2018-07-11 13:40           ` Marek Szyprowski
2018-07-11 20:36             ` Rafael J. Wysocki
2018-07-23  5:59               ` Marek Szyprowski
2018-07-23 11:05                 ` Rafael J. Wysocki
2018-07-12 10:57           ` Vivek Gautam
2018-07-16  8:51             ` Rafael J. Wysocki
2018-07-16 10:11               ` Vivek Gautam
2018-07-16 10:23                 ` Rafael J. Wysocki [this message]
2018-07-08 17:34 ` [PATCH v12 2/4] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device Vivek Gautam
2018-07-11  9:51   ` Rafael J. Wysocki
2018-07-11 10:05     ` Tomasz Figa
2018-07-11 10:59       ` Rafael J. Wysocki
2018-07-11 11:30         ` Vivek Gautam
2018-07-08 17:34 ` [PATCH v12 3/4] iommu/arm-smmu: Add the device_link between masters and smmu Vivek Gautam
2018-07-11  9:53   ` Rafael J. Wysocki
2018-07-11 10:36     ` Vivek Gautam
2018-07-12 12:41       ` Vivek Gautam
2018-07-16  8:55         ` Rafael J. Wysocki
2018-07-16 11:46           ` Vivek Gautam
2018-07-17  7:46             ` Rafael J. Wysocki
2018-07-17  8:30               ` Vivek Gautam
2018-07-18  9:30     ` Vivek Gautam
2018-07-18 12:43       ` Robin Murphy
2018-07-18 13:31         ` Vivek Gautam
2018-07-08 17:34 ` [PATCH v12 4/4] iommu/arm-smmu: Add support for qcom,smmu-v2 variant Vivek Gautam

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='CAJZ5v0irayU5cWBHtE=YVVqK_4gnue9bGopLkPY9P7-bEsixCA@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tfiga@chromium.org \
    --cc=vivek.gautam@codeaurora.org \
    --cc=will.deacon@arm.com \
    /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).