Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4674617rwb; Tue, 8 Aug 2023 11:56:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9D+urN+0ssJTZKt3MP2xmtmLP3W+hau9aeNKPLQW1g1qvybU9yYyM/OfJJMsW7kLKYbHo X-Received: by 2002:a17:903:2289:b0:1b8:400a:48f2 with SMTP id b9-20020a170903228900b001b8400a48f2mr682416plh.62.1691520980608; Tue, 08 Aug 2023 11:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691520980; cv=none; d=google.com; s=arc-20160816; b=VcHGe2bqZ5dp+rJuLu8/PWqimO0fryadkHAQ3GXliJVS8dhRoM5uA86+Q6aVUnFhz5 mdCkByHbZPGgs9Ai9rwF4laaHJYk0vnj7ve19l+XWNA9WO3t1XSj/lTysNxG6dj7kEQs hU/mnYZaEA97ljaNeQVWsUdjWIyTumW83ZpVGzKp6FeLw+p1bQj0V7hw9C6zOc5YnvI7 zL8RzfQSAxL4TgIRypj7YjjeLRf45MZf2zLzb7uGv9A9CWF29JV4Q+7Wij0EyIXqRN2B P4qZvMHJP5Ex08AMfo6ZeonwKLf/+7rOVd1vVUI9RutnEngNXSssICtvZ9R2mCfqSwls Tzsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=JsX16JaE/dN4gOylJbVE7fA44TuS5QnBc2EtJo4lrms=; fh=SGK99aVbGbRjZay0foHk34i66HXwge9altjL38JnzrA=; b=z3JVfAn9M14VRuCzhyz4/R5uxBPI7zj4RlWtKx459wLYdT8sds432rRaJnwW3Hysw9 HCKzuVzcTQIAJq6r2hGQaZHR9O5Wm8RTSgEhElPhEQbjp+DkK9wKGq2/jficODHGhqnX dmkBkxtqeMzmuyltrEjQp4g+AdzwcdxKgeLU4jGKz2zDdbslzPLSVjVhi3htaaL3lX7a Vg+dw6RFo9wRF2Kw3pYZvX8Xypaxz4ChvDozj+rQLF9NoQCNOkB9ktlH+ZrT1qGk53go Lzmm7UocS7tysavlSq4icVKw/ia7je4qrgmZ333wG1WCRtd98g3n5afbGHP7rSKX7KXy lTkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b2GlzASd; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a170902e81000b001b025aba9f2si7740700plg.22.2023.08.08.11.56.07; Tue, 08 Aug 2023 11:56:20 -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=@linaro.org header.s=google header.b=b2GlzASd; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbjHHRNv (ORCPT + 99 others); Tue, 8 Aug 2023 13:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234118AbjHHRND (ORCPT ); Tue, 8 Aug 2023 13:13:03 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 529D81BAE2 for ; Tue, 8 Aug 2023 09:05:31 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-76ca4f88215so354917285a.0 for ; Tue, 08 Aug 2023 09:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691510726; x=1692115526; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JsX16JaE/dN4gOylJbVE7fA44TuS5QnBc2EtJo4lrms=; b=b2GlzASdy7DBOrglpdUoZtOJwsrDI9Gd+EyHGESN0d9EVByLOvXFsC8evpanH1A/K2 W+6LX4yiesx88ny0/egZen0LCIxTIl1XB0uP0d67gUn6pZvoUQ4jfmCA2cUSdBCcjYFI sXhZpw1LqigAgY0qBaUHdMX6+YIPKTKSVoWnOeRdhx/l9HxkR0j90H5lqbowbU1ddtjX jJF9CXlo/+Sm8gGES3RfOt5/uQkPNVxeg2ZI9ebs6AAEguA4GDM35Ehg5OJBXjrHlNQ2 oAIFkBXKq41ilGBJLhs9KzdxlvovHIqzwdece8hP4TGMQNKTk5dB/sucHwcPWuSp5Xsf ZK4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691510726; x=1692115526; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JsX16JaE/dN4gOylJbVE7fA44TuS5QnBc2EtJo4lrms=; b=bir2v1ufzpTPc3ppfJSqHpMUmVXlD8RnPJWMYGe1Yp+PwWZDI8FTsb43S3dXp/cBJ2 92AJoJYr6BTyXeEWZEUXrdo9mC+7tf1bs3emygRIn3dH6bJ8g5anzyBQjFuokun5rWzO LeceFCDvBGUZCX8aJRYuICKu5ZTWT06N/olEU8c08/sOecUOx/HYQgs5ye5hEqkBd2tC wRqMrs/cCQtdEkd3tjAgCIwbs+EYHwpIcsCTKE4atN5soU8McFkF/CLmYRik3ytWwaw/ RPKRRdLXzSx/HTWfhlJggkUjj0EMNRxC0Dr0y7+tkBkTUyy2C9t2SGNeys0C3SDKOU9f vZaw== X-Gm-Message-State: AOJu0YxGYwNS0aT/xzECPkXJW2YF3pJk8JKsma0GLA1Of5wApmJQi5UB VA14vRY7nqNbBCPTMdsotwBoJbkqTPZAh+iKqnYauga6CrXLLu53+0U= X-Received: by 2002:a25:cc8a:0:b0:d09:544a:db1b with SMTP id l132-20020a25cc8a000000b00d09544adb1bmr14692730ybf.34.1691492228235; Tue, 08 Aug 2023 03:57:08 -0700 (PDT) MIME-Version: 1.0 References: <20230803054544.22007-1-wenchao.chen@unisoc.com> In-Reply-To: From: Ulf Hansson Date: Tue, 8 Aug 2023 12:56:32 +0200 Message-ID: Subject: Re: [PATCH] mmc: queue: replace immediate with hsq->depth To: Wenchao Chen Cc: Wenchao Chen , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, zhenxiong.lai@unisoc.com, chunyan.zhang@unisoc.com, yuelin.tang@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 Tue, 8 Aug 2023 at 12:41, Wenchao Chen wrote= : > > On Tue, Aug 8, 2023 at 5:28=E2=80=AFPM Ulf Hansson wrote: > > > > On Thu, 3 Aug 2023 at 07:46, Wenchao Chen wro= te: > > > > > > 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. > > > > Sorry, but I don't quite follow here. > > > > Are you planning to update the host->hsq_depth dynamically from somewhe= re? > > > > Kind regards > > Uffe > > > Hi Uffe, > Depending on the mmc device, some devices allow host to send more reqs > to the device. In that case, please add a patch for that too, to show how this is going to be useful. > Also, we use hsq->hsq_depth instead of immediate number "2" to make > the code easier to understand. Right, but we don't need a new member in struct mmc_host for that. We could just be checking HSQ_MAX_DEPTH instead. Kind regards Uffe > > Thanks > Wenchao.Chen > > > > > > 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_m= q_hw_ctx *hctx, > > > } > > > break; > > > case MMC_ISSUE_ASYNC: > > > - /* > > > - * For MMC host software queue, we only allow 2 reque= sts 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 =3D mmc; > > > hsq->mmc->cqe_private =3D hsq; > > > mmc->cqe_ops =3D &mmc_hsq_ops; > > > + mmc->hsq_depth =3D HSQ_MAX_DEPTH; > > > > > > for (i =3D 0; i < HSQ_NUM_SLOTS; i++) > > > hsq->tag_slot[i] =3D 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 > > >