Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp481166rdb; Tue, 19 Sep 2023 00:51:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKEtVAXJ8aufGCUijOy2KcP3I5SPMwuQZ89lDl0u+P36efGZi6gKMtyvQWOosc1jMwV2wZ X-Received: by 2002:a05:6a20:978a:b0:148:c3ea:fb6c with SMTP id hx10-20020a056a20978a00b00148c3eafb6cmr10019125pzc.36.1695109895025; Tue, 19 Sep 2023 00:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695109895; cv=none; d=google.com; s=arc-20160816; b=wJvLq1fn1Efl83BfhuQJ35+VGoGpWLFfT9XDWYA5KGI+1Op0aJyxLqh2l0+HPuDID+ 5p7Iaf+zFIY3PB9zUVTs7XTw021Tnuidt4/Rm16MQJ0Eo6JXZjFsq7bdVMp99U9f+H6X hTFSOM8XHxwp7jqpkFzrrnuAcGzBygvZfQU1O0FODqKuFp0fkb9hnW344rdTk4NKI+RG ZzHayKBJ1MT+DdACl9C7QZSyVbXVsRZnftW4WrC30ViQ6+itFGlKdsZ8uVPV0RrwEE7v AHbgW7a5FG2yJNWTou7ciAsluBulPPFuKcaP/JMfh0ktNeAI3bBcYDI0nR6MFQETDqYY rJkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KDBCDk37Hc+NeswrIGhQ9eaVKgsZNYU2taMfnT8VsD8=; fh=0jAly0MiKJ/kbmheIqVHdEbVrsP5BHor2C4tGaC497c=; b=yEs4FtLGTAMYykBnGmuJUzBeoSMNrDRmAkKn27kpDsaRwoLsQArkhmX+DgC7BEk8ef HsncatbcxIhcqwL6mhBLmMQ+N/ipQfxkCd/kgPkI4LUoEzsTUcDjvd4Wf12azBjvUI3H 5UVjsZnd8X8YvknMJBZwkDA1nTEm07hEXcmUiohtMeH6fBvJqsYSWDjrJe7vzrrhGSWP 5KblJyJ9TrNzJmjnN/RlHLvYnodQRvVQjds6FQPo3kjLtOCnb6i9vSZ79nADHCY7aaGZ zWkdawv5tKzrAk9JC8laxBY+Q1WITokp5D4+MMbDY4ho4/VgJ+OHohN3qYoSF1J0A0JE Me1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u25-20020a656719000000b0056fa5d8c2ffsi9121317pgf.325.2023.09.19.00.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 00:51:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id CADA581A5AC7; Tue, 19 Sep 2023 00:47:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjISHrn (ORCPT + 99 others); Tue, 19 Sep 2023 03:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbjISHrk (ORCPT ); Tue, 19 Sep 2023 03:47:40 -0400 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DA1115; Tue, 19 Sep 2023 00:47:32 -0700 (PDT) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 38J7lFQY044014; Tue, 19 Sep 2023 15:47:15 +0800 (+08) (envelope-from Wenchao.Chen@unisoc.com) Received: from SHDLP.spreadtrum.com (shmbx05.spreadtrum.com [10.29.1.56]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4RqYZR5DTRz2SK5Ds; Tue, 19 Sep 2023 15:43:59 +0800 (CST) Received: from xm9614pcu.spreadtrum.com (10.13.2.29) by shmbx05.spreadtrum.com (10.29.1.56) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Sep 2023 15:47:14 +0800 From: Wenchao Chen To: CC: , , , , , , Wenchao Chen Subject: [PATCH V4 1/2] mmc: queue: replace immediate with hsq->depth Date: Tue, 19 Sep 2023 15:47:06 +0800 Message-ID: <20230919074707.25517-2-wenchao.chen@unisoc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230919074707.25517-1-wenchao.chen@unisoc.com> References: <20230919074707.25517-1-wenchao.chen@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.13.2.29] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To shmbx05.spreadtrum.com (10.29.1.56) X-MAIL: SHSQR01.spreadtrum.com 38J7lFQY044014 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 19 Sep 2023 00:47:59 -0700 (PDT) Hsq is similar to cqe, using hsq->depth to represent the maximum processing capacity of hsq. We can adjust hsq->depth according to the actual situation. Signed-off-by: Wenchao Chen --- drivers/mmc/core/queue.c | 6 +----- drivers/mmc/host/mmc_hsq.c | 1 + drivers/mmc/host/mmc_hsq.h | 6 ++++++ include/linux/mmc/host.h | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index b396e3900717..a0a2412f62a7 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -260,11 +260,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx, } break; case MMC_ISSUE_ASYNC: - /* - * For MMC host software queue, we only allow 2 requests in - * flight to avoid a long latency. - */ - if (host->hsq_enabled && mq->in_flight[issue_type] > 2) { + if (host->hsq_enabled && mq->in_flight[issue_type] > host->hsq_depth) { spin_unlock_irq(&mq->lock); return BLK_STS_RESOURCE; } diff --git a/drivers/mmc/host/mmc_hsq.c b/drivers/mmc/host/mmc_hsq.c index 424dc7b07858..8556cacb21a1 100644 --- a/drivers/mmc/host/mmc_hsq.c +++ b/drivers/mmc/host/mmc_hsq.c @@ -337,6 +337,7 @@ int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc) hsq->mmc = mmc; hsq->mmc->cqe_private = hsq; mmc->cqe_ops = &mmc_hsq_ops; + mmc->hsq_depth = HSQ_NORMAL_DEPTH; for (i = 0; i < HSQ_NUM_SLOTS; i++) hsq->tag_slot[i] = HSQ_INVALID_TAG; diff --git a/drivers/mmc/host/mmc_hsq.h b/drivers/mmc/host/mmc_hsq.h index 1808024fc6c5..aa5c4543b55f 100644 --- a/drivers/mmc/host/mmc_hsq.h +++ b/drivers/mmc/host/mmc_hsq.h @@ -5,6 +5,12 @@ #define HSQ_NUM_SLOTS 64 #define HSQ_INVALID_TAG HSQ_NUM_SLOTS +/* + * For MMC host software queue, we only allow 2 requests in + * flight to avoid a long latency. + */ +#define HSQ_NORMAL_DEPTH 2 + struct hsq_slot { struct mmc_request *mrq; }; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 62a6847a3b6f..2f445c651742 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -526,6 +526,7 @@ struct mmc_host { /* Host Software Queue support */ bool hsq_enabled; + int hsq_depth; u32 err_stats[MMC_ERR_MAX]; unsigned long private[] ____cacheline_aligned; -- 2.17.1