public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: John Garry <john.garry@huawei.com>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Bart Van Assche <bvanassche@acm.org>,
	axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com,
	brking@us.ibm.com, hch@lst.de
Cc: linux-block@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	chenxiang66@hisilicon.com
Subject: Re: [PATCH RFC v2 03/18] scsi: core: Implement reserved command handling
Date: Mon, 20 Jun 2022 10:02:30 +0200	[thread overview]
Message-ID: <c2ae8f65-5570-fdad-3b3a-c00bb10c98c8@suse.de> (raw)
In-Reply-To: <3a27b6ff-e495-8f11-6925-1487c9d14fa9@huawei.com>

On 6/15/22 09:35, John Garry wrote:
> On 15/06/2022 00:43, Damien Le Moal wrote:
>> On 6/15/22 03:20, Bart Van Assche wrote:
>>> On 6/13/22 00:01, Damien Le Moal wrote:
>>>> On 6/9/22 19:29, John Garry wrote:
>>>>> +    /*
>>>>> +     * This determines how many commands the HBA will set aside
>>>>> +     * for internal commands. This number will be added to
>>>>> +     * @can_queue to calcumate the maximum number of simultaneous
>>>>
>>>> s/calcumate/calculate
>>>>
>>>> But this is weird. For SATA, can_queue is 32. Having reserved commands,
>>>> that number needs to stay the same. We cannot have more than 32 tags.
>>>> I think keeping can_queue as the max queue depth with at most
>>>> nr_reserved_cmds tags reserved is better.
>>>>
>>>>> +     * commands sent to the host.
>>>>> +     */
>>>>> +    int nr_reserved_cmds;
>>>
>>> +1 for Damien's request. I also prefer to keep can_queue as the maximum
>>> queue depth, whether or not nr_reserved_cmds has been set.
>>
>> For non SATA drives, I still think that is a good idea. However, for 
>> SATA,
>> we always have the internal tag command that is special. With John's
>> change, it would have to be reserved but that means we are down to 31 max
>> QD,
> 
> My intention is to keep regular tag depth at 32 for SATA. We add an 
> extra tag as a reserved tag. Indeed, this is called a 'tag', but it's 
> just really the placeholder for what will be the ATA_TAG_INTERNAL request.
> 
> About how we set scsi_host.can_queue, in this series we set .can_queue 
> as max regular tags, and the handling is as follows:
> 
> scsi_mq_setup_tags():
> tag_set->queue_depth = shost->can_queue + shost->nr_reserved_cmds
> tag_set->reserved_tags = shost->nr_reserved_cmds
> 
> So we honour the rule that blk_mq_tag_set.queue_depth is the total tag 
> depth, including reserved.
> 
> Incidentally I think Christoph prefers to keep .can_queue at total max 
> tags including reserved:
> https://lore.kernel.org/linux-scsi/337339b7-6f4a-a25c-f11c-7f701b42d6a8@suse.de/ 
> 
> 
>> so going backward several years... That internal tag for ATA does not
>> need to be reserved since this command is always used when the drive is
>> idle and no other NCQ commands are on-going.
> 
> So do you mean that ATA_TAG_INTERNAL qc is used for other commands apart 
> from internal commands?
> 
Well.

The problem is that 'ATA_TAG_INTERNAL' currently is overloaded to
a) signal internal commands
b) 'magic' tag when looking up commands

My proposal would be to separate these use-cases, and use a flag (eg 
ATA_QCFLAG_INTERNAL) to determine internal commands.

The we'll be needing an internal tag-lookup map
(NCQ tag -> blk-mq tag) for ata_qc_from_tag() to retrieve the command 
corresponding to a driver tag.

I guess we'll need that anyway with libsas, as there we're working with 
a budget tag which has no relationship with the NCQ tag whatsoever ...

