Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4611869rwb; Tue, 8 Aug 2023 10:57:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnZd5a0eXKYZfGwgDksOej73qd3AcOnC5QcZzGqq37BFivWuEUbtbbiFigKdZxbken7jw/ X-Received: by 2002:a05:6a00:1a4b:b0:687:1706:e8bf with SMTP id h11-20020a056a001a4b00b006871706e8bfmr571238pfv.10.1691517471375; Tue, 08 Aug 2023 10:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691517471; cv=none; d=google.com; s=arc-20160816; b=fiuRBdOny++VRswgIi/avXzBPonZsE3CiIjS+5LpX/pOwerLvm8Dvx+G92GlbjgQHb AUPD5B/cpCDmAMNffZdJpvPMBmdVHo9vGRk+qulh6LIPn/fvjwHiTrPTmGLx6PkXERr5 2JCpFRIVfc3AN/RcCTaD6EPKUMvJQYhI29jJtDFrNfKTikPxmskeJgh+vfG4BlxYTVOe 5kVph4ONW9a1VfWIflL4A9jvL1BM8OPXMR+fmST3P9F242+DPMN5fKunrCsT16stZuSa 0hAnqG54uTFaueAX0FGbWYIjiLFDAPUQACtfVRfgZXpV340r/eBvhvebtZhsUs9hfODc 7iCg== 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=Ge4UpGsqgeWYVTzHHgiNtZ1FFA8wffVk7bme0ep5yV8=; fh=A5kY09BLbvewBIzL1adQfBYGBV/5lBWrujcs0htRnjk=; b=bI39pK3u+ZbtzRD4FMptk7j+mbLTu8+pNFsbvCbzYmtcrbXPKdsTl4EPL0jK8J/YjT Rk9FumMTO8tqUMw/7SVDzJr/8wB3pVQRxeoBq3Xt4ZFN1NdoeKNgMk7m32ASvDUkv+yD EPMZnXs9r1057jG4gAbGW6eIXdhlWxxJusRakg7N+LNMYbWXQbmUaLgh6aq/xuEZ83bR tdfdZroxQ7tgW2U/ydZVdKudoWSrZ8w4tTJaW7XXTfWkR6QHK1r7Ydyh5krsB3unarPx 1/nu64kd7HyC1qGMdIDxoe76FApoAWGxvci4Hlqjx0CpYMv4aQ+5lssZ+3SoMZaK7Ovt KI5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="F815O/mL"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u27-20020a63141b000000b0056383a7ddbcsi5132374pgl.103.2023.08.08.10.57.39; Tue, 08 Aug 2023 10:57:51 -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=@gmail.com header.s=20221208 header.b="F815O/mL"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233704AbjHHRLN (ORCPT + 99 others); Tue, 8 Aug 2023 13:11:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233971AbjHHRKo (ORCPT ); Tue, 8 Aug 2023 13:10:44 -0400 Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8CB1B531; Tue, 8 Aug 2023 09:04:24 -0700 (PDT) Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-585fd99ed8bso97769747b3.1; Tue, 08 Aug 2023 09:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691510661; x=1692115461; 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=Ge4UpGsqgeWYVTzHHgiNtZ1FFA8wffVk7bme0ep5yV8=; b=F815O/mLLDKqliVgjT/GxSLDKtwSKdQ/yDIInEaueB2N54jEGaRdqTajiSGARkkGsA u5X+yyOODshgYP8BotYsuP1TxJDHRlYoYooMkdiD7bEeHUp+oEtN7AvdagCkFXrORn5m DChd1+fUPE+ga+6P/m7EqcmtyfMr2GIVzvLWjoB7D3QN4l/P28cRc2bEP7iCeWi+1KXI lxEXKK+Ntt0vH+r9cJwGfFIP6Jx3B4p9y603lSHYs2E5oZ96nrxwMg4SAmVuIWXjaYM7 RtcQa8TaE8deeN/1fT7f/+tapQlp+FoMEvit/qFLBCt9fQaaBmwwzwNO22IjfQHzxk2g vibA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691510661; x=1692115461; 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=Ge4UpGsqgeWYVTzHHgiNtZ1FFA8wffVk7bme0ep5yV8=; b=HHkeLPiOWow8PXicXZrvAKmI0K/8K9G/8HHg+xteAyOrrE1nhw5W3EBoZSYCsdvO69 IXSQSlPgay62ZLeGNvqFynuWfpIO+J3LcmqDz7ibCwn/jttVMw+WavY2ZHrvQQ9N/bsS KpKgv976lnTOy1fjf+Dml0ivbPibCkSUZDiYC08EP2bitsMEjce2Ntun/WCdXhBOW9EJ B+U5fYOBUVMxg5CdNeSC96jl21ma3ccXavS4bckSaMiVsP7hEIMydy1bh2nAIRFGxp5R 9M6bHXXDCt+GQO4VkICIPfAyfMkZknS9A1dkjhUxmHtLKzIOYI9a3YuhwCzxPk3OwTCJ ilQg== X-Gm-Message-State: AOJu0YzrV5jz3pSAInKX3qub71q+Ky2otloxu6uHhofjTRkrsvMzy/yi 1rKUHcEiTek2Yzw3pk9NFhoJBBRFGtnPc2MAEYAz7ApnCL8= X-Received: by 2002:a0c:9a49:0:b0:63c:c72e:6762 with SMTP id q9-20020a0c9a49000000b0063cc72e6762mr10418001qvd.9.1691491300456; Tue, 08 Aug 2023 03:41:40 -0700 (PDT) MIME-Version: 1.0 References: <20230803054544.22007-1-wenchao.chen@unisoc.com> In-Reply-To: From: Wenchao Chen Date: Tue, 8 Aug 2023 18:41:28 +0800 Message-ID: Subject: Re: [PATCH] mmc: queue: replace immediate with hsq->depth To: Ulf Hansson 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.3 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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, Aug 8, 2023 at 5:28=E2=80=AFPM Ulf Hansson = wrote: > > On Thu, 3 Aug 2023 at 07:46, Wenchao Chen wrote= : > > > > 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 somewhere= ? > > Kind regards > Uffe > Hi Uffe, Depending on the mmc device, some devices allow host to send more reqs to the device. Also, we use hsq->hsq_depth instead of immediate number "2" to make the code easier to understand. 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_mq_= hw_ctx *hctx, > > } > > break; > > case MMC_ISSUE_ASYNC: > > - /* > > - * For MMC host software queue, we only allow 2 request= s 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] > ho= st->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_ho= st *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 > >