All of lore.kernel.org
 help / color / mirror / Atom feed
* Question: request tag usage
@ 2014-09-26  6:29 Hannes Reinecke
  2014-09-26  8:03 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Reinecke @ 2014-09-26  6:29 UTC (permalink / raw)
  To: Christoph Hellwig, Robert Elliot, SCSI Mailing List, Jens Axboe

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
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Question: request tag usage
  2014-09-26  6:29 Question: request tag usage Hannes Reinecke
@ 2014-09-26  8:03 ` Christoph Hellwig
  2014-09-26  8:20   ` Hannes Reinecke
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2014-09-26  8:03 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Robert Elliot, SCSI Mailing List, Jens Axboe

On Fri, Sep 26, 2014 at 08:29:29AM +0200, Hannes Reinecke wrote:
> 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.

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

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

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

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


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

* Re: Question: request tag usage
  2014-09-26  8:03 ` Christoph Hellwig
@ 2014-09-26  8:20   ` Hannes Reinecke
  2014-09-26 10:12     ` James Bottomley
  2014-09-26 13:52     ` Elliott, Robert (Server Storage)
  0 siblings, 2 replies; 6+ messages in thread
From: Hannes Reinecke @ 2014-09-26  8:20 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Elliott, Robert (Server Storage), SCSI Mailing List, Jens Axboe

On 09/26/2014 10:03 AM, Christoph Hellwig wrote:
> On Fri, Sep 26, 2014 at 08:29:29AM +0200, Hannes Reinecke wrote:
>> 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.
> 
>> 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 ...

>> 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.
> 
>> - 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.
> 
I know. But I was asking about non-mq LLDDs.

>> 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
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Question: request tag usage
  2014-09-26  8:20   ` Hannes Reinecke
@ 2014-09-26 10:12     ` James Bottomley
  2014-09-26 12:41       ` Hannes Reinecke
  2014-09-26 13:52     ` Elliott, Robert (Server Storage)
  1 sibling, 1 reply; 6+ messages in thread
From: James Bottomley @ 2014-09-26 10:12 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Elliott, Robert (Server Storage),
	SCSI Mailing List, Jens Axboe

On Fri, 2014-09-26 at 10:20 +0200, Hannes Reinecke wrote:
> On 09/26/2014 10:03 AM, Christoph Hellwig wrote:
> > On Fri, Sep 26, 2014 at 08:29:29AM +0200, Hannes Reinecke wrote:
> >> 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.
> > 
> >> 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



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

* Re: Question: request tag usage
  2014-09-26 10:12     ` James Bottomley
@ 2014-09-26 12:41       ` Hannes Reinecke
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2014-09-26 12:41 UTC (permalink / raw)
  To: James Bottomley
  Cc: Christoph Hellwig, Elliott, Robert (Server Storage),
	SCSI Mailing List, Jens Axboe

On 09/26/2014 12:12 PM, James Bottomley wrote:
> On Fri, 2014-09-26 at 10:20 +0200, Hannes Reinecke wrote:
>> On 09/26/2014 10:03 AM, Christoph Hellwig wrote:
>>> On Fri, Sep 26, 2014 at 08:29:29AM +0200, Hannes Reinecke wrote:
>>>> 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.
>>>
>>>> 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.
> 
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 = 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);
 }
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
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: Question: request tag usage
  2014-09-26  8:20   ` Hannes Reinecke
  2014-09-26 10:12     ` James Bottomley
@ 2014-09-26 13:52     ` Elliott, Robert (Server Storage)
  1 sibling, 0 replies; 6+ messages in thread
From: Elliott, Robert (Server Storage) @ 2014-09-26 13:52 UTC (permalink / raw)
  To: Hannes Reinecke, Christoph Hellwig; +Cc: SCSI Mailing List, Jens Axboe



> -----Original Message-----
> From: Hannes Reinecke [mailto:hare@suse.de]
> 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:
...
> >
> > 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"


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

end of thread, other threads:[~2014-09-26 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26  6:29 Question: request tag usage Hannes Reinecke
2014-09-26  8:03 ` Christoph Hellwig
2014-09-26  8:20   ` Hannes Reinecke
2014-09-26 10:12     ` James Bottomley
2014-09-26 12:41       ` Hannes Reinecke
2014-09-26 13:52     ` Elliott, Robert (Server Storage)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.