Linux Power Management development
 help / color / mirror / Atom feed
From: "Liao, Bard" <yung-chuan.liao@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Vinod Koul <vkoul@kernel.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Sanyog Kale <sanyog.r.kale@intel.com>,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH v2] soundwire: intel_auxdevice: Fix system suspend/resume handling
Date: Wed, 30 Apr 2025 08:59:27 +0800	[thread overview]
Message-ID: <d4cafb3f-2045-40c1-a8fd-58dd46485232@linux.intel.com> (raw)
In-Reply-To: <12680420.O9o76ZdvQC@rjwysocki.net>



On 4/29/2025 3:50 AM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Before commit bca84a7b93fd ("PM: sleep: Use DPM_FLAG_SMART_SUSPEND
> conditionally") the runtime PM status of the device in intel_resume()
> had always been RPM_ACTIVE because setting DPM_FLAG_SMART_SUSPEND had
> caused the core to call pm_runtime_set_active() for that device during
> the "noirq" resume phase.  For this reason, the pm_runtime_suspended()
> check in intel_resume() had never triggered and the code depending on
> it had never run.  That had not caused any observable functional issues
> to appear, so effectively the code in question had never been needed.
> 
> After commit bca84a7b93fd the core does not call pm_runtime_set_active()
> for all devices with DPM_FLAG_SMART_SUSPEND set any more and the code
> depending on the pm_runtime_suspended() check in intel_resume() runs if
> the device is runtime-suspended prior to a system-wide suspend
> transition.  Unfortunately, when it runs, it breaks things due to the
> attempt to runtime-resume bus->dev which most likely is not ready for a
> runtime resume at that point.
> 
> It also does other more-or-less questionable things.  Namely, it
> calls pm_runtime_idle() for a device with a nonzero runtime PM usage
> counter which has no effect (all devices have nonzero runtime PM
> usage counters during system-wide suspend and resume).  It also calls
> pm_runtime_mark_last_busy() for the device even though devices cannot
> runtime-suspend during system-wide suspend and resume (because their
> runtime PM usage counters are nonzero) and an analogous call is made
> in the same function later.  Moreover, it sets the runtime PM status
> of the device to RPM_ACTIVE before activating it.
> 
> For the reasons listed above, remove that code altogether.
> 
> On top of that, add a pm_runtime_disable() call to intel_suspend() to
> prevent the device from being runtime-resumed at any point after
> intel_suspend() has started to manipulate it because the changes
> made by that function would be undone by a runtime-suspend of the
> device.
> 
> Next, once runtime PM has been disabled, the runtime PM status of the
> device cannot change, so pm_runtime_status_suspended() can be used
> instead of pm_runtime_suspended() in intel_suspend().
> 
> Finally, make intel_resume() call pm_runtime_set_active() at the end to
> set the runtime PM status of the device to "active" because it has just
> been activated and re-enable runtime PM for it after that.
> 
> Additionally, drop the setting of DPM_FLAG_SMART_SUSPEND from the
> driver because it has no effect on devices handled by it.
> 
> Fixes: bca84a7b93fd ("PM: sleep: Use DPM_FLAG_SMART_SUSPEND conditionally")
> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Tested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> v1 -> v2: New changelog
> 
> Since it fixes a recent regression in 6.15-rc, I can route it through the
> PM tree unless that would be a major concern.
> 

 Acked-by: Bard Liao <yung-chuan.liao@linux.intel.com>

  reply	other threads:[~2025-04-30  0:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 19:50 [PATCH v2] soundwire: intel_auxdevice: Fix system suspend/resume handling Rafael J. Wysocki
2025-04-30  0:59 ` Liao, Bard [this message]
2025-04-30 14:24   ` 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=d4cafb3f-2045-40c1-a8fd-58dd46485232@linux.intel.com \
    --to=yung-chuan.liao@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=rjw@rjwysocki.net \
    --cc=sanyog.r.kale@intel.com \
    --cc=vkoul@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