Call scsi_host_busy() after the SCSI host has been added
Subsystems (2)
Bart Van Assche
reviewerv2 cover Call scsi_host_busy() after the SCSI host has been added
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(-)
Bart Van Assche
reviewerPATCH v2 1/2 ufs: core: Only call scsi_host_busy() after the SCSI host has been added
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()").
--- drivers/ufs/core/ufshcd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ufs/core/ufshcd.c +4 -2
@@ -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",
Re: [PATCH v2 1/2] ufs: core: Only call scsi_host_busy() after the SCSI host has been added
Quoted 38 lines · Bart Van Assche
scsi_host_busy()iterates over the host tag set. The host tag set is initialized byscsi_mq_setup_tags(). The latter function is called byscsi_add_host(). Hence only callscsi_host_busy()after the SCSI host has been added. This patch prepares for reverting commita0b7780602b1("scsi: core: Fix a regression triggered byscsi_host_busy()").Reviewed-by John Garry <[email protected]>Signed-off-by Bart Van Assche <[email protected]>---
drivers/ufs/core/ufshcd.c | 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)drivers/ufs/core/ufshcd.c +2
-1@@ -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_quirkufs_fixups[] = {drivers/ufs/core/ufshcd.c +2
-1@@ -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);
Quoted 2 lines
dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n",
Bart Van Assche
reviewerPATCH v2 2/2 scsi: core: Revert "Fix a regression triggered by scsi_host_busy()"
In reply to Bart Van AsscheRevert 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.
--- drivers/scsi/hosts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +2 -3
@@ -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);
Re: [PATCH v2 2/2] scsi: core: Revert "Fix a regression triggered by scsi_host_busy()"
Quoted 5 lines · Bart Van Assche
Revert commit
a0b7780602b1("scsi: core: Fix a regression triggered byscsi_host_busy()") because allscsi_host_busy()calls now happen after the corresponding SCSI host has been added.Signed-off-by Bart Van Assche <[email protected]>
thanks
Quoted 21 lines
--- drivers/scsi/hosts.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/scsi/hosts.c +2
-3@@ -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);
Martin K. Petersen
AppliedBart,
Quoted 7 lines
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 thatscsi_host_busy()is only called after the SCSI host has been added. Additionally, commita0b7780602b1("scsi: core: Fix a regression triggered byscsi_host_busy()") is reverted because allscsi_host_busy()calls now happen after the corresponding SCSI host has been added.
Applied to 6.20/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 9 lines · Bart Van Assche
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 thatscsi_host_busy()is only called after the SCSI host has been added. Additionally, commita0b7780602b1("scsi: core:
Fix a regression triggered byscsi_host_busy()") is reverted because allscsi_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
Signature · 1 line
Martin K. Petersen