Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp288821iog; Mon, 13 Jun 2022 02:44:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD8XSjZ0KAwbctBvhPUemtyyCquPZoaDMOSM3tBhRCVKlD5K8G37WAJbvgzj5As7z9M59z X-Received: by 2002:a05:6a02:201:b0:3fc:6071:a272 with SMTP id bh1-20020a056a02020100b003fc6071a272mr51981267pgb.518.1655113471870; Mon, 13 Jun 2022 02:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655113471; cv=none; d=google.com; s=arc-20160816; b=uUT04q/bCtVz6T7wzTw/Mov74I5gFEiOIYKQja6y4t+XunmFwwByN0+bPzbujkRliq 5F9ohADurbqQ0s9H+9Fup7qJ4BIaGjyXctSretcgl/1kogoOkxKXn/G6DMRhoENK47Wq /FpNfy4gnF2DXjn66lzayvreVgQoKHMbek/O9XIpKXSrzsATV23kowzBTZeWqukaGhOu 0c6t0HnM7fAgawR/LPcOJFpPKba9mhFXL0h7MvK7R6qfLrLPHAHEc3ydPH+yBkEEBD0V CyA10gQ+0gM3PM/EmUrUdETLu9eNVgfpau+YxJ57uP1olKsHny3fkVldcsEQmObdLqVW wq3w== 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=3Dc7F2llR/d+kjSzaj5E6s5YYMwwwXLwGMwerp7yL2Q=; b=aheiSJg03/ScNvtwToPiMlWK1xQR9cZliJK/F65QNumWJCnsG9EWhDcSQedyc8EQ+6 Tw1IQ7D0zhxzNcOosE1yIvR90Yx/GO7EKaJ+tyJIyzGXNtv+3Y15TUO+b0V7rRnKtjfe iHrS0BFwYzYkXQ0W5UvnQHNmVmbSovRkciDbbcmMtc/xdxOhBgcI+aj8fOMXtvzRPo/Q YiRgltNqCRzIgDjKpyfbKrAfGLnD65RStu5meVWpLDs5otYBcrmYpiw6oGvAqAdCTGb8 dX2kpTPnbOKxXN4aFvzZNFyeRYCR0ERkbHATr8h8XAqCDOH1sjr0eG1Xp6iQpdSOjZL0 E6mw== 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 gl5-20020a17090b120500b001ea91760f6esi7842982pjb.79.2022.06.13.02.44.19; Mon, 13 Jun 2022 02:44:31 -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 S234687AbiFMJbm (ORCPT + 99 others); Mon, 13 Jun 2022 05:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234476AbiFMJbk (ORCPT ); Mon, 13 Jun 2022 05:31:40 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D89186D8; Mon, 13 Jun 2022 02:31:37 -0700 (PDT) Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LM5p33Dsxz67bVy; Mon, 13 Jun 2022 17:27:55 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 13 Jun 2022 11:31:34 +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; Mon, 13 Jun 2022 10:31:33 +0100 Message-ID: <53fa2856-54f2-c075-2eed-4f05c3459597@huawei.com> Date: Mon, 13 Jun 2022 10:34:41 +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 , , , , , , CC: , , , , References: <1654770559-101375-1-git-send-email-john.garry@huawei.com> <1654770559-101375-4-git-send-email-john.garry@huawei.com> <7f80f3b6-84f6-de48-4e69-4562c96e62c5@huawei.com> 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 13/06/2022 10:06, Damien Le Moal wrote: >>> We cannot have more than 32 tags. >> We may have 32 regular tags and 1 reserved tag for SATA. > Right. But that is the messy part though. That extra 1 tag is actually not > a tag since all internal commands are non-NCQ commands that do not need a > tag... But apart from SATA, libsas LLDDs do need a real tag for the libata internal command. > > I am working on command duration limits support currently. This feature > set has a new horrendous "improvement": a command can be aborted by the > device if it fails its duration limit, but the abort is done with a good > status + sense data available bit set so that the device queue is not > aborted entirely like with a regular NCQ command error. > > For such aborted commands, the command sense data is set to > "COMPLETED/DATA UNAVAILABLE". In this case, the host needs to go read the > new "successful NCQ sense data log" to check that the command sense is > indeed "COMPLETED/DATA UNAVAILABLE". And to go read that log page without > stalling the device queue, we would need an internal NCQ (queuable) command. > > Currently, that is not possible to do cleanly as there are no guarantees > we can get a free tag (there is a race between block layer tag allocation > and libata internal tag counting). So a reserved tag for that would be > nice. We would end up with 31 IO tags at most + 1 reserved tag for NCQ > commands + ATA_TAG_INTERNAL for non-NCQ. That last one would be rendered > rather useless. But that also means that we kind-of go back to the days > when Linux showed ATA drives max QD of 31... So must the ATA_TAG_INTERNAL qc always be available for non-NCQ action like EH, and that is why you cannot reuse for this internal NCQ (queuable) command? > > I am still struggling with this particular use case and trying to make it > fit with your series. Trying out different things right now. > ok > >>> I think keeping can_queue as the max queue depth with at most >>> nr_reserved_cmds tags reserved is better. >> Maybe the wording in the comment can be improved as it originally >> focused on SAS HBAs where there are no special rules for tagset depth or >> how the tagset should be carved up to handle regular and reserved commands. > Indeed. And that would be for HBAs that do*not* use libsas/libata. > Otherwise, the NCQ vs non-NCQ reserved tag mess is there. > Thanks, John