But with that we can kill 'ATA_TAG_INTERNAL', and let the driver figure 
out how to allocate internal tags.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

  parent reply	other threads:[~2022-06-20  8:02 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 10:29 [PATCH RFC v2 00/18] blk-mq/libata/scsi: SCSI driver tagging improvements John Garry
2022-06-09 10:29 ` [PATCH RFC v2 01/18] blk-mq: Add a flag for reserved requests John Garry
2022-06-14  6:43   ` Christoph Hellwig
2022-06-14  9:29     ` John Garry
2022-06-14 18:00   ` Bart Van Assche
2022-06-14 18:30     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 02/18] scsi: core: Resurrect scsi_{get,free}_host_dev() John Garry
2022-06-14  6:44   ` Christoph Hellwig
2022-06-14  9:33     ` John Garry
2022-06-14 19:33   ` Bart Van Assche
2022-06-15 13:44     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 03/18] scsi: core: Implement reserved command handling John Garry
2022-06-13  7:01   ` Damien Le Moal
2022-06-13  8:25     ` John Garry
2022-06-13  9:06       ` Damien Le Moal
2022-06-13  9:34         ` John Garry
2022-06-13  9:43           ` Damien Le Moal
2022-06-13 10:05             ` John Garry
2022-06-20  6:45         ` Hannes Reinecke
2022-06-20  7:06           ` Damien Le Moal
2022-06-14 18:20     ` Bart Van Assche
2022-06-14 23:43       ` Damien Le Moal
2022-06-15  7:35         ` John Garry
2022-06-16  2:47           ` Damien Le Moal
2022-06-16  8:24             ` John Garry
2022-06-16  8:41               ` Damien Le Moal
2022-06-20  8:27                 ` Hannes Reinecke
2022-06-20  9:02                   ` Damien Le Moal
2022-06-20  9:05                     ` Christoph Hellwig
2022-06-20 11:24                       ` Damien Le Moal
2022-06-20 11:56                         ` Hannes Reinecke
2022-06-20  8:02           ` Hannes Reinecke [this message]
2022-06-20  6:24     ` Hannes Reinecke
2022-06-20  6:28       ` Christoph Hellwig
2022-06-20  7:03         ` Hannes Reinecke
2022-06-20  7:14           ` Damien Le Moal
2022-06-09 10:29 ` [PATCH RFC v2 04/18] scsi: core: Add support to send reserved commands John Garry
2022-06-13  7:03   ` Damien Le Moal
2022-06-13  9:40     ` John Garry
2022-06-13  9:41       ` Damien Le Moal
2022-06-09 10:29 ` [PATCH RFC v2 05/18] scsi: core: Allocate SCSI host sdev when required John Garry
2022-06-09 10:29 ` [PATCH RFC v2 06/18] libata-scsi: Add ata_scsi_queue_internal() John Garry
2022-06-13  7:12   ` Damien Le Moal
2022-06-13  9:41     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 07/18] libata-scsi: Add ata_internal_queuecommand() John Garry
2022-06-13  7:16   ` Damien Le Moal
2022-06-13  9:44     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 08/18] libata: Queue ATA internal commands as requests John Garry
2022-06-13  7:22   ` Damien Le Moal
2022-06-13  8:13     ` John Garry
2022-06-09 10:29 ` [PATCH RFC v2 09/18] scsi: ipr: Support reserved commands John Garry
2022-06-09 10:29 ` [PATCH RFC v2 10/18] libata/scsi: libsas: Add sas_queuecommand_internal() John Garry
2022-06-09 10:29 ` [PATCH RFC v2 11/18] scsi: libsas: Don't attempt to find scsi host rphy in slave alloc John Garry
2022-06-09 10:29 ` [PATCH RFC v2 12/18] scsi: libsas drivers: Prepare for reserved commands John Garry
2022-06-09 10:29 ` [PATCH RFC v2 13/18] scsi: libsas: Allocate SCSI commands for tasks John Garry
2022-06-09 10:29 ` [PATCH RFC v2 14/18] scsi: libsas: Queue SMP commands as requests John Garry
2022-06-09 10:29 ` [PATCH RFC v2 15/18] scsi: libsas: Queue TMF " John Garry
2022-06-09 10:29 ` [PATCH RFC v2 16/18] scsi: core: Add scsi_alloc_request_hwq() John Garry
2022-06-09 10:29 ` [PATCH RFC v2 17/18] scsi: libsas: Queue internal abort commands as requests John Garry
2022-06-09 10:29 ` [PATCH RFC v2 18/18] scsi: libsas drivers: Remove private tag management John Garry

Reply instructions:

You may reply publicly 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=c2ae8f65-5570-fdad-3b3a-c00bb10c98c8@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=brking@us.ibm.com \
    --cc=bvanassche@acm.org \
    --cc=chenxiang66@hisilicon.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=john.garry@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox