Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp246394iog; Wed, 15 Jun 2022 01:13:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v83Y4NiImRYLh/ftl+Gd6Rj6UaZSYQPMaUH6mPwT7YUXVn7whQFo0I2rv6iEYZ+8vNthOg X-Received: by 2002:a17:90a:3182:b0:1e3:530d:6994 with SMTP id j2-20020a17090a318200b001e3530d6994mr8909722pjb.69.1655280783304; Wed, 15 Jun 2022 01:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655280783; cv=none; d=google.com; s=arc-20160816; b=MCO7J4etd73dRDUNMQZGo0SgWIHUAs904CBcDZtaEKdGalyPLh/6d+C7z4HIxB2sWL TxqH8RouD8SOIllEVpD+NJDgQXzJEjdxAyYft2boUiv/n32v5pZRvothMs/PKTECspuY wkMGfVhcb6swKT4zm5Dyr90vQrsTJBK5iQKeW+UF7Grtil+0nXeZVUepinCAkujFR0xy eDRbO+ATX/l1vY1SRBAEUY8DzACFj75OLEPZPmrHh9azv+kGSF+75InJZnznBzIRFhFT c+mk36I/jK0qnAb49KRHmy4fUZ1b/2uS6KzvIPGXD6Q3ok8n0Fgdyji6tcgS7RoWyB/f Qo2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=7zKcuKtlAkDobYpV8/KHWSHHlSlLpMNVJgGpd5vkbdE=; b=qX8NhHOQB4iBXtsbMKLkC13MW2ovmp55vzP1rrRetXgnwfbDL+qUZnrafUvbei+QKO DFMw0s3TE5HVK85kvU/+ZoRPibsuDZbUf1C8FFoQa9RHV6vRSEOU8r81AxqZ6XDXsfQV PPkG+eVENcrahxYvwZYMnvTHjLkO8iXrPlsTh2tjT6p/FOjMpFofU2z0neINQIIxFqLJ a9L/Hkei7v1Lab52hCNosRMiGv3V5zVISt0adLGhT8BFOA34pR+id3IZU3nQoAHIgwAQ fAEKgs1XtvMUy7qGpvGUYgANPqImkUfqrVXQbxvWAmRscQFAKNYcGUTaEk+MZwwn3mzW yAVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a170902d48700b001635111a63csi19128533plg.432.2022.06.15.01.12.48; Wed, 15 Jun 2022 01:13:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239487AbiFOHcD (ORCPT + 99 others); Wed, 15 Jun 2022 03:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbiFOHcA (ORCPT ); Wed, 15 Jun 2022 03:32:00 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A2E2473A0; Wed, 15 Jun 2022 00:31:58 -0700 (PDT) Received: from fraeml711-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LNH7B4jvmz6GD9p; Wed, 15 Jun 2022 15:31:50 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml711-chm.china.huawei.com (10.206.15.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 09:31:55 +0200 Received: from [10.195.33.253] (10.195.33.253) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 08:31:54 +0100 Message-ID: <3a27b6ff-e495-8f11-6925-1487c9d14fa9@huawei.com> Date: Wed, 15 Jun 2022 08:35:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH RFC v2 03/18] scsi: core: Implement reserved command handling To: Damien Le Moal , Bart Van Assche , , , , , , CC: , , , , References: <1654770559-101375-1-git-send-email-john.garry@huawei.com> <1654770559-101375-4-git-send-email-john.garry@huawei.com> <9e89360d-3325-92af-0436-b34df748f3e2@acm.org> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.195.33.253] X-ClientProxiedBy: lhreml746-chm.china.huawei.com (10.201.108.196) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > So the solution to all this is a likely a little more complicated if we > want to keep ATA max QD to 32. > thanks, John