Skip to contentSkip to conversation

Question: request tag usage

DISCUSSION Hannes Reinecke 4 participants 6 messages Sep 26, 2014

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

Hi Christoph,

as discussed it would make sense to use the request->tag in eg scmd_printk() to identify the command.
Which I duly did, only to figure out that the tag is always '-1', ie tagging is not in use.
(Which is okay from the SCSI side, seeing the TCQ is basically a SCSI parallel thing).
Looking closer I found plenty of code for handling tags in the block layer (and the blk-mq stuff, of course), but virtually none of the non-SPI driver seems to be using them.
Which makes the original idea a bit pointless, seeing that we need to identify the command _always_, and not just if the host happens to support tagging.

Which leads me to some questions:
- Is the stuff in blk-mq supposed to work as a superset of SCSI TCQ?
- If so, should any HBAs with a queue depth > 1 (which does not support TCQ) set the tag of a command?
(that's what I've initially thought would happen ...)
- If not (and the ->tag field is basically unused), can't we have the HBA to fill in a value here?

What I would like to see is to have the '->tag' field as an identification for the commands in flight. IE every HBA with a queue depth > 1 should be setting the tags.

Which apparently was too much to hope for ...

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 8 lines · Hannes Reinecke

Hi Christoph,

as discussed it would make sense to use the request->tag in eg scmd_printk() to identify the command.
Which I duly did, only to figure out that the tag is always '-1', ie tagging is not in use.
(Which is okay from the SCSI side, seeing the TCQ is basically a SCSI parallel thing).

tag are still a live part of SAM for every transport, they've only been renamed to "command identifier" in SAM-4 to confuse everyone.

Quoted 3 lines

Looking closer I found plenty of code for handling tags in the block layer (and the blk-mq stuff, of course), but virtually none of the non-SPI driver seems to be using them.

A quick grep for scsi_activate_tcq disagrees with you.

Quoted 6 lines

Which makes the original idea a bit pointless, seeing that we need to identify the command _always_, and not just if the host happens to support tagging.

Which leads me to some questions:
- Is the stuff in blk-mq supposed to work as a superset of SCSI TCQ?

Yes.

Quoted 5 lines

- If so, should any HBAs with a queue depth > 1 (which does not support TCQ) set the tag of a command?
(that's what I've initially thought would happen ...)
- If not (and the ->tag field is basically unused), can't we have the HBA to fill in a value here?

blk-mq will always provide, and does rely on a valid request->tag. A LLDD can still use it's own internal tagging or mess with scmd->tag, although in general it should benefit from using the block layer tagging.

Quoted 1 line

Which apparently was too much to hope for ...

I guess for now we'll need to stay with the command pointer address. We can revisit this once the old request layer is gone.

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Hannes Reinecke

Hi Christoph,

as discussed it would make sense to use the request->tag in eg scmd_printk() to identify the command.
Which I duly did, only to figure out that the tag is always '-1', ie tagging is not in use.
(Which is okay from the SCSI side, seeing the TCQ is basically a SCSI parallel thing).

Quoted 9 lines

tag are still a live part of SAM for every transport, they've only been renamed to "command identifier" in SAM-4 to confuse everyone.

Quoted 3 lines

Looking closer I found plenty of code for handling tags in the block layer (and the blk-mq stuff, of course), but virtually none of the non-SPI driver seems to be using them.

A quick grep for scsi_activate_tcq disagrees with you.

Yeah, I've noticed after I've written the mail. However, main point still stands: using 'tag' to identify commands is pointless if not all of the LLDDs use tagging ...

Quoted 15 lines
Quoted 6 lines

Which makes the original idea a bit pointless, seeing that we need to identify the command _always_, and not just if the host happens to support tagging.

Which leads me to some questions:
- Is the stuff in blk-mq supposed to work as a superset of SCSI TCQ?

Yes.

Quoted 5 lines

- If so, should any HBAs with a queue depth > 1 (which does not support TCQ) set the tag of a command?
(that's what I've initially thought would happen ...)
- If not (and the ->tag field is basically unused), can't we have the HBA to fill in a value here?

Quoted 5 lines

blk-mq will always provide, and does rely on a valid request->tag. A LLDD can still use it's own internal tagging or mess with scmd->tag, although in general it should benefit from using the block layer tagging.

I know. But I was asking about non-mq LLDDs.

Quoted 5 lines
Quoted 1 line

Which apparently was too much to hope for ...

I guess for now we'll need to stay with the command pointer address. We can revisit this once the old request layer is gone.

