Skip to contentSkip to conversation

scsi: ufs: use existed well-defined functions

PATCH Applied Stanley Chu 5 participants 11 messages Dec 24, 2019 – Jan 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover scsi: ufs: use existed well-defined functions

Hi,

This patchset fixes two small place to use existed well-defined functions to replace legacy statements.

Stanley Chu (2):
scsi: ufs: unify scsi_block_requests usage
scsi: ufs: use ufshcd_vops_dbg_register_dump for vendor specific
dumps

 drivers/scsi/ufs/ufshcd.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 scsi: ufs: unify scsi_block_requests usage

Currently UFS driver has ufshcd_scsi_block_requests() with reference counter mechanism to avoid possible racing of blocking and unblocking requests flow. Unify all users in UFS driver to use the same function.

---
 drivers/scsi/ufs/ufshcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +2 -2
index ed02a70..b6b9665 100644
@@ -5177,7 +5177,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
 	hba = container_of(work, struct ufs_hba, eeh_work);
 
 	pm_runtime_get_sync(hba->dev);
-	scsi_block_requests(hba->host);
+	ufshcd_scsi_block_requests(hba);
 	err = ufshcd_get_ee_status(hba, &status);
 	if (err) {
 		dev_err(hba->dev, "%s: failed to get exception status %d\n",
@@ -5191,7 +5191,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
 		ufshcd_bkops_exception_event_handler(hba);
 
 out:
-	scsi_unblock_requests(hba->host);
+	ufshcd_scsi_unblock_requests(hba);
 	pm_runtime_put_sync(hba->dev);
 	return;
 }
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 2/2 scsi: ufs: use ufshcd_vops_dbg_register_dump for vendor specific dumps

In reply to Stanley Chu

We already have ufshcd_vops_dbg_register_dump() thus all "hba->vops->dbg_register_dump" references can be replaced by it.

---
 drivers/scsi/ufs/ufshcd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -2
index b6b9665..1ac9272 100644
@@ -428,8 +428,7 @@ static void ufshcd_print_host_regs(struct ufs_hba *hba)
 
 	ufshcd_print_clk_freqs(hba);
 
-	if (hba->vops && hba->vops->dbg_register_dump)
-		hba->vops->dbg_register_dump(hba);
+	ufshcd_vops_dbg_register_dump(hba);
 }
 
 static
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v1 1/2] scsi: ufs: unify scsi_block_requests usage

In reply to Stanley Chu
Quoted 24 lines · Stanley Chu

Currently UFS driver has ufshcd_scsi_block_requests() with reference counter mechanism to avoid possible racing of blocking and unblocking requests flow. Unify all users in UFS driver to use the same function.

---
 drivers/scsi/ufs/ufshcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -1
index ed02a70..b6b9665 100644
@@ -5177,7 +5177,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
 	hba = container_of(work, struct ufs_hba, eeh_work);
 
 	pm_runtime_get_sync(hba->dev);
-	scsi_block_requests(hba->host);
+	ufshcd_scsi_block_requests(hba);
 	err = ufshcd_get_ee_status(hba, &status);
 	if (err) {
 		dev_err(hba->dev, "%s: failed to get exception status %d\n",

drivers/scsi/ufs/ufshcd.c static void ufshcd_exception_event_handler(struct work_struct *work) · line 5197

Quoted 8 lines
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -5191,7 +5191,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work)
 		ufshcd_bkops_exception_event_handler(hba);
 
 out:
-	scsi_unblock_requests(hba->host);
+	ufshcd_scsi_unblock_requests(hba);
 	pm_runtime_put_sync(hba->dev);
 	return;
 }

Hi Stanley,

From the SCSI core:

void scsi_block_requests(struct Scsi_Host *shost)

{
	shost->host_self_blocked = 1;
}

In other words, neither scsi_block_requests() nor ufshcd_scsi_block_requests() wait for ongoing ufshcd_queuecommand() calls to finish. Is it required to wait for these calls to finish before exceptions are handled? If not, can the scsi_block_requests() and scsi_unblock_requests() calls be left out? If it is required to wait for ongoing ufshcd_queuecommand() calls to finish then I think the scsi_block_requests() and scsi_unblock_requests() will have to be changed into something else.

Thanks,

Bart.

Reviewed-by on v1 2/2
#7 lore raw

Re: [PATCH v1 2/2] scsi: ufs: use ufshcd_vops_dbg_register_dump for vendor specific dumps

In reply to Stanley Chu
Quoted 13 lines · Stanley Chu

We already have ufshcd_vops_dbg_register_dump() thus all "hba->vops->dbg_register_dump" references can be replaced by it.

---
 drivers/scsi/ufs/ufshcd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +0 -0
index b6b9665..1ac9272 100644

drivers/scsi/ufs/ufshcd.c static void ufshcd_print_host_regs(struct ufs_hba *hba) · line 432

Quoted 7 lines
drivers/scsi/ufs/ufshcd.c +1 -2
@@ -428,8 +428,7 @@ static void ufshcd_print_host_regs(struct ufs_hba *hba)
 
 	ufshcd_print_clk_freqs(hba);
 
-	if (hba->vops && hba->vops->dbg_register_dump)
-		hba->vops->dbg_register_dump(hba);
+	ufshcd_vops_dbg_register_dump(hba);
 }
