mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Wang <peter.wang@mediatek.com>
To: Bart Van Assche <bvanassche@acm.org>,
	hoyoung seo <hy50.seo@samsung.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <mkp@kernel.org>,
	<martin.petersen@oracle.com>, <stanleyjhu@google.com>,
	<alim.akhtar@samsung.com>, <kwangwon.min@samsung.com>,
	<kwmad.kim@samsung.com>, <cpgs@samsung.com>,
	<h10.kim@samsung.com>
Subject: Re: [PATCH v6 2/3] scsi: ufs: core: Limit early link recovery in the error handler to runtime PM
Date: Mon, 9 Nov 2026 17:29:36 +0800	[thread overview]
Message-ID: <4bbfec04002d51bb8364abcad78bb139b2a964c0.camel@mediatek.com> (raw)
In-Reply-To: <762e1686-eacf-46a5-a8fd-62acba002fdc@acm.org>

On Fri, 2026-11-06 at 11:15 -0800, Bart Van Assche wrote:
> Hi Peter,
> 
> I don't think that's guaranteed. ufshcd_err_handler() tests
> hba->pm_op_in_progress only once, when it starts, and without holding
> any lock. An error handler that started before that flag was set
> skips
> the early path. For runtime PM it then blocks in
> ufshcd_rpm_get_sync()
> in ufshcd_err_handling_prepare(), waiting for the runtime resume that
> is in progress. If __ufshcd_wl_resume() waits for that error handler
> with flush_work(), neither can proceed. This is the deadlock that
> commit 35dabf4503b9 addressed and that the comment in
> ufshcd_eh_timed_out() describes.

Hi Bart, 

Agreed, there is still a race window. But in practice, the
issue happens when wl suspend/resume sends a command.
But we cannot guarantee that there are no issues with 
power/clock on/off.

> 
> System PM has a similar problem. __ufshcd_wl_suspend() clears
> hba->pm_op_in_progress before it returns, but host_sem stays held
> until ufshcd_wl_resume() returns. An error handler that runs between
> system suspend and system resume therefore takes the regular path and
> blocks in down(&hba->host_sem). A flush_work() call from
> __ufshcd_wl_resume() would then never return.
> 

Yes, unless we refine the system PM flow.

> Additionally, ufshcd_schedule_eh_work() does not queue the error
> handler if the HBA state is UFSHCD_STATE_ERROR. In that case
> queue_work() + flush_work() would not perform any recovery, and
> __ufshcd_wl_resume() would have no way to find out whether recovery
> succeeded.
> 

Agreed, it looks like there are still more scenarios to
consider. And it is also complex too.

> Yes. The cover letter mentions this. That issue predates this series,
> and I think it should be addressed separately instead of holding up
> these fixes.
> 
> Hence, I prefer the approach of v7 of this series.
> 

Sorry, I missed the cover letter. Thanks for the reminder.
Let’s move this patch series forward.

Thanks
Peter

  reply	other threads:[~2026-11-09  9:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261106022018epcas2p44e9634ca254c1a5d4c1ecb64723512ef@epcas2p4.samsung.com>
2026-11-06  2:15 ` [PATCH v6 0/3] scsi: ufs: core: Avoid redundant link recovery from the error handler during PM HOYOUNG SEO
     [not found]   ` <CGME20261106022020epcas2p397f84c634df3397fcb1c98d1837bb83f@epcas2p3.samsung.com>
2026-11-06  2:15     ` [PATCH v6 1/3] scsi: ufs: core: Clear saved errors in ufshcd_link_recovery() HOYOUNG SEO
2026-11-06  4:46       ` Bart Van Assche
2026-11-06  7:08       ` Peter Wang
     [not found]   ` <CGME20261106022020epcas2p2af29bc4d81ede559c5a74076721aba7f@epcas2p2.samsung.com>
2026-11-06  2:15     ` [PATCH v6 2/3] scsi: ufs: core: Limit early link recovery in the error handler to runtime PM HOYOUNG SEO
2026-11-06  4:48       ` Bart Van Assche
2026-11-06  7:10       ` Peter Wang
2026-11-06  7:58         ` hoyoung seo
2026-11-06  9:44           ` Peter Wang
2026-11-06 19:15             ` Bart Van Assche
2026-11-09  9:29               ` Peter Wang [this message]
     [not found]   ` <CGME20261106022021epcas2p20d78ac51e55f03348d496f45e96031e1@epcas2p2.samsung.com>
2026-11-06  2:15     ` [PATCH v6 3/3] scsi: ufs: core: Set shutting_down in ufshcd_wl_poweroff() HOYOUNG SEO
2026-11-06  4:49       ` Bart Van Assche
2026-11-06  6:09         ` hoyoung seo

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=4bbfec04002d51bb8364abcad78bb139b2a964c0.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=alim.akhtar@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=cpgs@samsung.com \
    --cc=h10.kim@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=kwangwon.min@samsung.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --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®