Too bad. The tags would have provided a really nice concise way of identifying the command...

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#3 lore raw
Quoted 18 lines · Hannes Reinecke
Quoted 17 lines · Christoph Hellwig
Quoted 8 lines · Hannes Reinecke

Hi Christoph,

as discussed it would make sense to use the request->tag in eg scmd_printk() to identify the command.
Which I duly did, only to figure out that the tag is always '-1', ie tagging is not in use.
(Which is okay from the SCSI side, seeing the TCQ is basically a SCSI parallel thing).

tag are still a live part of SAM for every transport, they've only been renamed to "command identifier" in SAM-4 to confuse everyone.

Quoted 3 lines

Looking closer I found plenty of code for handling tags in the block layer (and the blk-mq stuff, of course), but virtually none of the non-SPI driver seems to be using them.

Quoted 5 lines
Quoted 2 lines

A quick grep for scsi_activate_tcq disagrees with you.

Yeah, I've noticed after I've written the mail. However, main point still stands: using 'tag' to identify commands is pointless if not all of the LLDDs use tagging ...

Every non parallel LLD uses tagging; they all use the network request response model, so they can no longer hold the bus until they get an answer (which was how untagged commands work in SPI), so for most of the transports, untagged commands aren't legal. Of course, some drivers roll their own tags instead of using the block ones.

James

#4 lore raw
Quoted 25 lines · James Bottomley
Quoted 18 lines · Hannes Reinecke
Quoted 17 lines · Christoph Hellwig
Quoted 8 lines · Hannes Reinecke

Hi Christoph,

as discussed it would make sense to use the request->tag in eg scmd_printk() to identify the command.
Which I duly did, only to figure out that the tag is always '-1', ie tagging is not in use.
(Which is okay from the SCSI side, seeing the TCQ is basically a SCSI parallel thing).

tag are still a live part of SAM for every transport, they've only been renamed to "command identifier" in SAM-4 to confuse everyone.

Quoted 3 lines

Looking closer I found plenty of code for handling tags in the block layer (and the blk-mq stuff, of course), but virtually none of the non-SPI driver seems to be using them.

Quoted 5 lines
Quoted 2 lines

A quick grep for scsi_activate_tcq disagrees with you.

Yeah, I've noticed after I've written the mail. However, main point still stands: using 'tag' to identify commands is pointless if not all of the LLDDs use tagging ...

Quoted 6 lines

Every non parallel LLD uses tagging; they all use the network request response model, so they can no longer hold the bus until they get an answer (which was how untagged commands work in SPI), so for most of the transports, untagged commands aren't legal. Of course, some drivers roll their own tags instead of using the block ones.

Hmm, I probably will get shot for this, but we _could_ do something like this:

block/blk-core.c +2 -1
index bf930f4..91570d2 100644
@@ -2347,7 +2347,8 @@ void blk_start_request(struct request *req)
        req->resid_len = blk_rq_bytes(req);
        if (unlikely(blk_bidi_rq(req)))
                req->next_rq->resid_len = blk_rq_bytes(req->next_rq);
-
+       if (!blk_queue_tagged(req->q))
+               req->tag = (++req->q->last_tag) % req->q->nr_requests;
        BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags));
        blk_add_timer(req);
 }
include/linux/blkdev.h +1 -0
index 518b465..e8ce575 100644
@@ -418,6 +418,7 @@ struct request_queue {
 
        struct blk_queue_tag    *queue_tags;
        struct list_head        tag_busy_list;
+       unsigned int            last_tag;
 
        unsigned int            nr_sorted;
        unsigned int            in_flight[2];

I know, I know. But it would give us a rather nice command identifier.

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to Hannes Reinecke
Quoted 10 lines

-----Original Message-----
From: Hannes Reinecke [mailto:[email protected]]
Sent: Friday, September 26, 2014 3:21 AM
To: Christoph Hellwig
Cc: Elliott, Robert (Server Storage); SCSI Mailing List; Jens Axboe
Subject: Re: Question: request tag usage

On 09/26/2014 10:03 AM, Christoph Hellwig wrote:

...

Quoted 6 lines
Quoted 4 lines

I guess for now we'll need to stay with the command pointer address. We can revisit this once the old request layer is gone.

Too bad. The tags would have provided a really nice concise way of identifying the command...

I would still go ahead and print the tag; it's extremely useful for blk-mq.

How about having scmd_printk do this?
* if tag is -1, print "scmd %p"
* else print "tag %d"