linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs-bsg: Wake the device before sending raw upiu commands
@ 2019-10-10  8:31 Avri Altman
  2019-10-18 22:04 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Avri Altman @ 2019-10-10  8:31 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen, Pedro Sousa,
	Alim Akhtar, linux-scsi
  Cc: Avi Shchislowski, Alex Lemberg, Avri Altman

The scsi async probe process is calling blk_pm_runtime_init for each
lun, and then those request queues are monitored by the block layer pm
engine (blk-pm.c).  This is however, not the case for scsi-passthrough
queues, created by bsg_setup_queue().

So the ufs-bsg driver might send various commands, disregarding the pm
status of the device. This is wrong, regardless if its request queue is
pm-aware or not.

Fixes: df032bf27a41 (scsi: ufs: Add a bsg endpoint that supports UPIUs)

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Reported-by:  Yuliy Izrailov <yuliy.izrailov@wdc.com>
---
 drivers/scsi/ufs/ufs_bsg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c
index a9344eb..dc2f6d2 100644
--- a/drivers/scsi/ufs/ufs_bsg.c
+++ b/drivers/scsi/ufs/ufs_bsg.c
@@ -98,6 +98,8 @@ static int ufs_bsg_request(struct bsg_job *job)
 
 	bsg_reply->reply_payload_rcv_len = 0;
 
+	pm_runtime_get_sync(hba->dev);
+
 	msgcode = bsg_request->msgcode;
 	switch (msgcode) {
 	case UPIU_TRANSACTION_QUERY_REQ:
@@ -135,6 +137,8 @@ static int ufs_bsg_request(struct bsg_job *job)
 		break;
 	}
 
+	pm_runtime_put_sync(hba->dev);
+
 	if (!desc_buff)
 		goto out;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: ufs-bsg: Wake the device before sending raw upiu commands
  2019-10-10  8:31 [PATCH] scsi: ufs-bsg: Wake the device before sending raw upiu commands Avri Altman
@ 2019-10-18 22:04 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2019-10-18 22:04 UTC (permalink / raw)
  To: Avri Altman
  Cc: James E . J . Bottomley, Martin K . Petersen, Pedro Sousa,
	Alim Akhtar, linux-scsi, Avi Shchislowski, Alex Lemberg


Avri,

> The scsi async probe process is calling blk_pm_runtime_init for each
> lun, and then those request queues are monitored by the block layer pm
> engine (blk-pm.c).  This is however, not the case for scsi-passthrough
> queues, created by bsg_setup_queue().
>
> So the ufs-bsg driver might send various commands, disregarding the pm
> status of the device. This is wrong, regardless if its request queue
> is pm-aware or not.

Applied to 5.4/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-18 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10  8:31 [PATCH] scsi: ufs-bsg: Wake the device before sending raw upiu commands Avri Altman
2019-10-18 22:04 ` 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;
as well as URLs for NNTP newsgroup(s).