Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1819385rwo; Wed, 2 Aug 2023 23:26:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkA1FyEmW2ib0BzYDNHeSxGdOK2Rvsda0fbCLv+qE1QZTPBLmG+Y6wcSeH6gwTQvA4QyCy X-Received: by 2002:a50:ed0f:0:b0:522:2a91:9e51 with SMTP id j15-20020a50ed0f000000b005222a919e51mr6568403eds.22.1691043966954; Wed, 02 Aug 2023 23:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691043966; cv=none; d=google.com; s=arc-20160816; b=UYiU3ME1jrFbVwJAQzySgbcggkIuxKfvW0eDBrR1aQwLOzUX79EJt8odEaCybSiRFf jD4sZSmez+VBe+Q2SpgShM1k51sHnV14eW1MsTBzkyewRbgZBxvM4cYop2mhGQaY6Nk+ VEodnZg2GoUC5KyznGQvfu3WoJRken71alFBU9VYRyO/MgydwU74F73ywLwsQovDIT6m jTyxDEeXTrhQGS/H/K+lDnML593dlze5OIFc6YiqDKVSqi+Vx7zttrfsouGVTJsgSITn /70zZElLtqkv6iTwpKyUtZKylkJQF7qEycgGeRsP6ToP4be4M6KNT76iyFAtPzIGku5W DYRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=g7gCRVwUoMOtBvCMwcn1jjKorUMcRZ1rgIR0ZqqLLXk=; fh=tfZDUMQgGbr0Rgqp9+IUuI9yt5jkuErbzptQGVhf1f8=; b=m2cA3HhgQWSwJsdnYi6ILRCMFDWQpG6T5OUdUewuxHiSnrPFk8YpCFxV2qeG+b5TiG b0w2LhlHHWOH3lVXuPUFx4qsVZUNgeFMMBoI/Ks5l+cM52n+FS3uxRQrVsWr+4dZTSau I2xmyTdjf9iCP9zpU9bGMvveuK+W6+9YS7G0ATKdT+IaBlLjhe5EqfrpoLygyEcDy8HY +gzECnbHwMWEbFL0iS0MqqweiXZaBKmJHcOzKyNrsBwVPfS+VxOvT68GtkxtfBFpuWq8 uWujnciKDlICRuzAXoZv8UsEp/SyMesS5hDucJkfT5kMopFMC0Aldw+67CU3JNsjfKq7 Ec+g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b26-20020a05640202da00b005222117c6fasi51639edx.614.2023.08.02.23.25.43; Wed, 02 Aug 2023 23:26:06 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232161AbjHCFqN (ORCPT + 99 others); Thu, 3 Aug 2023 01:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjHCFqM (ORCPT ); Thu, 3 Aug 2023 01:46:12 -0400 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0A318B; Wed, 2 Aug 2023 22:46:09 -0700 (PDT) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 3735jqBG099242; Thu, 3 Aug 2023 13:45:52 +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 4RGd7q47GTz2NtKNr; Thu, 3 Aug 2023 13:44:07 +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; Thu, 3 Aug 2023 13:45:50 +0800 From: Wenchao Chen To: CC: , , , , , , Wenchao Chen Subject: [PATCH] mmc: queue: replace immediate with hsq->depth Date: Thu, 3 Aug 2023 13:45:44 +0800 Message-ID: <20230803054544.22007-1-wenchao.chen@unisoc.com> X-Mailer: git-send-email 2.17.1 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 3735jqBG099242 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 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 | 7 +++++++ include/linux/mmc/host.h | 1 + 4 files changed, 10 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..7b3952721c17 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_MAX_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..795f6b9421d7 100644 --- a/drivers/mmc/host/mmc_hsq.h +++ b/drivers/mmc/host/mmc_hsq.h @@ -5,6 +5,13 @@ #define HSQ_NUM_SLOTS 64 #define HSQ_INVALID_TAG HSQ_NUM_SLOTS +/* + * For MMC host software queue, we usually allow 2 requests in + * flight to avoid a long latency. But we can adjust hsq->depth + * according to the actual situation. + */ +#define HSQ_MAX_DEPTH 2 + struct hsq_slot { struct mmc_request *mrq; }; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 461d1543893b..1fd8b1dd8698 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -520,6 +520,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