#3 lore raw

Re: [PATCH v1 1/2] scsi: ufs: unify scsi_block_requests usage

In reply to Bart Van Assche

Hi Bart,

Quoted 9 lines

Hi Stanley,

From the SCSI core:

void scsi_block_requests(struct Scsi_Host *shost)

{
	shost->host_self_blocked = 1;
}
Quoted 8 lines

In other words, neither scsi_block_requests() nor ufshcd_scsi_block_requests() wait for ongoing ufshcd_queuecommand() calls to finish. Is it required to wait for these calls to finish before exceptions are handled? If not, can the scsi_block_requests() and scsi_unblock_requests() calls be left out? If it is required to wait for ongoing ufshcd_queuecommand() calls to finish then I think the scsi_block_requests() and scsi_unblock_requests() will have to be changed into something else.

ASFAIK, ufshcd_exception_event_handler() is not required to wait for ongoing ufshcd_queuecommand() calls to finish.

The scsi_block_requests() call here is trying to increase successful rate of requests sent by ufshcd_exception_event_handler() because timeout may happen if device is too busy to handle those requests. Blocking any future incoming requests can help.

As time goes by, actually current UFS driver allows more waiting time by below changes for ufshcd_exception_event_handler(), and thus the successful rate shall be raised much nowadays.

- Enlarge QUERY_REQ_TIMEOUT time from 100 ms to 1.5 seconds
- Allow retry if query requests are timed out

Therefore, the scsi_block_requests() call is actually a "helper" to help ufshcd_exception_event_handler() successful. I think it could be better kept to make UFS device recover its performance as soon as possible.

Quoted 4 lines

Thanks,

Bart.

Thanks,
Stanley

Reviewed-by on v1 2/2
#8 lore raw

Re: [PATCH v1 2/2] scsi: ufs: use ufshcd_vops_dbg_register_dump for vendor specific dumps

In reply to Stanley Chu
Quoted 22 lines · Stanley Chu

We already have ufshcd_vops_dbg_register_dump() thus all "hba->vops->dbg_register_dump" references can be replaced by it.

---
 drivers/scsi/ufs/ufshcd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -2
index b6b9665..1ac9272 100644
@@ -428,8 +428,7 @@ static void ufshcd_print_host_regs(struct ufs_hba 
 *hba)
 
 	ufshcd_print_clk_freqs(hba);
 
-	if (hba->vops && hba->vops->dbg_register_dump)
-		hba->vops->dbg_register_dump(hba);
+	ufshcd_vops_dbg_register_dump(hba);
 }
 
Quoted 1 line

static

Reviewed-by on v1 1/2
#4 lore raw

Re: [PATCH v1 1/2] scsi: ufs: unify scsi_block_requests usage

In reply to Stanley Chu
Quoted 33 lines · Stanley Chu

Currently UFS driver has ufshcd_scsi_block_requests() with reference counter mechanism to avoid possible racing of blocking and unblocking requests flow. Unify all users in UFS driver to use the same function.

---
 drivers/scsi/ufs/ufshcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -1
index ed02a70..b6b9665 100644
@@ -5177,7 +5177,7 @@ static void
 ufshcd_exception_event_handler(struct work_struct *work)
 	hba = container_of(work, struct ufs_hba, eeh_work);
 
 	pm_runtime_get_sync(hba->dev);
-	scsi_block_requests(hba->host);
+	ufshcd_scsi_block_requests(hba);
 	err = ufshcd_get_ee_status(hba, &status);
 	if (err) {
drivers/scsi/ufs/ufshcd.c +1 -1
 		dev_err(hba->dev, "%s: failed to get exception status %d\n",
@@ -5191,7 +5191,7 @@ static void
 ufshcd_exception_event_handler(struct work_struct *work)
 		ufshcd_bkops_exception_event_handler(hba);
 
 out:
-	scsi_unblock_requests(hba->host);
+	ufshcd_scsi_unblock_requests(hba);
 	pm_runtime_put_sync(hba->dev);
 	return;
Quoted 1 line

}

Reviewed-by on v1 1/2
#5 lore raw

Re: [PATCH v1 1/2] scsi: ufs: unify scsi_block_requests usage

In reply to Stanley Chu
Quoted 4 lines · Stanley Chu

Currently UFS driver has ufshcd_scsi_block_requests() with reference counter mechanism to avoid possible racing of blocking and unblocking requests flow. Unify all users in UFS driver to use the same function.

Reviewed-by on the v1 series
#9 lore raw
In reply to Stanley Chu

Hi Stanley

Quoted 10 lines · Stanley Chu

Hi,

This patchset fixes two small place to use existed well-defined functions to replace legacy statements.

Stanley Chu (2):
scsi: ufs: unify scsi_block_requests usage
scsi: ufs: use ufshcd_vops_dbg_register_dump for vendor specific
dumps

Quoted 4 lines
 drivers/scsi/ufs/ufshcd.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--

For this series,

Quoted 1 line

1.7.9.5

Signature · 2 lines
Regards,
Alim
#10 lore raw
In reply to Stanley Chu

Stanley,

Quoted 2 lines

This patchset fixes two small place to use existed well-defined functions to replace legacy statements.

Applied to 5.6/scsi-queue, thanks!

Signature · 6 lines
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek