From: J Freyensee <james_p_freyensee@linux.intel.com>
To: Per Forlin <per.forlin@linaro.org>
Cc: linaro-dev@lists.linaro.org,
Nicolas Pitre <nicolas.pitre@linaro.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-doc@vger.kernel.org, Venkatraman S <svenkatr@ti.com>,
Linus Walleij <linus.walleij@linaro.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
Arnd Bergmann <arnd@arndb.de>,
Sourav Poddar <sourav.poddar@ti.com>, Chris Ball <cjb@laptop.org>,
Randy Dunlap <rdunlap@xenotime.net>
Subject: Re: [PATCH v6] mmc: documentation of mmc non-blocking request usage and design.
Date: Mon, 11 Jul 2011 17:22:39 -0700 [thread overview]
Message-ID: <4E1B93CF.60700@linux.intel.com> (raw)
In-Reply-To: <1310325719-2151-1-git-send-email-per.forlin@linaro.org>
On 07/10/2011 12:21 PM, Per Forlin wrote:
> Documentation about the background and the design of mmc non-blocking.
> Host driver guidelines to minimize request preparation overhead.
>
> Signed-off-by: Per Forlin<per.forlin@linaro.org>
> Acked-by: Randy Dunlap<rdunlap@xenotime.net>
> ---
> ChangeLog:
> v2: - Minor updates after proofreading comments from Chris
> v3: - Minor updates after more comments from Chris
> v4: - Minor updates after comments from Randy
> v5: - Fixed one more comment and Acked-by from Randy
> v6: - Write out full function names and use () for all functions,
> feedback from James.
>
> Documentation/mmc/00-INDEX | 2 +
> Documentation/mmc/mmc-async-req.txt | 88 +++++++++++++++++++++++++++++++++++
> 2 files changed, 90 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/mmc/mmc-async-req.txt
>
> diff --git a/Documentation/mmc/00-INDEX b/Documentation/mmc/00-INDEX
> index 93dd7a7..a9ba672 100644
> --- a/Documentation/mmc/00-INDEX
> +++ b/Documentation/mmc/00-INDEX
> @@ -4,3 +4,5 @@ mmc-dev-attrs.txt
> - info on SD and MMC device attributes
> mmc-dev-parts.txt
> - info on SD and MMC device partitions
> +mmc-async-req.txt
> + - info on mmc asynchronous requests
> diff --git a/Documentation/mmc/mmc-async-req.txt b/Documentation/mmc/mmc-async-req.txt
> new file mode 100644
> index 0000000..aac5634
> --- /dev/null
> +++ b/Documentation/mmc/mmc-async-req.txt
> @@ -0,0 +1,88 @@
> +Rationale
> +=========
> +
> +How significant is the cache maintenance overhead?
> +It depends. Fast eMMC and multiple cache levels with speculative cache
> +pre-fetch makes the cache overhead relatively significant. If the DMA
> +preparations for the next request are done in parallel with the current
> +transfer, the DMA preparation overhead would not affect the MMC performance.
> +The intention of non-blocking (asynchronous) MMC requests is to minimize the
> +time between when an MMC request ends and another MMC request begins.
> +Using mmc_wait_for_req(), the MMC controller is idle while dma_map_sg and
> +dma_unmap_sg are processing. Using non-blocking MMC requests makes it
> +possible to prepare the caches for next job in parallel with an active
> +MMC request.
> +
> +MMC block driver
> +================
> +
> +The mmc_blk_issue_rw_rq() in the MMC block driver is made non-blocking.
> +The increase in throughput is proportional to the time it takes to
> +prepare (major part of preparations are dma_map_sg() and dma_unmap_sg())
> +a request and how fast the memory is. The faster the MMC/SD is
> +the more significant the prepare request time becomes. Roughly the expected
> +performance gain is 5% for large writes and 10% on large reads on a L2 cache
> +platform. In power save mode, when clocks run on a lower frequency, the DMA
> +preparation may cost even more. As long as these slower preparations are run
> +in parallel with the transfer performance won't be affected.
> +
> +Details on measurements from IOZone and mmc_test
> +================================================
> +
> +https://wiki.linaro.org/WorkingGroups/Kernel/Specs/StoragePerfMMC-async-req
> +
> +MMC core API extension
> +======================
> +
> +There is one new public function mmc_start_req().
> +It starts a new MMC command request for a host. The function isn't
> +truly non-blocking. If there is on ongoing async request it waits
> +for completion of that request and starts the new one and returns. It
> +doesn't wait for the new request to complete. If there is no ongoing
> +request it starts the new request and returns immediately.
> +
> +MMC host extensions
> +===================
> +
> +There are two optional members in the
> +mmc_host_ops -- pre_req() and post_req() -- that the host
> +driver may implement in order to move work to before and after the actual
> +mmc_host_ops.request() function is called. In the DMA case pre_req() may do
> +dma_map_sg() and prepare the DMA descriptor, and post_req() runs
> +the dma_unmap_sg().
> +
One question: Is the 'Optimize for the first request' below an example
of how to use the 'MMC host extensions' above? So just using
'mmc_start_req()' in an MMC client driver would not be beneficial if the
MMC host was not also using the MMC host extensions, right?
Thanks,
Jay
> +Optimize for the first request
> +==============================
> +
> +The first request in a series of requests can't be prepared in parallel with
> +the previous transfer, since there is no previous request.
> +The argument is_first_req in pre_req() indicates that there is no previous
> +request. The host driver may optimize for this scenario to minimize
> +the performance loss. A way to optimize for this is to split the current
> +request in two chunks, prepare the first chunk and start the request,
> +and finally prepare the second chunk and start the transfer.
> +
> +Pseudocode to handle is_first_req scenario with minimal prepare overhead:
> +
> +if (is_first_req&& req->size> threshold)
> + /* start MMC transfer for the complete transfer size */
> + mmc_start_command(MMC_CMD_TRANSFER_FULL_SIZE);
> +
> + /*
> + * Begin to prepare DMA while cmd is being processed by MMC.
> + * The first chunk of the request should take the same time
> + * to prepare as the "MMC process command time".
> + * If prepare time exceeds MMC cmd time
> + * the transfer is delayed, guesstimate max 4k as first chunk size.
> + */
> + prepare_1st_chunk_for_dma(req);
> + /* flush pending desc to the DMAC (dmaengine.h) */
> + dma_issue_pending(req->dma_desc);
> +
> + prepare_2nd_chunk_for_dma(req);
> + /*
> + * The second issue_pending should be called before MMC runs out
> + * of the first chunk. If the MMC runs out of the first data chunk
> + * before this call, the transfer is delayed.
> + */
> + dma_issue_pending(req->dma_desc);
WARNING: multiple messages have this Message-ID (diff)
From: james_p_freyensee@linux.intel.com (J Freyensee)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6] mmc: documentation of mmc non-blocking request usage and design.
Date: Mon, 11 Jul 2011 17:22:39 -0700 [thread overview]
Message-ID: <4E1B93CF.60700@linux.intel.com> (raw)
In-Reply-To: <1310325719-2151-1-git-send-email-per.forlin@linaro.org>
On 07/10/2011 12:21 PM, Per Forlin wrote:
> Documentation about the background and the design of mmc non-blocking.
> Host driver guidelines to minimize request preparation overhead.
>
> Signed-off-by: Per Forlin<per.forlin@linaro.org>
> Acked-by: Randy Dunlap<rdunlap@xenotime.net>
> ---
> ChangeLog:
> v2: - Minor updates after proofreading comments from Chris
> v3: - Minor updates after more comments from Chris
> v4: - Minor updates after comments from Randy
> v5: - Fixed one more comment and Acked-by from Randy
> v6: - Write out full function names and use () for all functions,
> feedback from James.
>
> Documentation/mmc/00-INDEX | 2 +
> Documentation/mmc/mmc-async-req.txt | 88 +++++++++++++++++++++++++++++++++++
> 2 files changed, 90 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/mmc/mmc-async-req.txt
>
> diff --git a/Documentation/mmc/00-INDEX b/Documentation/mmc/00-INDEX
> index 93dd7a7..a9ba672 100644
> --- a/Documentation/mmc/00-INDEX
> +++ b/Documentation/mmc/00-INDEX
> @@ -4,3 +4,5 @@ mmc-dev-attrs.txt
> - info on SD and MMC device attributes
> mmc-dev-parts.txt
> - info on SD and MMC device partitions
> +mmc-async-req.txt
> + - info on mmc asynchronous requests
> diff --git a/Documentation/mmc/mmc-async-req.txt b/Documentation/mmc/mmc-async-req.txt
> new file mode 100644
> index 0000000..aac5634
> --- /dev/null
> +++ b/Documentation/mmc/mmc-async-req.txt
> @@ -0,0 +1,88 @@
> +Rationale
> +=========
> +
> +How significant is the cache maintenance overhead?
> +It depends. Fast eMMC and multiple cache levels with speculative cache
> +pre-fetch makes the cache overhead relatively significant. If the DMA
> +preparations for the next request are done in parallel with the current
> +transfer, the DMA preparation overhead would not affect the MMC performance.
> +The intention of non-blocking (asynchronous) MMC requests is to minimize the
> +time between when an MMC request ends and another MMC request begins.
> +Using mmc_wait_for_req(), the MMC controller is idle while dma_map_sg and
> +dma_unmap_sg are processing. Using non-blocking MMC requests makes it
> +possible to prepare the caches for next job in parallel with an active
> +MMC request.
> +
> +MMC block driver
> +================
> +
> +The mmc_blk_issue_rw_rq() in the MMC block driver is made non-blocking.
> +The increase in throughput is proportional to the time it takes to
> +prepare (major part of preparations are dma_map_sg() and dma_unmap_sg())
> +a request and how fast the memory is. The faster the MMC/SD is
> +the more significant the prepare request time becomes. Roughly the expected
> +performance gain is 5% for large writes and 10% on large reads on a L2 cache
> +platform. In power save mode, when clocks run on a lower frequency, the DMA
> +preparation may cost even more. As long as these slower preparations are run
> +in parallel with the transfer performance won't be affected.
> +
> +Details on measurements from IOZone and mmc_test
> +================================================
> +
> +https://wiki.linaro.org/WorkingGroups/Kernel/Specs/StoragePerfMMC-async-req
> +
> +MMC core API extension
> +======================
> +
> +There is one new public function mmc_start_req().
> +It starts a new MMC command request for a host. The function isn't
> +truly non-blocking. If there is on ongoing async request it waits
> +for completion of that request and starts the new one and returns. It
> +doesn't wait for the new request to complete. If there is no ongoing
> +request it starts the new request and returns immediately.
> +
> +MMC host extensions
> +===================
> +
> +There are two optional members in the
> +mmc_host_ops -- pre_req() and post_req() -- that the host
> +driver may implement in order to move work to before and after the actual
> +mmc_host_ops.request() function is called. In the DMA case pre_req() may do
> +dma_map_sg() and prepare the DMA descriptor, and post_req() runs
> +the dma_unmap_sg().
> +
One question: Is the 'Optimize for the first request' below an example
of how to use the 'MMC host extensions' above? So just using
'mmc_start_req()' in an MMC client driver would not be beneficial if the
MMC host was not also using the MMC host extensions, right?
Thanks,
Jay
> +Optimize for the first request
> +==============================
> +
> +The first request in a series of requests can't be prepared in parallel with
> +the previous transfer, since there is no previous request.
> +The argument is_first_req in pre_req() indicates that there is no previous
> +request. The host driver may optimize for this scenario to minimize
> +the performance loss. A way to optimize for this is to split the current
> +request in two chunks, prepare the first chunk and start the request,
> +and finally prepare the second chunk and start the transfer.
> +
> +Pseudocode to handle is_first_req scenario with minimal prepare overhead:
> +
> +if (is_first_req&& req->size> threshold)
> + /* start MMC transfer for the complete transfer size */
> + mmc_start_command(MMC_CMD_TRANSFER_FULL_SIZE);
> +
> + /*
> + * Begin to prepare DMA while cmd is being processed by MMC.
> + * The first chunk of the request should take the same time
> + * to prepare as the "MMC process command time".
> + * If prepare time exceeds MMC cmd time
> + * the transfer is delayed, guesstimate max 4k as first chunk size.
> + */
> + prepare_1st_chunk_for_dma(req);
> + /* flush pending desc to the DMAC (dmaengine.h) */
> + dma_issue_pending(req->dma_desc);
> +
> + prepare_2nd_chunk_for_dma(req);
> + /*
> + * The second issue_pending should be called before MMC runs out
> + * of the first chunk. If the MMC runs out of the first data chunk
> + * before this call, the transfer is delayed.
> + */
> + dma_issue_pending(req->dma_desc);
next prev parent reply other threads:[~2011-07-12 0:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-10 19:21 [PATCH v6] mmc: documentation of mmc non-blocking request usage and design Per Forlin
2011-07-10 19:21 ` Per Forlin
2011-07-10 19:21 ` Per Forlin
2011-07-12 0:22 ` J Freyensee [this message]
2011-07-12 0:22 ` J Freyensee
2011-07-12 11:24 ` Per Forlin
2011-07-12 11:24 ` Per Forlin
2011-07-13 14:33 ` Chris Ball
2011-07-13 14:33 ` Chris Ball
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E1B93CF.60700@linux.intel.com \
--to=james_p_freyensee@linux.intel.com \
--cc=arnd@arndb.de \
--cc=cjb@laptop.org \
--cc=kyungmin.park@samsung.com \
--cc=linaro-dev@lists.linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=nicolas.pitre@linaro.org \
--cc=per.forlin@linaro.org \
--cc=rdunlap@xenotime.net \
--cc=sourav.poddar@ti.com \
--cc=svenkatr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.