mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Po-Wen Kao <powenkao@google.com>, linux-scsi@vger.kernel.org
Cc: Konstantin Vyshetsky <vkon@google.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Bean Huo <beanhuo@micron.com>,
	Stanley Jhu <stanleyjhu@google.com>,
	"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K . Petersen" <mkp@kernel.org>,
	Peter Wang <peter.wang@mediatek.com>,
	Can Guo <can.guo@oss.qualcomm.com>,
	linux-kernel@vger.kernel.org, Li Qiang <liqiang01@kylinos.cn>,
	John Garry <john.garry@linux.dev>,
	HOYOUNG SEO <hy50.seo@samsung.com>,
	Hyeoncheol Jeong <hyenc.jeong@samsung.com>
Subject: Re: [PATCH v2 1/2] scsi: ufs: core: Defer debugfs init until after device init
Date: Tue, 24 Nov 2026 10:45:22 -0800	[thread overview]
Message-ID: <919b8295-e5c5-40b1-93b9-21b8d7ed3b73@acm.org> (raw)
In-Reply-To: <20261124012951.3143833-2-powenkao@google.com>

On 11/23/26 5:29 PM, Po-Wen Kao wrote:
 >  void ufs_debugfs_hba_exit(struct ufs_hba *hba)
 >  {
 >  	debugfs_remove_recursive(hba->debugfs_root);
 > -	cancel_delayed_work_sync(&hba->debugfs_ee_work);
 > +	disable_delayed_work_sync(&hba->debugfs_ee_work);
 >  }

[ ... ]

 > @@ -11027,6 +11023,7 @@ void ufshcd_remove(struct ufs_hba *hba)
 >  	ufs_bsg_remove(hba);
 >  	ufs_rpmb_remove(hba);
 >  	ufs_sysfs_remove_nodes(hba->dev);
 > +	ufs_debugfs_hba_exit(hba);
 >  	cancel_delayed_work_sync(&hba->ufs_rtc_update_work);
 >  	blk_mq_destroy_queue(hba->tmf_queue);
 >  	blk_put_queue(hba->tmf_queue);

Moving ufs_debugfs_hba_exit() before scsi_remove_host() and switching
from cancel_delayed_work_sync() to disable_delayed_work_sync() fixes an
existing bug: without this change the debugfs attributes and
debugfs_ee_work may call ufshcd_rpm_get_sync() after the WLUN has been
removed. Please split that change into a separate patch with a Fixes:
tag such that it can be backported independently of the new debugfs
attributes.

 > @@ -11505,6 +11502,8 @@ int ufshcd_init(struct ufs_hba *hba, void 
__iomem *mmio_base, unsigned int irq)
 >  	ufs_sysfs_add_nodes(hba->dev);
 >  	hba->dme_qos_sysfs_handle = sysfs_get_dirent(hba->dev->kobj.sd,
 >  						     "dme_qos_notification");
 > +	ufs_debugfs_hba_init(hba);
 > +	ufs_fault_inject_hba_init(hba);
 >  	async_schedule(ufshcd_async_scan, hba);

With this change debugfs_ee_work is initialized after the UFS device
has been initialized and after exception events have been enabled. The
only reason why ufs_debugfs_exception_event() does not queue an
uninitialized delayed work if an exception event is reported before
ufs_debugfs_hba_init() has been called is that
hba->debugfs_ee_rate_limit_ms is still zero at that time. That's
fragile. Please move the INIT_DELAYED_WORK() call and the
debugfs_ee_rate_limit_ms initialization into ufshcd_init() such that
these happen before interrupts are enabled, or at least add a comment
that explains this dependency.

Additionally, hba->trigger_eh_attr and hba->timeout_attr are now
initialized later than before. I think that's fine because no SCSI
commands are queued before ufshcd_async_scan() is called, but please
mention this in the patch description.

Thanks,

Bart.

  parent reply	other threads:[~2026-11-24 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  1:29 [PATCH v2 0/2] scsi: ufs: core: Add debugfs for PA TFS/FEC error counters Po-Wen Kao
2026-11-24  1:29 ` [PATCH v2 1/2] scsi: ufs: core: Defer debugfs init until after device init Po-Wen Kao
2026-11-24  6:15   ` Peter Wang
2026-11-24 18:45   ` Bart Van Assche [this message]
2026-11-24  1:29 ` [PATCH v2 2/2] scsi: ufs: core: Add debugfs for PA TFS/FEC error counters Po-Wen Kao
2026-11-24  6:20   ` Peter Wang
2026-11-24 18:47   ` Bart Van Assche

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=919b8295-e5c5-40b1-93b9-21b8d7ed3b73@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=can.guo@oss.qualcomm.com \
    --cc=hy50.seo@samsung.com \
    --cc=hyenc.jeong@samsung.com \
    --cc=john.garry@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liqiang01@kylinos.cn \
    --cc=mkp@kernel.org \
    --cc=peter.wang@mediatek.com \
    --cc=powenkao@google.com \
    --cc=stanleyjhu@google.com \
    --cc=vkon@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®