mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
	 Kyungmin Park <kyungmin.park@samsung.com>,
	 Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Dong Aisheng <aisheng.dong@nxp.com>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3 0/2] PM / devfreq: Do not change the frequency of a suspended device
Date: Thu, 19 Nov 2026 21:16:21 +0000	[thread overview]
Message-ID: <20261119-devfreq-suspend-sync-v3-0-ef19fbf94d83@gmail.com> (raw)

From the review of a panthor patch [1]: Boris Brezillon pointed out that
the devfreq core, not the driver, should stop calling ->target() between
devfreq_suspend_device() and devfreq_resume_device().

1/2 is v2 of [2], which 2/2 builds on. The panthor side is [3].

Tested on an Orange Pi 5 (RK3588S), v7.3-based kernel with [3],
GPU clock on SCMI_CLK_GPU with a 200 MHz opp-suspend (Jonas Karlman's
RFC, not in mainline).
min_freq, max_freq, the userspace governor's set_freq and the cooling
state written while the GPU was runtime suspended take effect on resume,
with no SError; min_freq also after s2idle and deep suspend. 200 runtime
suspend/resume cycles with changing limits. A KUnit test (not posted)
covers the passive governor, the single transition on resume, failing
suspend and resume, and a resume without a suspend.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

[1] https://lore.kernel.org/r/20261110-panthor-suspend-clk-v1-1-53457050e51e@gmail.com
[2] https://lore.kernel.org/r/20261110-devfreq-resume-freq-v1-1-90de450ccbd0@gmail.com
[3] https://lore.kernel.org/r/20261112-panthor-suspend-clk-v2-1-62e1b168052d@gmail.com

---
Changes in v3:
- Run the pending update instead of restoring first, so resume makes
  one transition; the userspace governor without set_freq keeps the
  frequency from before suspend (Sashiko)
- Keep the passive governor out of the pending update, which evaluated
  it with freq 0 (Sashiko)
- Leave devfreq suspended when suspend or resume fails, instead of the
  v2 undo: callers may power the device down regardless. A caller that
  ignores a failed resume recovers on its next suspend and resume (Sashiko)
- Add [2] as 1/2: commit message corrected (lima on RK3528 is the
  mainline case, not panthor), comment shortened
- Rebase on devfreq-next
- Link to v2: https://patch.msgid.link/20261114-devfreq-suspend-sync-v2-1-10f0c3e14245@gmail.com

Changes in v2:
- Keep only the suspend count, now a plain int changed under
  devfreq->lock, instead of a separate suspended flag that could
  disagree with it when suspend and resume race (Sashiko)
- Resume at the resume frequency clamped to the current limits, then
  run the deferred update: the userspace governor without set_freq
  stayed at the suspend frequency (Sashiko)
- Don't defer the passive governor's parent updates: exynos-bus
  children must follow their parent to its suspend frequency, also at
  shutdown (Sashiko)
- Drop pending_freq: the deferred update runs like any update_devfreq()
  call. If it fails, resume logs the error and still sends
  DEVFREQ_GOV_RESUME (Sashiko)
- Undo a failed devfreq_suspend_device(), as rk3399_dmc and lima abort
  without resuming; an unbalanced devfreq_resume_device() is a no-op
  (Sashiko)
- Leave polling governors to their next poll after resume; the driver
  has just reset their load data (Sashiko)
- Link to v1: https://patch.msgid.link/20261112-devfreq-suspend-sync-v1-1-af64603ef43e@gmail.com

---
Arun Iyengar (2):
      PM / devfreq: Resume at the frequency from before suspend
      PM / devfreq: Do not change the frequency of a suspended device

 drivers/devfreq/devfreq.c            | 86 +++++++++++++++++++++++++++++-------
 drivers/devfreq/governor_userspace.c |  3 +-
 include/linux/devfreq.h              | 10 ++++-
 3 files changed, 79 insertions(+), 20 deletions(-)
---
base-commit: f9316c13d6f621af4f6f4a6089d3c989ffe899e6
change-id: 20261112-devfreq-suspend-sync-7ca8fc51550a

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



             reply	other threads:[~2026-11-19 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:16 Arun Iyengar via B4 Relay [this message]
2026-11-19 21:16 ` [PATCH v3 1/2] PM / devfreq: Resume at the frequency from before suspend Arun Iyengar via B4 Relay
2026-11-19 21:16 ` [PATCH v3 2/2] PM / devfreq: Do not change the frequency of a suspended device Arun Iyengar via B4 Relay

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=20261119-devfreq-suspend-sync-v3-0-ef19fbf94d83@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=aisheng.dong@nxp.com \
    --cc=aiyengar1990@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=cw00.choi@samsung.com \
    --cc=jonas@kwiboo.se \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=steven.price@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

all inboxes | Powered by JetHome®