Linux-SCSI Archive on
 help / color / Atom feed
From: Avri Altman <>
To: "James E . J . Bottomley" <>,
	"Martin K . Petersen" <>,
	Pedro Sousa <>,
	Alim Akhtar <>,
Cc: Avi Shchislowski <>,
	Alex Lemberg <>,
	Avri Altman <>
Subject: [PATCH] scsi: ufs-bsg: Wake the device before sending raw upiu commands
Date: Thu, 10 Oct 2019 11:31:07 +0300
Message-ID: <> (raw)

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 <>
Reported-by:  Yuliy Izrailov <>
 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) {
@@ -135,6 +137,8 @@ static int ufs_bsg_request(struct bsg_job *job)
+	pm_runtime_put_sync(hba->dev);
 	if (!desc_buff)
 		goto out;

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  8:31 Avri Altman [this message]
2019-10-18 22:04 ` Martin K. Petersen

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-SCSI Archive on

Archives are clonable:
	git clone --mirror linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ \
	public-inbox-index linux-scsi

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone