Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2664643ybc; Mon, 18 Nov 2019 02:45:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyIEZnCzjVs2Pd8dH24IXY5r0pOoJdF0l4rg31DnyS2PSeVoJqQ+7wIXyz9Xyu7rxVj0mgB X-Received: by 2002:a17:907:20d2:: with SMTP id qq18mr25636995ejb.305.1574073912543; Mon, 18 Nov 2019 02:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574073912; cv=none; d=google.com; s=arc-20160816; b=fUMRafIZGewaXJEVuIm2F5apT8eu6oLi6o3T13jMKmQIJTy7ljaQ7VCmh9OBW+yGbI nmwraDxh9sqbR/C7v1p+dGzlLF2QIR3IBvHc2Me/liiK40GqqCz1byB/XZnftUt+qkjV nLsssbX4HEEK/kohmPNhjNwmUSygPrB038MkT+9yh8Ly3lmmLCqumRmxBXcKvwbSOXA4 YMjcvr77Gm5Dzpwhcs7T1TY32ezUEIN806bBbc4hbCsGol5K/wDIE/1AfJ/+ijsrrDWs yi/IZnuWVH17A8XRnAzgKOuwbukJXlrEr0jVtRRDbPCmr3xb9EnA6vG4kY8tW/R2vxK0 1H+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=YFWPz4VjngB4WcWRhp+GayJ3egNUwl75kCWknKTrpjA=; b=iOsNZU7QtoSSKa7hlWM9m+E70hPT+GCSROOZYTiO2bdJbZycW2mw26IdMearkpZhW9 SaZiUZ/iMgy+fzVdhj9Mcz4KknpJimg6PHg93ZPnLN1Ghh8TeW1zGwQDDSroqXcIX8Po vd3CtPUmySgGltTlkcXMwxeGqbuPJqk/XbiJJMKnhf1LLrSkSQbZ2gnq7K2FcaWJpver ooXiVZt8Oo2I5hXTrMunRBuO/RPPXaJJPyg3YOsdc65yiTYc4EXzAUFJt+6yjhNw6ZkS lP8BY8c/qn7BzbXV4xVH+407EEbuC62yrDJlS+efGHSgtCFAVoLrP4YsHF4sfDSURzmN eosA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=flTpeJ6I; 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 j10si11858631edq.394.2019.11.18.02.44.48; Mon, 18 Nov 2019 02:45:12 -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=flTpeJ6I; 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 S1726725AbfKRKnk (ORCPT + 99 others); Mon, 18 Nov 2019 05:43:40 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36300 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726490AbfKRKnk (ORCPT ); Mon, 18 Nov 2019 05:43:40 -0500 Received: by mail-pf1-f194.google.com with SMTP id b19so10210805pfd.3; Mon, 18 Nov 2019 02:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YFWPz4VjngB4WcWRhp+GayJ3egNUwl75kCWknKTrpjA=; b=flTpeJ6IGcAwrNK3w7KuN1nd1p+ugDvJ3J7ZfJEnJoSArZYNUQhnK1c26QNaJeo7M6 CiPubxYAJ4b144lL2jnjsixdjYA8iAygwrv44/uSgQ9nDTa2isMj+ynecpesNobPcfqZ 7Q7mg40I3jwqVgy6KOuRbt1kl+iCJtP9arpM8/uCob9f3lq3/ckgsvFCK5MxSf0xgF05 bXTUdDKM63g8W2Q2vRV9FcoF9dBqhcqQu2yzhXbl5NQmJCOsvUfp+fOe/K3IfXn+18Yg A+gu9TnK2QzEb54lW33h4ayr7Nj024gAB1VyVnHQokndIsiwP1qcYNp5zzFb8/bzOsr1 gXCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YFWPz4VjngB4WcWRhp+GayJ3egNUwl75kCWknKTrpjA=; b=AEWLRXGMr/nhVDW+06OO5athqjhwjAg1noa/e9folGMrf3lmgwkc909zA+yiimw2iJ mY0NeSB3TCmgW2Yqv8cD49duI6T/eEEW1qdu7GeKr5Rs1uYURiwdh9kjWfPs6SGoNB5N LmA4FgMBSTiaLRk+AddHr3gZ0BElDt2BftAxpTiNbFJ+XgqNe3NrZr9LmWg26+gu5ItQ LTjzdA74jcswU9MjsD6GDln6EPVJ4ahOXu4GHKF6fH3Sl5WSLFqhXZTL1BLfVcWZiOh2 ivswA2dFxU2w6FNOutQpsZhE7gIK6fF2uzF1+6zIPi59JBKJH1L+1ZwGAeuLWC6mxMXr VvGg== X-Gm-Message-State: APjAAAXfVGQ7JTAAhhUG9EWbLTw95104dM/e1upRDFcX78fBAaixGGy7 lRIWPzF9pVDS+yGIn7DgS5fKEDM2 X-Received: by 2002:a63:b24:: with SMTP id 36mr18677014pgl.30.1574073819212; Mon, 18 Nov 2019 02:43:39 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id c13sm19343905pfo.5.2019.11.18.02.43.35 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Nov 2019 02:43:38 -0800 (PST) From: Baolin Wang To: adrian.hunter@intel.com, ulf.hansson@linaro.org, asutoshd@codeaurora.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, arnd@arndb.de, linus.walleij@linaro.org, vincent.guittot@linaro.org, baolin.wang@linaro.org, baolin.wang7@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 0/4] Add MMC software queue support Date: Mon, 18 Nov 2019 18:43:18 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 32 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 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 (4): mmc: Add MMC host software queue support 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 | 13 +- drivers/mmc/core/queue.c | 33 +++- drivers/mmc/host/Kconfig | 8 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/mmc_hsq.c | 344 +++++++++++++++++++++++++++++++++++++++++ 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 + 11 files changed, 525 insertions(+), 13 deletions(-) create mode 100644 drivers/mmc/host/mmc_hsq.c create mode 100644 drivers/mmc/host/mmc_hsq.h -- 1.7.9.5