linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fix blk-mq for SPI hosts
@ 2014-10-19 15:13 Christoph Hellwig
  2014-10-19 15:13 ` [PATCH 1/2] Revert "block: all blk-mq requests are tagged" Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Christoph Hellwig @ 2014-10-19 15:13 UTC (permalink / raw)
  To: Jens Axboe, Meelis Roos; +Cc: David Miller, linux-scsi, linux-kernel

Fix the assumption that we can treat all blk-mq requests as tagged.  For
traditional SCSI that's wrong, as being tagged has a very explicit meaning
on the wire.

This is a little bit different from the version Meelis tested earlier, but
the concept is the same.  I didn't want to add a Tested-by tag as it's
different enough, though.


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

* [PATCH 1/2] Revert "block: all blk-mq requests are tagged"
  2014-10-19 15:13 fix blk-mq for SPI hosts Christoph Hellwig
@ 2014-10-19 15:13 ` Christoph Hellwig
  2014-10-28  0:23   ` Martin K. Petersen
  2014-10-19 15:13 ` [PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case Christoph Hellwig
  2014-10-23  8:45 ` fix blk-mq for SPI hosts Christoph Hellwig
  2 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2014-10-19 15:13 UTC (permalink / raw)
  To: Jens Axboe, Meelis Roos; +Cc: David Miller, linux-scsi, linux-kernel, stable

This reverts commit fb3ccb5da71273e7f0d50b50bc879e50cedd60e7.

SCSI-2/SPI actually needs the tagged/untagged flag in the request to
work properly.  Revert this patch and add a follow on to set it in
the right place.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
---
 include/linux/blkdev.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0207a78..51d0dc2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1136,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
 /*
  * tag stuff
  */
-#define blk_rq_tagged(rq) \
-	((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
+#define blk_rq_tagged(rq)		((rq)->cmd_flags & REQ_QUEUED)
 extern int blk_queue_start_tag(struct request_queue *, struct request *);
 extern struct request *blk_queue_find_tag(struct request_queue *, int);
 extern void blk_queue_end_tag(struct request_queue *, struct request *);
-- 
1.9.1


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

* [PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case
  2014-10-19 15:13 fix blk-mq for SPI hosts Christoph Hellwig
  2014-10-19 15:13 ` [PATCH 1/2] Revert "block: all blk-mq requests are tagged" Christoph Hellwig
@ 2014-10-19 15:13 ` Christoph Hellwig
  2014-10-28  0:24   ` Martin K. Petersen
  2014-10-23  8:45 ` fix blk-mq for SPI hosts Christoph Hellwig
  2 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2014-10-19 15:13 UTC (permalink / raw)
  To: Jens Axboe, Meelis Roos; +Cc: David Miller, linux-scsi, linux-kernel, stable

To generate the right SPI tag messages we need to properly set
QUEUE_FLAG_QUEUED in the request_queue and mirror it to the
request.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
---
 drivers/scsi/scsi_lib.c | 5 +++++
 include/scsi/scsi_tcq.h | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 9eff8a3..50a6e1a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1893,6 +1893,11 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req,
 		blk_mq_start_request(req);
 	}
 
+	if (blk_queue_tagged(q))
+		req->cmd_flags |= REQ_QUEUED;
+	else
+		req->cmd_flags &= ~REQ_QUEUED;
+
 	scsi_init_cmd_errh(cmd);
 	cmd->scsi_done = scsi_mq_done;
 
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index e645835..56ed843 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
 	if (!sdev->tagged_supported)
 		return;
 
-	if (!shost_use_blk_mq(sdev->host) &&
-	    !blk_queue_tagged(sdev->request_queue))
+	if (shost_use_blk_mq(sdev->host))
+		queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
+	else if (!blk_queue_tagged(sdev->request_queue))
 		blk_queue_init_tags(sdev->request_queue, depth,
 				    sdev->host->bqt);
 
@@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
  **/
 static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
 {
-	if (!shost_use_blk_mq(sdev->host) &&
-	    blk_queue_tagged(sdev->request_queue))
+	if (blk_queue_tagged(sdev->request_queue))
 		blk_queue_free_tags(sdev->request_queue);
 	scsi_adjust_queue_depth(sdev, 0, depth);
 }
-- 
1.9.1


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

* Re: fix blk-mq for SPI hosts
  2014-10-19 15:13 fix blk-mq for SPI hosts Christoph Hellwig
  2014-10-19 15:13 ` [PATCH 1/2] Revert "block: all blk-mq requests are tagged" Christoph Hellwig
  2014-10-19 15:13 ` [PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case Christoph Hellwig
@ 2014-10-23  8:45 ` Christoph Hellwig
  2014-10-23 10:49   ` Meelis Roos
  2 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2014-10-23  8:45 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Meelis Roos, David Miller, linux-scsi, linux-kernel

ping?

On Sun, Oct 19, 2014 at 05:13:56PM +0200, Christoph Hellwig wrote:
> Fix the assumption that we can treat all blk-mq requests as tagged.  For
> traditional SCSI that's wrong, as being tagged has a very explicit meaning
> on the wire.
> 
> This is a little bit different from the version Meelis tested earlier, but
> the concept is the same.  I didn't want to add a Tested-by tag as it's
> different enough, though.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

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

* Re: fix blk-mq for SPI hosts
  2014-10-23  8:45 ` fix blk-mq for SPI hosts Christoph Hellwig
@ 2014-10-23 10:49   ` Meelis Roos
  2014-10-23 17:14     ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Meelis Roos @ 2014-10-23 10:49 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Christoph Hellwig, Jens Axboe, David Miller, linux-scsi,
	Linux Kernel list

> ping?

Sorry, forgot to reply. Yes, it worked fine, on the initial Ultra 1 and 
additionally on Ultra 2 too.

> On Sun, Oct 19, 2014 at 05:13:56PM +0200, Christoph Hellwig wrote:
> > Fix the assumption that we can treat all blk-mq requests as tagged.  For
> > traditional SCSI that's wrong, as being tagged has a very explicit meaning
> > on the wire.
> > 
> > This is a little bit different from the version Meelis tested earlier, but
> > the concept is the same.  I didn't want to add a Tested-by tag as it's
> > different enough, though.
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> ---end quoted text---
> 

-- 
Meelis Roos (mroos@linux.ee)

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

* Re: fix blk-mq for SPI hosts
  2014-10-23 10:49   ` Meelis Roos
@ 2014-10-23 17:14     ` Christoph Hellwig
  2014-10-23 17:16       ` Jens Axboe
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2014-10-23 17:14 UTC (permalink / raw)
  To: Meelis Roos
  Cc: Christoph Hellwig, Christoph Hellwig, Jens Axboe, David Miller,
	linux-scsi, Linux Kernel list

On Thu, Oct 23, 2014 at 01:49:07PM +0300, Meelis Roos wrote:
> > ping?
> 
> Sorry, forgot to reply. Yes, it worked fine, on the initial Ultra 1 and 
> additionally on Ultra 2 too.

Thanks!

Can I get a review from Jens and some SCSI developers, too?

Jens, are you fine taking the blkdev.h revert through the SCSI tree?

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

* Re: fix blk-mq for SPI hosts
  2014-10-23 17:14     ` Christoph Hellwig
@ 2014-10-23 17:16       ` Jens Axboe
  0 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2014-10-23 17:16 UTC (permalink / raw)
  To: Christoph Hellwig, Meelis Roos
  Cc: Christoph Hellwig, David Miller, linux-scsi, Linux Kernel list

On 10/23/2014 11:14 AM, Christoph Hellwig wrote:
> On Thu, Oct 23, 2014 at 01:49:07PM +0300, Meelis Roos wrote:
>>> ping?
>>
>> Sorry, forgot to reply. Yes, it worked fine, on the initial Ultra 1 and 
>> additionally on Ultra 2 too.
> 
> Thanks!
> 
> Can I get a review from Jens and some SCSI developers, too?

Yes, I did read them, you can add my reviewed/acked.

> Jens, are you fine taking the blkdev.h revert through the SCSI tree?

Sure, that seems to be the easiest way to do it.

-- 
Jens Axboe


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

* Re: [PATCH 1/2] Revert "block: all blk-mq requests are tagged"
  2014-10-19 15:13 ` [PATCH 1/2] Revert "block: all blk-mq requests are tagged" Christoph Hellwig
@ 2014-10-28  0:23   ` Martin K. Petersen
  0 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2014-10-28  0:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Meelis Roos, David Miller, linux-scsi, linux-kernel, stable

>>>>> "Christoph" == Christoph Hellwig <hch@lst.de> writes:

Christoph> This reverts commit fb3ccb5da71273e7f0d50b50bc879e50cedd60e7.
Christoph> SCSI-2/SPI actually needs the tagged/untagged flag in the
Christoph> request to work properly.  Revert this patch and add a follow
Christoph> on to set it in the right place.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case
  2014-10-19 15:13 ` [PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case Christoph Hellwig
@ 2014-10-28  0:24   ` Martin K. Petersen
  0 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2014-10-28  0:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Meelis Roos, David Miller, linux-scsi, linux-kernel, stable

>>>>> "Christoph" == Christoph Hellwig <hch@lst.de> writes:

Christoph> To generate the right SPI tag messages we need to properly
Christoph> set QUEUE_FLAG_QUEUED in the request_queue and mirror it to
Christoph> the request.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2014-10-28  0:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-19 15:13 fix blk-mq for SPI hosts Christoph Hellwig
2014-10-19 15:13 ` [PATCH 1/2] Revert "block: all blk-mq requests are tagged" Christoph Hellwig
2014-10-28  0:23   ` Martin K. Petersen
2014-10-19 15:13 ` [PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case Christoph Hellwig
2014-10-28  0:24   ` Martin K. Petersen
2014-10-23  8:45 ` fix blk-mq for SPI hosts Christoph Hellwig
2014-10-23 10:49   ` Meelis Roos
2014-10-23 17:14     ` Christoph Hellwig
2014-10-23 17:16       ` Jens Axboe

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).