Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp5147707pjo; Tue, 11 Feb 2020 04:54:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyH41aplhRRPd83L6xVtUELuVVmKD0evfARKCJLffzPkvFN2+/PbWxFrU+DjpUmd1CkMTXD X-Received: by 2002:aca:1913:: with SMTP id l19mr2613838oii.47.1581425675688; Tue, 11 Feb 2020 04:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581425675; cv=none; d=google.com; s=arc-20160816; b=Fqw7b7IiX565YbW2g95bWqBCOPKXIcSyd3ifVwoNLGwfMaerAHT0vUKv2BK13QYK/U 7/MYlhVDizDtgzFYv18RbGEUdoUcMzWplT9T1oTrjJxcvRAYKoSXf0A3pM62qVboUvaK J8Is6QbiZzNyrJ4Er6o4oSQb7MuhtDha/1Bymi2tNTQNiE3Kb/WZ/0oZSRneqbO/S8us 7S7XDLw7gNp0s2y1hUN6E/TItUzikowGxOychiAD5y6tNyQtRxnEkOa1DBsre89XvayP k5/K+94QZyyoTTj7rAJuVa9PGHoU1fOkWff78vqejyDmRQgCJfrC5Twvws8BWMo31zRm 2ECQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=msU5D8ZEdFDxxqo3nG1mhJAEftZgJdXHg5DB8i9r690=; b=CevNG3LfZhY9N4f31EZsivdArFkKQFJjfj+IeD3t5RtsnmZ1NZwwMuk5wMpYj+N152 5i5v3YRudqOn1uhBcPnqdEsU3PUQCOOOcZxwvj113nrMTT+AIBL25lvKdo2xxrC69d4y AHuZVttAacEAUFsO9GfY3W1xStCd1JqT5d21J5c3bv71jcxLfB/x6Zr5RN6E4RitppAT H8MAfY9Bi56RExc0FdCmRKAEL9ozAuq05+0Lh0ex6KGyJiXFD4tW/6guO8vo2tldgkPG LQ0WygUeamsjMX94RhlXkAtxY1Ox12rrG8Pd4PbGc/oY49vK2EQoxDn8ZppK2yfNI+fa wTaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ccP7FtOi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k205si1719963oib.64.2020.02.11.04.54.23; Tue, 11 Feb 2020 04:54:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ccP7FtOi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728154AbgBKMwB (ORCPT + 99 others); Tue, 11 Feb 2020 07:52:01 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:46782 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbgBKMwB (ORCPT ); Tue, 11 Feb 2020 07:52:01 -0500 Received: by mail-qv1-f66.google.com with SMTP id y2so4878871qvu.13; Tue, 11 Feb 2020 04:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=msU5D8ZEdFDxxqo3nG1mhJAEftZgJdXHg5DB8i9r690=; b=ccP7FtOinfozM6R4vDJjCau6Npe4Tmqbkt8xc6j/l11pnNzuBm6vI5fsmdieL/ssPx 5d1ujsopUtmxY6FwQTj2bb6gY5H0LwU+T5AwI4TgaMsbfHI/lfKm2EDAeg9E8lMCa0y7 fRE2U1e8JQtiHHh7pYrOpk1lPZiAuoYhTxvXyoKUmZO4V9KFGJZViITCvqzc2z5F1xxM WMB23So0V3C1qOmHSwSuAUCUsTqrDPiDHP9lHB9DSNOF1ljTVmViEgkynESAdWxnq5PP +JlxFV/lo9K39OYXk314wrESa58rnFNKCm/PdSHxRnGdlZF3fOxkGX0oZqVW6AwR0oSq 8gzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=msU5D8ZEdFDxxqo3nG1mhJAEftZgJdXHg5DB8i9r690=; b=sjZ0G/+YaBa6SQeV+NmwxO4H7sZgTSf59BLDrnzTtlnkEXAZIl+3qTLBzylJnt4ANW LIC225f22RoL9yb9MBhHTXu0OHvSSqvouUx6+fu/iuaU7s6zUkYfNXf0s/ghR03lhKyQ lWSFyUEHUvJYxyBazLv/SiEpC2p+77yPnXgyuZG/DpYfE2snGl2v6T17fjuIfvfNRsv5 1KWx+Wg9jN8rGSvUjR0yrHlW0YUfKLxUqhZySc3lC2SbuUqDWqtuL70yxNXy3oa8tJ7h 6/eTq1CSqkzezRcGPxbNjoYLk05E9ysK2+Zyrf0CcWba4MGFIWuQPCLeROqjwjJ/218M W6ng== X-Gm-Message-State: APjAAAUB/BKJ/9WrfRWYhSOlZY5unq5U/gWwneFKf3/IsPsez0eRnqTr Bz3FRmXQu3N7wjuv5wSBdzCMBqwp0ZzlepCERAE= X-Received: by 2002:a0c:e34e:: with SMTP id a14mr14875544qvm.73.1581425520017; Tue, 11 Feb 2020 04:52:00 -0800 (PST) MIME-Version: 1.0 References: <3fd82478e82b19c72dddcc17c85313725aa13ff6.1580894083.git.baolin.wang7@gmail.com> In-Reply-To: From: Baolin Wang Date: Tue, 11 Feb 2020 20:51:48 +0800 Message-ID: Subject: Re: [PATCH v8 1/5] mmc: Add MMC host software queue support To: Ulf Hansson Cc: Adrian Hunter , Asutosh Das , Orson Zhai , Chunyan Zhang , Arnd Bergmann , Linus Walleij , Baolin Wang , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2020 at 5:45 PM Ulf Hansson wrote: > > On Wed, 5 Feb 2020 at 13:51, Baolin Wang wrote: > > > > From: Baolin Wang > > > > Now the MMC read/write stack will always wait for previous request is > > completed by mmc_blk_rw_wait(), before sending a new request to hardware, > > or queue a work to complete request, that will bring context switching > > overhead, especially for high I/O per second rates, to affect the IO > > performance. > > Would you mind adding some more context about the mmc_blk_rw_wait()? > Especially I want to make it clear that mmc_blk_rw_wait() is also used > to poll the card for busy completion for I/O writes, via sending > CMD13. Sure. > > > > > Thus this patch introduces MMC software queue interface based on the > > hardware command queue engine's interfaces, which is similar with the > > hardware command queue engine's idea, that can remove the context > > switching. Moreover we set the default queue depth as 64 for software > > queue, which allows more requests to be prepared, merged and inserted > > into IO scheduler to improve performance, but we only allow 2 requests > > in flight, that is enough to let the irq handler always trigger the > > next request without a context switch, as well as avoiding a long latency. > > I think it's important to clarify that to use this new interface, hsq, > the host controller/driver needs to support HW busy detection for I/O > operations. > > In other words, the host driver must not complete a data transfer > request, until after the card stops signals busy. This behaviour is > also required for "closed-ended-transmissions" with CMD23, as in this > path there is no CMD12 sent to complete the transfer, thus no R1B > response flag to trigger the HW busy detection behaviour in the > driver. Sure. > > > > > From the fio testing data in cover letter, we can see the software > > queue can improve some performance with 4K block size, increasing > > about 16% for random read, increasing about 90% for random write, > > though no obvious improvement for sequential read and write. > > > > Moreover we can expand the software queue interface to support MMC > > packed request or packed command in future. > > > > Reviewed-by: Arnd Bergmann > > Signed-off-by: Baolin Wang > > Signed-off-by: Baolin Wang > > --- > > [...] > > > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c > > index f6912de..7a9976f 100644 > > --- a/drivers/mmc/core/mmc.c > > +++ b/drivers/mmc/core/mmc.c > > @@ -1851,15 +1851,22 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, > > */ > > card->reenable_cmdq = card->ext_csd.cmdq_en; > > > > - if (card->ext_csd.cmdq_en && !host->cqe_enabled) { > > + if (host->cqe_ops && !host->cqe_enabled) { > > err = host->cqe_ops->cqe_enable(host, card); > > if (err) { > > pr_err("%s: Failed to enable CQE, error %d\n", > > mmc_hostname(host), err); > > This means we are going to start printing an error message for those > eMMCs that doesn't support command queuing, but the host supports > MMC_CAP2_CQE. > > Not sure how big of a problem this is, but another option is simply to > leave the logging of the *failures* to the host driver, rather than > doing it here. > > Oh well, feel free to change or leave this as is for now. We can > always change it on top, if needed. OK. I will move the failure log to cqe_enable() callback to keep the same logs' logic. Thanks. > > } else { > > host->cqe_enabled = true; > > - pr_info("%s: Command Queue Engine enabled\n", > > - mmc_hostname(host)); > > + > > + if (card->ext_csd.cmdq_en) { > > + pr_info("%s: Command Queue Engine enabled\n", > > + mmc_hostname(host)); > > + } else { > > + host->hsq_enabled = true; > > + pr_info("%s: Host Software Queue enabled\n", > > + mmc_hostname(host)); > > + } > > } > > } > > [...] > > Kind regards > Uffe