mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Wang <peter.wang@mediatek.com>
To: Stanley Jhu <stanleyjhu@google.com>,
	"Martin K . Petersen" <mkp@kernel.org>,
	"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Bean Huo <beanhuo@micron.com>
Cc: Can Guo <can.guo@oss.qualcomm.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 0/5] scsi: ufs: Fix device management timeouts and runtime PM errors
Date: Fri, 30 Oct 2026 14:32:38 +0800	[thread overview]
Message-ID: <53fe962918514149044cd919786ff12d56b8d33d.camel@mediatek.com> (raw)
In-Reply-To: <20261029040003.2100003-1-stanleyjhu@google.com>

On Thu, 2026-10-29 at 15:08 +0800, Stanley Jhu wrote:
> This series fixes two problems in UFS core entry points that issue
> device management commands or touch host registers.
> 
> Patch 1/5 restores the millisecond to jiffies conversion of device
> management command timeouts. Since the timeout moved to rq->timeout,
> a 1500 ms query timeout waits 6 s with CONFIG_HZ=250.
> 
> Patches 2/5 to 5/5 handle runtime PM resume errors. Several UFS core,
> sysfs, BSG, hwmon, and debugfs entry points call
> ufshcd_rpm_get_sync()
> before accessing host registers or issuing device management and UIC
> commands, but ignore its return value.
> 
> ufshcd_rpm_get_sync() wraps pm_runtime_get_sync() on the UFS device
> W-LUN and returns a negative errno when runtime resume of the W-LUN
> or
> host controller fails, leaving the device or controller in
> RPM_SUSPENDED.
> 
> Continuing after such a failure can access host registers or issue
> commands while the device or controller is not known to be active,
> while checking pm_runtime_get_sync() directly would leave
> power.usage_count elevated unless balanced with
> pm_runtime_put_noidle().
> 
> Add ufshcd_rpm_resume_and_get() around pm_runtime_resume_and_get()
> and
> convert the 20 external and helper call sites to abort and propagate
> the
> error when resuming the W-LUN fails. The three lifecycle call sites
> in
> ufshcd_rpm_dev_flush_recheck_work(), ufshcd_wl_shutdown(), and
> ufshcd_remove(), plus ufshcd_err_handling_prepare(), are
> intentionally
> left unchanged.
> 
> Tested on QEMU ARM64 UFS (SDB and MCQ) with W-LUN runtime resume and
> suspend failures via sysfs offline (no behavior change on suspend
> failure) and GDB power.disable_depth=1 to make ufshcd_rpm_get_sync()
> fail, and on SDB with a timed out query request.
> 
> Changes since v1:
> - Drop the incorrect claim that a failed W-LUN runtime suspend
>   latches power.runtime_error from the cover letter and commit
>   messages. The PM core latches a runtime suspend error only if it
>   is neither -EBUSY nor -EAGAIN, and in-tree UFS drivers fail W-LUN
>   runtime suspend only with -EBUSY or -EAGAIN (Bart).
> - Say in the cover letter how the series was tested.
> - Describe each failing sequence in patches 2-5 step by step in
>   time order, and drop the runtime PM disabled (-EACCES) scenario.
> 
> Link:
> https://lore.kernel.org/linux-scsi/20261025013446.345974-1-stanleyjhu@google.com/
>  
> 
> Stanley Jhu (5):
>   scsi: ufs: core: Restore jiffies conversion of device management
>     timeouts
>   scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper
>   scsi: ufs: sysfs: Propagate runtime PM resume errors
>   scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails
>   scsi: ufs: hwmon, debugfs: Propagate runtime PM resume errors
> 
>  drivers/ufs/core/ufs-debugfs.c |  8 +++-
>  drivers/ufs/core/ufs-hwmon.c   | 12 +++++-
>  drivers/ufs/core/ufs-sysfs.c   | 67 +++++++++++++++++++++++++++-----
> --
>  drivers/ufs/core/ufs_bsg.c     |  4 +-
>  drivers/ufs/core/ufshcd-priv.h |  5 +++
>  drivers/ufs/core/ufshcd.c      |  9 +++--
>  6 files changed, 84 insertions(+), 21 deletions(-)
> 
> 
> base-commit: 503e6172fa74da6b4944ece458f5534681e51d21

For the series:
Reviewed-by: Peter Wang <peter.wang@mediatek.com>


      parent reply	other threads:[~2026-10-30  6:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  7:08 Stanley Jhu
2026-10-29  7:08 ` [PATCH v2 1/5] scsi: ufs: core: Restore jiffies conversion of device management timeouts Stanley Jhu
2026-10-29  7:08 ` [PATCH v2 2/5] scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper Stanley Jhu
2026-10-29  7:08 ` [PATCH v2 3/5] scsi: ufs: sysfs: Propagate runtime PM resume errors Stanley Jhu
2026-10-29  7:08 ` [PATCH v2 4/5] scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails Stanley Jhu
2026-10-29  7:08 ` [PATCH v2 5/5] scsi: ufs: hwmon, debugfs: Propagate runtime PM resume errors Stanley Jhu
2026-10-29 16:07 ` [PATCH v2 0/5] scsi: ufs: Fix device management timeouts and runtime PM errors Bart Van Assche
2026-10-30  6:32 ` Peter Wang [this message]

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=53fe962918514149044cd919786ff12d56b8d33d.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=can.guo@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=stanleyjhu@google.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®