From: Sakari Ailus <sakari.ailus@iki.fi>
To: Martin Kepplinger <martin.kepplinger@puri.sm>
Cc: mchehab@kernel.org, laurent.pinchart@ideasonboard.com,
kernel@puri.sm, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] media: hi846: fix usage of pm_runtime_get_if_in_use()
Date: Fri, 7 Apr 2023 21:37:56 +0300 [thread overview]
Message-ID: <ZDBjBNu6UXksVSwQ@valkosipuli.retiisi.eu> (raw)
In-Reply-To: <cb0c1ad7e00523a43ce6ad73a79e7e396c4b52aa.camel@puri.sm>
Hi Martin,
On Fri, Apr 07, 2023 at 03:31:02PM +0200, Martin Kepplinger wrote:
> Am Mittwoch, dem 05.04.2023 um 15:52 +0300 schrieb Sakari Ailus:
> > Hi Martin,
> >
> > On Wed, Apr 05, 2023 at 11:29:03AM +0200, Martin Kepplinger wrote:
> > > pm_runtime_get_if_in_use() does not only return nonzero values when
> > > the device is in use, it can return a negative errno too.
> > >
> > > And especially during resuming from system suspend, when runtime pm
> > > is not yet up again, this can very well happen. And in such a case
> > > the subsequent pm_runtime_put() call would result in a refcount
> > > underflow!
> >
> > I think this issue should have a more generic solution, it's very
> > difficult
> > to address this in drivers only with the current APIs.
> >
> > pm_runtime_get_if_in_use() will also return an error if runtime PM is
> > disabled, so this patch will break the driver for that configuration.
>
> ok but the driver is currently broken for any *other* error returned by
> pm_runtime_get_if_in_use() (than the runtime-PM disabled error).
>
> The execution-path during system-resume I'm interested in gets -EAGAIN
> here. Would it be ok for you if I'd return early only for that one
> error only here?
I guess... but I think to address this in a way that's reasonable to
drivers, we'll need improvements to runtime PM API. A largish number of
drivers need changes and before doing that we should figure out exactly
what should be done.
I thought you could effectively trigger this issue by calling runtime PM
resume/suspend functions before enabling runtime PM, but this seems to be a
different case.
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2023-04-07 18:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 9:29 [PATCH v1 0/2] media: hi846: support system suspend while streaming Martin Kepplinger
2023-04-05 9:29 ` [PATCH v1 1/2] media: hi846: fix usage of pm_runtime_get_if_in_use() Martin Kepplinger
2023-04-05 12:52 ` Sakari Ailus
2023-04-06 1:33 ` Laurent Pinchart
2023-04-06 13:36 ` Sakari Ailus
2023-04-07 4:32 ` Laurent Pinchart
2023-04-07 13:31 ` Martin Kepplinger
2023-04-07 18:37 ` Sakari Ailus [this message]
2023-04-06 1:32 ` Laurent Pinchart
2023-04-05 9:29 ` [PATCH v1 2/2] media: hi846: preserve the streaming state during system suspend Martin Kepplinger
2023-04-06 1:35 ` Laurent Pinchart
2023-04-11 9:39 ` Martin Kepplinger
2023-04-11 11:15 ` 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=ZDBjBNu6UXksVSwQ@valkosipuli.retiisi.eu \
--to=sakari.ailus@iki.fi \
--cc=kernel@puri.sm \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=martin.kepplinger@puri.sm \
--cc=mchehab@kernel.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
all inboxes | Powered by JetHome®