Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp385170imn; Fri, 29 Jul 2022 09:47:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uD1cYCjfE0OY53+trUb+DsXxZn7Hrf6JJLL0246AI5Hc4r82HsW6KPhZQShT6IBDIS6wcb X-Received: by 2002:a05:6a00:a11:b0:52b:fb6f:b614 with SMTP id p17-20020a056a000a1100b0052bfb6fb614mr4293366pfh.33.1659113254532; Fri, 29 Jul 2022 09:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659113254; cv=none; d=google.com; s=arc-20160816; b=NqnuIPiNKH7qx8tHRg+CQxrIqCN4zSq74zjsFdyEZD0hz71r8az64XxAiYj8WzcFrb GGgEx3yF1AxLs28zk0hTDIQO4ozXhtjCQGGZ4q1/K6Zxx20COW5QZ6sQG9AXOHjxeNbd /5swrbmdeTgDOzGKF+EDP8b2hsG7nAC0MEPA4aNxhMRMdw9PZAVjbmgMntdpJUUuFAvn 0ApEwSFcxLqlxTJXOQAa1uzknmLyDSLtHnN76O4jeZkWv2BhtWmo9SHptsMosnyWaGHE mZ372UzSBjfynYVOcZ+9yYTasj/d2ZYGwaHFqYLwHUnBUZaFJcEILS2i2Ee0tIYorjgu eHZQ== 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:references :cc:to:from:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=rtqlWzoBg32+YUKG0SS5QWN9yxKR8MwGAO832LwRtmg=; b=TxkDEfhxqKSu/Wpn3iE8bEmlwy1C/sw16bh2t3PyUQnIA6S0crAlZT3CIm97wrDN/J qANCWKTGNo/xh1Rvu0haWtwJeuxrDUK+CuI2OcalJ/DdWSFu5LqMunDLBwL843hLNGS1 sC5+pRyiuwT1pbHO/a7x1uuVed7W2iq5qVd9E4nws7oU4feSL3x7oDHhbGtLueSAqzSv DgAc+mgLoRqkjBWw4SlFOyEVbsxE71mymaYx28ny6FUQ8WBuZgWlUCOC3e5gR6s3fPgc 69H4iDQruRQr1Kbey8ul9kI4q8UWOvqqmOLVDB87aaIWnD40+9fFoUX0Fe5ia2v2hTTr CIXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=R6sZN6wZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb17-20020a17090b4a5100b001f02e5a1428si5184517pjb.105.2022.07.29.09.47.19; Fri, 29 Jul 2022 09:47:34 -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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=R6sZN6wZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238012AbiG2Qn0 (ORCPT + 99 others); Fri, 29 Jul 2022 12:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236744AbiG2QnY (ORCPT ); Fri, 29 Jul 2022 12:43:24 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACEE721251; Fri, 29 Jul 2022 09:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1659113003; x=1690649003; h=message-id:date:mime-version:subject:from:to:cc: references:in-reply-to:content-transfer-encoding; bh=rtqlWzoBg32+YUKG0SS5QWN9yxKR8MwGAO832LwRtmg=; b=R6sZN6wZUpLNbyaurM/YQOmVc7E9htuKOOghqdRgzQL4ZgSMKoRzUpfw p2ySSiQxBoiSdYecFQOx6LwnBBO/nnPeNlQp0uamb3+CQAI/TG27BcLmJ OBN8Pj47UD81mgcsaKBPQvGF8xf0rmTIw1maAY18cM/+7BVk4li+00zZI I=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 29 Jul 2022 09:43:23 -0700 X-QCInternal: smtphost Received: from unknown (HELO nasanex01a.na.qualcomm.com) ([10.52.223.231]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2022 09:43:22 -0700 Received: from [10.110.38.152] (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 29 Jul 2022 09:43:22 -0700 Message-ID: <59e835e6-b694-07c5-16a1-5f7774fc4177@quicinc.com> Date: Fri, 29 Jul 2022 09:43:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCH 1/2] scsi: ufs: Add Multi-Circular Queue support From: "Asutosh Das (asd)" To: Bart Van Assche , John Garry , Can Guo , , , , , , , , , CC: "James E.J. Bottomley" , "Martin K. Petersen" , Daejun Park , Jinyoung Choi , Kiwoong Kim , open list References: <1658214120-22772-1-git-send-email-quic_cang@quicinc.com> <1658214120-22772-2-git-send-email-quic_cang@quicinc.com> <10288041-8c3d-7e3a-9049-10b9fcd8baed@acm.org> <6da1447d-01d6-222e-fc98-7e96b154d2d0@quicinc.com> In-Reply-To: <6da1447d-01d6-222e-fc98-7e96b154d2d0@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Hi Bart, On 7/28/2022 2:07 PM, Asutosh Das (asd) wrote: > On 7/28/2022 1:29 PM, Bart Van Assche wrote: >> On 7/28/22 12:15, Asutosh Das (asd) wrote: >>> Hello John, >>> >>> On 7/28/2022 12:10 PM, John Garry wrote: >>>> On 19/07/2022 08:01, Can Guo wrote: >>>>> + >>>>> +    hba->nr_queues[HCTX_TYPE_DEFAULT] = num_possible_cpus(); >>>>> +    hba->nr_queues[HCTX_TYPE_READ] = 0; >>>>> +    hba->nr_queues[HCTX_TYPE_POLL] = 1; >>>>> + >>>>> +    for (i = 0; i < HCTX_MAX_TYPES; i++) >>>>> +        host->nr_hw_queues += hba->nr_queues[i]; >>>>> + >>>>> +    host->can_queue = hba->nutrs; >>>>> +    host->cmd_per_lun = hba->nutrs; >>>>> + >>>>> +    /* One more reserved for dev_cmd_queue */ >>>>> +    hba->nr_hw_queues = host->nr_hw_queues + 1; >>>>> + >>>> >>>> So this would mean that the host can accept .can_queue * >>>> .nr_hw_queues numbers of requests simultaneously - is that true? >>> >>> That would mean that .can_queue * .nr_hw_queues numbers of request >>> may be queued to the host. >>> Please can you elaborate if you see an issue. >> >> Hi Asutosh, >> >> The `host_tagset` flag has been introduced by John and Hannes some >> time ago. See also commit bdb01301f3ea ("scsi: Add host and host >> template flag 'host_tagset'"). This flag supports sharing tags across >> hardware queues and could be used to support UFSHCI 4.0 controllers >> that do not support the EXT_IID feature. >> >> In order not to complicate the implementation further, I propose to >> fall back to the UFSHCI 3.0 compatibility mode for UFSHCI 4.0 >> controllers that do not support the EXT_IID feature. >> >> To answer John's question: the maximum number of outstanding commands >> is 16 * hba->nutrs if EXT_IID is supported (EXT_IID is a four bits >> field). If the hardware queue index is encoded in the EXT_IID field, >> hba->nutrs is the number of commands per hardware queue. >> >> Thanks, >> >> Bart. > > Thanks Bart, I wasn't aware of the background of John's Q. I will > consider your proposal and get back. > I went through the change and fwiu of your proposal is to use host_tagset = 1 if HC doesn't support EXT_IID capability. That way tags would be shared across 16 HWQs (4-bit IID encoding the queue-ids). That would also mean that the hba->nutrs would have to be adjusted such that the tags(8-bit) don't exceed 255. Summarily, if EXT_IID is not supported: host_tagset = 1, maximum configurable hba->nutrs = 16, maximum configurable nr_hw_queues = 16. maximum number of outstanding commands to host = 16 x 16 = 256. if EXT_IID is supported: host_tagset = 0, maximum confiugrable hba-nutrs = 255, maximum configurable nr_hw_queues = 255. Please let me know if I'm missing something. Thank you, -asd