Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp56003ybv; Tue, 18 Feb 2020 17:37:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyjbG9fWSkf/5fYDLRmiiUpGQozM9ZiKY+51KNoi94zFQdJizrC0efuCYt2LC7IrzKyipJp X-Received: by 2002:aca:e084:: with SMTP id x126mr3078047oig.97.1582076269969; Tue, 18 Feb 2020 17:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582076269; cv=none; d=google.com; s=arc-20160816; b=qne4ebfPoENwkmUD+zdO2M7EXGjb9sx3X8ALhENx5ehQXtKpNlRSCciGYGWJlUuYWM aWyJnh/VFQ8PUlpll0dLQWmA8uvPDj2/i/f3w5kA2FQQyqajuWSuE2yoYT+Dla4mud3n 8HGZ62roAZZh4Pjc4811vVroNDvyHylTp8EuV7fwffwVfwZBvfP3yGq9QGZ71GlxgqI/ KsYOnCMf9HomR44Ys3qgGTBF3cqPhMixOSlVYRQ2P4KamtWRsUHTaRQyBvdREq4LaZNl rG/fXH/d8GDS9wTKEi8itX2BcsCv1b8ty4SDIMfTEgmgLynxDHKxUl3NpQKPa5QKtc7J ga+w== 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=Pl/cqzWuyTmXyZzngCzzDhrabf/785OFWKxb1h9GyR8=; b=MT4ONV97j/KrH+z6+prpbbgbpNln1LRFRlBaN9CrDaVrKqW7nL3G3cBK4iFAvFCnBk dHGxtGaQ81/h1ZPYROcN9Us5uJlD5I1b78TOtJo0MKA32TCz309mdNQfFph4i7SFfHfM cJ0kr6Bkizs1dnLHH5L/cN7JvtV2MJ8Pq1RNTD8hYcs7GjyW/dOQkhIykUerrorrnFKs sBrqjRUXqPZ6ogf1Msrj4uWgiOwHeef/R/Hq42ptBdLIUJAPhNKnikW9Q+ZfxUt+WMxs mYNQ6mCSGJt5zUbGGHbiOO0g3QWlFJRVR1g6Y0ustGcoORz+dLjDsJULPtrnzb6+Ec6Y FePA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m8ntYGF+; 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 y6si9083259oih.217.2020.02.18.17.37.37; Tue, 18 Feb 2020 17:37:49 -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=m8ntYGF+; 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 S1727845AbgBSBfy (ORCPT + 99 others); Tue, 18 Feb 2020 20:35:54 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:40156 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbgBSBfy (ORCPT ); Tue, 18 Feb 2020 20:35:54 -0500 Received: by mail-qk1-f194.google.com with SMTP id b7so21558861qkl.7; Tue, 18 Feb 2020 17:35:53 -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=Pl/cqzWuyTmXyZzngCzzDhrabf/785OFWKxb1h9GyR8=; b=m8ntYGF+2EqH0v2Bw3ITqZ1q2D0gep6YYtZZn2f9VZ7nXWxNzz4ktmKY5nrffHnoRq 7MENNScr86+fYh0v2TdlD1u7BOSEGuXpFs5lY5NJSJ6PGSRfuAn+wOeodkLbHOAtTYUK 2S/RLYE3VOX6v/20INuuGvNq7O3ZDrUPbLUgIXDQaLDRykCttA/UQ289hTiLqExzqM2Z O+HXoECmBylVH4v/D1WLKtUafd7hUuDIGwEotONwQKS20D686iiJhj1LwFEVZcpzvD6M oh3KewF/IcRMhY9EZcmLypnPOUfBFaoChku3XvUJcN0RPPH60ME0YpvIP+gcm89/UsyI giBw== 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=Pl/cqzWuyTmXyZzngCzzDhrabf/785OFWKxb1h9GyR8=; b=giiWOr10Uh7jWpvq/xL4W0+B2g5pvhF77b1jOvcEZsU8tZq4Ap0b8AaBvCayI59GnS UcdBi4yJoE1OAZSVnBBA2hH7eDfpdJC+yrrmEiTDKjXfm+r0ub65sBowzV/vXNB9vJQa LehoXuUSTzz564EymBNPe1bw2h8lDtWmqRlQAspZ8cBfN2J/YgPsaTsIqSgPDAQt9Bh1 5Cq5+GbPivMwq2K/I/pCxO+8o7hVpgSYrX0Q5D0lSy8pmcfVjpPX2hAyKwyQHjoOol0A 2YAQbV4K7Ln5+t+eicBNa4yA9WrMzqJm80AZazz96+PiyVjWfN5bJ7v89DC8sqNZ1wk5 h+tA== X-Gm-Message-State: APjAAAW037hAK484JLHTLnOdpQWD5j66EDxvHkmAc6VV0xGANX+6LQok DwvCKJ8p7HSQeD7as1fr3mRr7gYs3cjh+Jvhf2/2ZuV5 X-Received: by 2002:a37:b601:: with SMTP id g1mr21751270qkf.114.1582076150023; Tue, 18 Feb 2020 17:35:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Baolin Wang Date: Wed, 19 Feb 2020 09:35:29 +0800 Message-ID: Subject: Re: [PATCH v9 0/5] Add MMC 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 Wed, Feb 19, 2020 at 7:38 AM Ulf Hansson wrote: > > On Wed, 12 Feb 2020 at 05:14, Baolin Wang wrote: > > > > Hi All, > > > > 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. > > > > Thus this patch set will introduce the MMC software command queue support > > based on command queue engine's interfaces, and set the queue depth as 64 > > to allow more requests can be be prepared, merged and inserted into IO > > scheduler, 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. > > > > Moreover we can expand the MMC software queue interface to support > > MMC packed request or packed command instead of adding new interfaces, > > according to previosus discussion. > > > > Below are some comparison data with fio tool. The fio command I used > > is like below with changing the '--rw' parameter and enabling the direct > > IO flag to measure the actual hardware transfer speed in 4K block size. > > > > ./fio --filename=/dev/mmcblk0p30 --direct=1 --iodepth=20 --rw=read --bs=4K --size=1G --group_reporting --numjobs=20 --name=test_read > > > > My eMMC card working at HS400 Enhanced strobe mode: > > [ 2.229856] mmc0: new HS400 Enhanced strobe MMC card at address 0001 > > [ 2.237566] mmcblk0: mmc0:0001 HBG4a2 29.1 GiB > > [ 2.242621] mmcblk0boot0: mmc0:0001 HBG4a2 partition 1 4.00 MiB > > [ 2.249110] mmcblk0boot1: mmc0:0001 HBG4a2 partition 2 4.00 MiB > > [ 2.255307] mmcblk0rpmb: mmc0:0001 HBG4a2 partition 3 4.00 MiB, chardev (248:0) > > > > 1. Without MMC software queue > > I tested 5 times for each case and output a average speed. > > > > 1) Sequential read: > > Speed: 59.4MiB/s, 63.4MiB/s, 57.5MiB/s, 57.2MiB/s, 60.8MiB/s > > Average speed: 59.66MiB/s > > > > 2) Random read: > > Speed: 26.9MiB/s, 26.9MiB/s, 27.1MiB/s, 27.1MiB/s, 27.2MiB/s > > Average speed: 27.04MiB/s > > > > 3) Sequential write: > > Speed: 71.6MiB/s, 72.5MiB/s, 72.2MiB/s, 64.6MiB/s, 67.5MiB/s > > Average speed: 69.68MiB/s > > > > 4) Random write: > > Speed: 36.3MiB/s, 35.4MiB/s, 38.6MiB/s, 34MiB/s, 35.5MiB/s > > Average speed: 35.96MiB/s > > > > 2. With MMC software queue > > I tested 5 times for each case and output a average speed. > > > > 1) Sequential read: > > Speed: 59.2MiB/s, 60.4MiB/s, 63.6MiB/s, 60.3MiB/s, 59.9MiB/s > > Average speed: 60.68MiB/s > > > > 2) Random read: > > Speed: 31.3MiB/s, 31.4MiB/s, 31.5MiB/s, 31.3MiB/s, 31.3MiB/s > > Average speed: 31.36MiB/s > > > > 3) Sequential write: > > Speed: 71MiB/s, 71.8MiB/s, 72.3MiB/s, 72.2MiB/s, 71MiB/s > > Average speed: 71.66MiB/s > > > > 4) Random write: > > Speed: 68.9MiB/s, 68.7MiB/s, 68.8MiB/s, 68.6MiB/s, 68.8MiB/s > > Average speed: 68.76MiB/s > > > > Form above data, we can see the MMC software queue can help to improve some > > performance obviously for random read and write, though no obvious improvement > > for sequential read and write. > > > > Any comments are welcome. Thanks a lot. > > > > Changes from v8: > > - Add more description in the commit message. > > - Optimize the failure log when calling cqe_enable(). > > > > Changes from v7: > > - Add reviewed tag from Arnd. > > - Use the 'hsq' acronym for varibles and functions in the core layer. > > - Check the 'card->ext_csd.cmdq_en' in cqhci.c to make sure the CQE > > can work normally. > > - Add a new patch to enable the host software queue for the SD card. > > - Use the default MMC queue depth for host software queue. > > > > Changes from v6: > > - Change the patch order and set host->always_defer_done = true for the > > Spreadtrum host driver. > > > > Changes from v5: > > - Modify the condition of defering to complete request suggested by Adrian. > > > > Changes from v4: > > - Add a seperate patch to introduce a variable to defer to complete > > data requests for some host drivers, when using host software queue. > > > > Changes from v3: > > - Use host software queue instead of sqhci. > > - Fix random config building issue. > > - Change queue depth to 32, but still only allow 2 requests in flight. > > - Update the testing data. > > > > Changes from v2: > > - Remove reference to 'struct cqhci_host' and 'struct cqhci_slot', > > instead adding 'struct sqhci_host', which is only used by software queue. > > > > Changes from v1: > > - Add request_done ops for sdhci_ops. > > - Replace virtual command queue with software queue for functions and > > variables. > > - Rename the software queue file and add sqhci.h header file. > > > > Baolin Wang (5): > > mmc: Add MMC host software queue support > > mmc: core: Enable the MMC host software queue for the SD card > > mmc: host: sdhci: Add request_done ops for struct sdhci_ops > > mmc: host: sdhci: Add a variable to defer to complete requests if > > needed > > mmc: host: sdhci-sprd: Add software queue support > > > > drivers/mmc/core/block.c | 61 ++++++++ > > drivers/mmc/core/mmc.c | 18 ++- > > drivers/mmc/core/queue.c | 22 ++- > > drivers/mmc/core/sd.c | 10 ++ > > drivers/mmc/host/Kconfig | 8 + > > drivers/mmc/host/Makefile | 1 + > > drivers/mmc/host/cqhci.c | 8 +- > > drivers/mmc/host/mmc_hsq.c | 343 +++++++++++++++++++++++++++++++++++++++++ > > drivers/mmc/host/mmc_hsq.h | 30 ++++ > > drivers/mmc/host/sdhci-sprd.c | 28 ++++ > > drivers/mmc/host/sdhci.c | 14 +- > > drivers/mmc/host/sdhci.h | 3 + > > include/linux/mmc/host.h | 3 + > > 13 files changed, 534 insertions(+), 15 deletions(-) > > create mode 100644 drivers/mmc/host/mmc_hsq.c > > create mode 100644 drivers/mmc/host/mmc_hsq.h > > > > -- > > 1.7.9.5 > > > > Applied for next, thanks! Also, thanks for your patience while moving > forward during the reviews! I am very appreciated for you and Arnd's good sugestion when introducing the hsq. > > Note, I did some amending of patch1 to resolve some checkpatch > warnings. SPDX licence and Kconfig help texts, please have a look and > tell if there are something that doesn't look good. Thanks for your help and looks good to me.