* [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added
@ 2026-01-09 20:51 Bart Van Assche
2026-01-09 20:51 ` [PATCH v2 1/2] ufs: core: Only call " Bart Van Assche
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Bart Van Assche @ 2026-01-09 20:51 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, John Garry, Bart Van Assche
Hi Martin,
The UFS driver is the only SCSI driver I know of that may call
scsi_host_busy() before the SCSI host has been added. This patch series
modifies the UFS driver such that scsi_host_busy() is only called after the
SCSI host has been added. Additionally, commit a0b7780602b1 ("scsi: core:
Fix a regression triggered by scsi_host_busy()") is reverted because all
scsi_host_busy() calls now happen after the corresponding SCSI host has
been added.
Please consider this patch series for the next merge window.
Thanks,
Bart.
Changes compared to v1:
- Removed the WARN_ON_ONCE(!shost->tag_set.ops); statement from patch 2/2.
Bart Van Assche (2):
ufs: core: Only call scsi_host_busy() after the SCSI host has been
added
scsi: core: Revert "Fix a regression triggered by scsi_host_busy()"
drivers/scsi/hosts.c | 5 ++---
drivers/ufs/core/ufshcd.c | 6 ++++--
2 files changed, 6 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v2 1/2] ufs: core: Only call scsi_host_busy() after the SCSI host has been added 2026-01-09 20:51 [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Bart Van Assche @ 2026-01-09 20:51 ` Bart Van Assche 2026-01-13 7:25 ` Peter Wang (王信友) 2026-01-09 20:51 ` [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" Bart Van Assche ` (2 subsequent siblings) 3 siblings, 1 reply; 7+ messages in thread From: Bart Van Assche @ 2026-01-09 20:51 UTC (permalink / raw) To: Martin K . Petersen Cc: linux-scsi, John Garry, Bart Van Assche, James E.J. Bottomley, Peter Wang, Avri Altman, Bean Huo, Adrian Hunter, Bao D. Nguyen scsi_host_busy() iterates over the host tag set. The host tag set is initialized by scsi_mq_setup_tags(). The latter function is called by scsi_add_host(). Hence only call scsi_host_busy() after the SCSI host has been added. This patch prepares for reverting commit a0b7780602b1 ("scsi: core: Fix a regression triggered by scsi_host_busy()"). Reviewed-by: John Garry <john.g.garry@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/ufs/core/ufshcd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 562d8cffc6f6..69630677b23f 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -283,7 +283,8 @@ static bool ufshcd_has_pending_tasks(struct ufs_hba *hba) static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba) { - return scsi_host_busy(hba->host) || ufshcd_has_pending_tasks(hba); + return (hba->scsi_host_added && scsi_host_busy(hba->host)) || + ufshcd_has_pending_tasks(hba); } static const struct ufs_dev_quirk ufs_fixups[] = { @@ -678,7 +679,8 @@ static void ufshcd_print_host_state(struct ufs_hba *hba) dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); dev_err(hba->dev, "%d outstanding reqs, tasks=0x%lx\n", - scsi_host_busy(hba->host), hba->outstanding_tasks); + hba->scsi_host_added ? scsi_host_busy(hba->host) : 0, + hba->outstanding_tasks); dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", hba->saved_err, hba->saved_uic_err); dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] ufs: core: Only call scsi_host_busy() after the SCSI host has been added 2026-01-09 20:51 ` [PATCH v2 1/2] ufs: core: Only call " Bart Van Assche @ 2026-01-13 7:25 ` Peter Wang (王信友) 0 siblings, 0 replies; 7+ messages in thread From: Peter Wang (王信友) @ 2026-01-13 7:25 UTC (permalink / raw) To: bvanassche@acm.org, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, john.g.garry@oracle.com, avri.altman@sandisk.com, James.Bottomley@HansenPartnership.com, adrian.hunter@intel.com, beanhuo@micron.com, quic_nguyenb@quicinc.com On Fri, 2026-01-09 at 12:51 -0800, Bart Van Assche wrote: > scsi_host_busy() iterates over the host tag set. The host tag set is > initialized by scsi_mq_setup_tags(). The latter function is called by > scsi_add_host(). Hence only call scsi_host_busy() after the SCSI host > has been added. This patch prepares for reverting commit a0b7780602b1 > ("scsi: core: Fix a regression triggered by scsi_host_busy()"). > > Reviewed-by: John Garry <john.g.garry@oracle.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/ufs/core/ufshcd.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 562d8cffc6f6..69630677b23f 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -283,7 +283,8 @@ static bool ufshcd_has_pending_tasks(struct > ufs_hba *hba) > > static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba) > { > - return scsi_host_busy(hba->host) || > ufshcd_has_pending_tasks(hba); > + return (hba->scsi_host_added && scsi_host_busy(hba->host)) || > + ufshcd_has_pending_tasks(hba); > } > > static const struct ufs_dev_quirk ufs_fixups[] = { > @@ -678,7 +679,8 @@ static void ufshcd_print_host_state(struct > ufs_hba *hba) > > dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); > dev_err(hba->dev, "%d outstanding reqs, tasks=0x%lx\n", > - scsi_host_busy(hba->host), hba->outstanding_tasks); > + hba->scsi_host_added ? scsi_host_busy(hba->host) : 0, > + hba->outstanding_tasks); > dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", > hba->saved_err, hba->saved_uic_err); > dev_err(hba->dev, "Device power mode=%d, UIC link > state=%d\n", Reviewed-by: Peter Wang <peter.wang@mediatek.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" 2026-01-09 20:51 [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Bart Van Assche 2026-01-09 20:51 ` [PATCH v2 1/2] ufs: core: Only call " Bart Van Assche @ 2026-01-09 20:51 ` Bart Van Assche 2026-01-10 8:01 ` John Garry 2026-01-12 3:08 ` [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Martin K. Petersen 2026-01-17 4:36 ` Martin K. Petersen 3 siblings, 1 reply; 7+ messages in thread From: Bart Van Assche @ 2026-01-09 20:51 UTC (permalink / raw) To: Martin K . Petersen Cc: linux-scsi, John Garry, Bart Van Assche, James E.J. Bottomley Revert commit a0b7780602b1 ("scsi: core: Fix a regression triggered by scsi_host_busy()") because all scsi_host_busy() calls now happen after the corresponding SCSI host has been added. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/hosts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 196479cbfe6e..4d17f242d191 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -626,9 +626,8 @@ int scsi_host_busy(struct Scsi_Host *shost) { int cnt = 0; - if (shost->tag_set.ops) - blk_mq_tagset_busy_iter(&shost->tag_set, - scsi_host_check_in_flight, &cnt); + blk_mq_tagset_busy_iter(&shost->tag_set, + scsi_host_check_in_flight, &cnt); return cnt; } EXPORT_SYMBOL(scsi_host_busy); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" 2026-01-09 20:51 ` [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" Bart Van Assche @ 2026-01-10 8:01 ` John Garry 0 siblings, 0 replies; 7+ messages in thread From: John Garry @ 2026-01-10 8:01 UTC (permalink / raw) To: Bart Van Assche, Martin K . Petersen; +Cc: linux-scsi, James E.J. Bottomley On 09/01/2026 20:51, Bart Van Assche wrote: > Revert commit a0b7780602b1 ("scsi: core: Fix a regression triggered by > scsi_host_busy()") because all scsi_host_busy() calls now happen after > the corresponding SCSI host has been added. > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> thanks Reviewed-by: John Garry <john.g.garry@oracle.com> > --- > drivers/scsi/hosts.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c > index 196479cbfe6e..4d17f242d191 100644 > --- a/drivers/scsi/hosts.c > +++ b/drivers/scsi/hosts.c > @@ -626,9 +626,8 @@ int scsi_host_busy(struct Scsi_Host *shost) > { > int cnt = 0; > > - if (shost->tag_set.ops) > - blk_mq_tagset_busy_iter(&shost->tag_set, > - scsi_host_check_in_flight, &cnt); > + blk_mq_tagset_busy_iter(&shost->tag_set, > + scsi_host_check_in_flight, &cnt); > return cnt; > } > EXPORT_SYMBOL(scsi_host_busy); > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added 2026-01-09 20:51 [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Bart Van Assche 2026-01-09 20:51 ` [PATCH v2 1/2] ufs: core: Only call " Bart Van Assche 2026-01-09 20:51 ` [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" Bart Van Assche @ 2026-01-12 3:08 ` Martin K. Petersen 2026-01-17 4:36 ` Martin K. Petersen 3 siblings, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2026-01-12 3:08 UTC (permalink / raw) To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi, John Garry Bart, > The UFS driver is the only SCSI driver I know of that may call > scsi_host_busy() before the SCSI host has been added. This patch > series modifies the UFS driver such that scsi_host_busy() is only > called after the SCSI host has been added. Additionally, commit > a0b7780602b1 ("scsi: core: Fix a regression triggered by > scsi_host_busy()") is reverted because all scsi_host_busy() calls now > happen after the corresponding SCSI host has been added. Applied to 6.20/scsi-staging, thanks! -- Martin K. Petersen ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added 2026-01-09 20:51 [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Bart Van Assche ` (2 preceding siblings ...) 2026-01-12 3:08 ` [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Martin K. Petersen @ 2026-01-17 4:36 ` Martin K. Petersen 3 siblings, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2026-01-17 4:36 UTC (permalink / raw) To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi, John Garry On Fri, 09 Jan 2026 12:51:00 -0800, Bart Van Assche wrote: > The UFS driver is the only SCSI driver I know of that may call > scsi_host_busy() before the SCSI host has been added. This patch series > modifies the UFS driver such that scsi_host_busy() is only called after the > SCSI host has been added. Additionally, commit a0b7780602b1 ("scsi: core: > Fix a regression triggered by scsi_host_busy()") is reverted because all > scsi_host_busy() calls now happen after the corresponding SCSI host has > been added. > > [...] Applied to 6.20/scsi-queue, thanks! [1/2] ufs: core: Only call scsi_host_busy() after the SCSI host has been added https://git.kernel.org/mkp/scsi/c/202d5dadd3a0 [2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" https://git.kernel.org/mkp/scsi/c/e60b57972099 -- Martin K. Petersen ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-17 4:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-09 20:51 [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Bart Van Assche 2026-01-09 20:51 ` [PATCH v2 1/2] ufs: core: Only call " Bart Van Assche 2026-01-13 7:25 ` Peter Wang (王信友) 2026-01-09 20:51 ` [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()" Bart Van Assche 2026-01-10 8:01 ` John Garry 2026-01-12 3:08 ` [PATCH v2 0/2] Call scsi_host_busy() after the SCSI host has been added Martin K. Petersen 2026-01-17 4:36 ` Martin K. Petersen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox