linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH] PM: runtime: Use pmruntime sync variant to put suppliers
Date: Thu, 8 Oct 2020 04:08:06 +0300	[thread overview]
Message-ID: <e24794e5-419c-ad5f-c281-12a6e15cfa4c@linaro.org> (raw)
In-Reply-To: <CAJZ5v0hxdxV6pB5q94qCEmeDXOMJQzL3b8ZokgTn00i0MbykvQ@mail.gmail.com>

Hi Rafael,

On 10/7/20 5:37 PM, Rafael J. Wysocki wrote:
> On Wed, Oct 7, 2020 at 2:20 AM Stanimir Varbanov
> <stanimir.varbanov@linaro.org> wrote:
>>
>> Calling pm_runtime_put_sync over a device with suppliers with device
>> link flags PM_RUNTIME | RPM_ACTIVE it is observed that the supplier
>> is not put (turned off) at the end, but instead put asynchronously.
> 
> Yes, that's by design.
> 
>> In some case This could lead to issues for the callers which expects
>> that the pmruntime sync variants should also put the suppliers
>> synchronously.
> 
> Why would anyone expect that to happen?

It is logical to me that when I call pm_runtime_put_sync the device and
its suppliers are put synchronously. If I want to put device and its
suppliers asynchronously I'd use pm_runtime_put. Is that wrong assumption?

> 
>> Also the opposite rpm_get_suppliers is already using pmruntime _sync
>> variant of the API.
> 
> Yes, it does, because that is necessary.
> 
>> Correct this by changing pmruntime_put to pmruntime_put_sync in
>> rpm_put_suppliers.
> 
> It is not a correction, but a change in behavior without good enough
> rationale, as it stands.

In my driver case I want to deal with a recovery of a crash in remote
processor (the remote processor is used to control and program hardware
blocks and also to communicate with host processor through shared
memory). To restart the remote processor I have to disable clocks and
turn off few power domains (one of the power domains is made a supplier
of my main device) in order to complete the cold-boot.

The problem I'm facing with this design is that when I call
runtime_put_sync (to disable device's clocks and turn off power domain)
the clocks are disabled (part of pmruntime_suspend callback) but the
pmdomain (the device supplier) is not turned synchronously. I workaround
this by checking the supplier device via pm_runtime_active() until it
becomes inactive and the continue with rest of the steps.

From my point of view this check for supplier activity should be part of
pmruntime API.

> 
> Thanks!
> 

-- 
regards,
Stan

  reply	other threads:[~2020-10-08  1:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07  0:19 [PATCH] PM: runtime: Use pmruntime sync variant to put suppliers Stanimir Varbanov
2020-10-07 14:37 ` Rafael J. Wysocki
2020-10-08  1:08   ` Stanimir Varbanov [this message]
2020-11-05 17:42     ` 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=e24794e5-419c-ad5f-c281-12a6e15cfa4c@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --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).