Discussion:
Question: request tag usage
Hannes Reinecke
2014-09-26 06:29:29 UTC
Permalink
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
--=20
Dr. Hannes Reinecke zSeries & Storage
***@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg
GF: J. Hawn, J. Guild, F. Imend=F6rffer, HRB 16746 (AG N=FCrnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" i=
n
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Christoph Hellwig
2014-09-26 08:03:08 UTC
Permalink
Post by 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.
Post by Hannes Reinecke
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.
Post by Hannes Reinecke
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.
- Is the stuff in blk-mq supposed to work as a superset of SCSI TCQ?
Yes.
Post by Hannes Reinecke
- 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.
Post by Hannes Reinecke
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.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
2014-09-26 08:20:43 UTC
Permalink
Post by Christoph Hellwig
Post by 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).
=20
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.
=20
Post by Hannes Reinecke
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.
=20
A quick grep for scsi_activate_tcq disagrees with you.
=20
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 ...
Post by Christoph Hellwig
Post by Hannes Reinecke
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.
- Is the stuff in blk-mq supposed to work as a superset of SCSI TCQ?
=20
Yes.
=20
Post by Hannes Reinecke
- 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?
=20
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=
,
Post by Christoph Hellwig
although in general it should benefit from using the block layer
tagging.
=20
I know. But I was asking about non-mq LLDDs.
Post by Christoph Hellwig
Post by Hannes Reinecke
Which apparently was too much to hope for ...
=20
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.
=20
Too bad. The tags would have provided a really nice concise way
of identifying the command...

Cheers,

Hannes
--=20
Dr. Hannes Reinecke zSeries & Storage
***@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg
GF: J. Hawn, J. Guild, F. Imend=F6rffer, HRB 16746 (AG N=FCrnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" i=
n
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
2014-09-26 10:12:23 UTC
Permalink
Post by Hannes Reinecke
Post by Christoph Hellwig
Post by 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.
Post by Hannes Reinecke
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 ...
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


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
2014-09-26 12:41:17 UTC
Permalink
Post by James Bottomley
Post by Hannes Reinecke
Post by Christoph Hellwig
Post by 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
Post by James Bottomley
Post by Hannes Reinecke
Post by Christoph Hellwig
Post by Hannes Reinecke
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.
Post by Hannes Reinecke
Looking closer I found plenty of code for handling tags in the blo=
ck
Post by James Bottomley
Post by Hannes Reinecke
Post by Christoph Hellwig
Post by Hannes Reinecke
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 ...
=20
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
Post by James Bottomley
transports, untagged commands aren't legal. Of course, some drivers
roll their own tags instead of using the block ones.
=20
Hmm, I probably will get shot for this, but we _could_ do something
like this:

diff --git a/block/blk-core.c b/block/blk-core.c
index bf930f4..91570d2 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2347,7 +2347,8 @@ void blk_start_request(struct request *req)
req->resid_len =3D blk_rq_bytes(req);
if (unlikely(blk_bidi_rq(req)))
req->next_rq->resid_len =3D blk_rq_bytes(req->next_rq);
-
+ if (!blk_queue_tagged(req->q))
+ req->tag =3D (++req->q->last_tag) % req->q->nr_requests=
;
BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags));
blk_add_timer(req);
}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 518b465..e8ce575 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -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
--=20
Dr. Hannes Reinecke zSeries & Storage
***@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg
GF: J. Hawn, J. Guild, F. Imend=C3=B6rffer, HRB 16746 (AG N=C3=BCrnberg=
)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" i=
n
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Elliott, Robert (Server Storage)
2014-09-26 13:52:23 UTC
Permalink
-----Original Message-----
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
...
Post by Christoph Hellwig
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"

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...