From: per.forlin@linaro.org (Per Forlin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 11/11] mmc: add handling for two parallel block requests in issue_rw_rq
Date: Tue, 21 Jun 2011 23:01:10 +0200 [thread overview]
Message-ID: <BANLkTinZs4Jae84jFbfkfPCg31a4ba2m9g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=+di-5yciD7KVx3LySHVj-L1yfrg@mail.gmail.com>
On 20 June 2011 17:17, Kishore Kadiyala <kishorek.kadiyala@gmail.com> wrote:
> On Mon, Jun 20, 2011 at 2:47 AM, Per Forlin <per.forlin@linaro.org> wrote:
>> Change mmc_blk_issue_rw_rq() to become asynchronous.
>> The execution flow looks like this:
>> The mmc-queue calls issue_rw_rq(), which sends the request
>> to the host and returns back to the mmc-queue. The mmc-queue calls
>> issue_rw_rq() again with a new request. This new request is prepared,
>> in isuue_rw_rq(), then it waits for the active request to complete before
>> pushing it to the host. When to mmc-queue is empty it will call
>> isuue_rw_rq() with req=NULL to finish off the active request
>> without starting a new request.
>>
>> Signed-off-by: Per Forlin <per.forlin@linaro.org>
>> ---
>> ?drivers/mmc/card/block.c | ?121 +++++++++++++++++++++++++++++++++-------------
>> ?drivers/mmc/card/queue.c | ? 17 +++++--
>> ?drivers/mmc/card/queue.h | ? ?1 +
>> ?3 files changed, 101 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index 6a84a75..66db77a 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -108,6 +108,7 @@ static DEFINE_MUTEX(open_lock);
>>
>> ?enum mmc_blk_status {
>> ? ? ? ?MMC_BLK_SUCCESS = 0,
>> + ? ? ? MMC_BLK_PARTIAL,
>> ? ? ? ?MMC_BLK_RETRY,
>> ? ? ? ?MMC_BLK_DATA_ERR,
>> ? ? ? ?MMC_BLK_CMD_ERR,
>> @@ -668,14 +669,16 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
>> ? ? ? ?}
>> ?}
>>
>> -static enum mmc_blk_status mmc_blk_err_check(struct mmc_blk_request *brq,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct request *req,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct mmc_card *card,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct mmc_blk_data *md)
>> +static int mmc_blk_err_check(struct mmc_card *card,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct mmc_async_req *areq)
>> ?{
>> ? ? ? ?struct mmc_command cmd;
>> ? ? ? ?u32 status = 0;
>> ? ? ? ?enum mmc_blk_status ret = MMC_BLK_SUCCESS;
>> + ? ? ? struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmc_active);
>> + ? ? ? struct mmc_blk_request *brq = &mq_mrq->brq;
>> + ? ? ? struct request *req = mq_mrq->req;
>>
>> ? ? ? ?/*
>> ? ? ? ? * Check for errors here, but don't jump to cmd_err
>> @@ -770,7 +773,11 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_blk_request *brq,
>> ? ? ? ? ? ? ? ?else
>> ? ? ? ? ? ? ? ? ? ? ? ?ret = MMC_BLK_DATA_ERR;
>> ? ? ? ?}
>> -out:
>> +
>> + ? ? ? if (ret == MMC_BLK_SUCCESS &&
>> + ? ? ? ? ? blk_rq_bytes(req) != brq->data.bytes_xfered)
>> + ? ? ? ? ? ? ? ret = MMC_BLK_PARTIAL;
>> + out:
>> ? ? ? ?return ret;
>> ?}
>>
>> @@ -901,27 +908,59 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>> ? ? ? ? ? ? ? ?brq->data.sg_len = i;
>> ? ? ? ?}
>>
>> + ? ? ? mqrq->mmc_active.mrq = &brq->mrq;
>> + ? ? ? mqrq->mmc_active.err_check = mmc_blk_err_check;
>> +
>> ? ? ? ?mmc_queue_bounce_pre(mqrq);
>> ?}
>>
>> -static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
>> +static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
>> ?{
>> ? ? ? ?struct mmc_blk_data *md = mq->data;
>> ? ? ? ?struct mmc_card *card = md->queue.card;
>> - ? ? ? struct mmc_blk_request *brq = &mq->mqrq_cur->brq;
>> - ? ? ? int ret = 1, disable_multi = 0;
>> + ? ? ? struct mmc_blk_request *brq;
>> + ? ? ? int ret = 1;
>> + ? ? ? int disable_multi = 0;
>> ? ? ? ?enum mmc_blk_status status;
>> + ? ? ? struct mmc_queue_req *mq_rq;
>> + ? ? ? struct request *req;
>> + ? ? ? struct mmc_async_req *areq;
>> +
>> + ? ? ? if (!rqc && !mq->mqrq_prev->req)
>> + ? ? ? ? ? ? ? goto out;
>>
>> ? ? ? ?do {
>> - ? ? ? ? ? ? ? mmc_blk_rw_rq_prep(mq->mqrq_cur, card, disable_multi, mq);
>> - ? ? ? ? ? ? ? mmc_wait_for_req(card->host, &brq->mrq);
>> + ? ? ? ? ? ? ? if (rqc) {
>> + ? ? ? ? ? ? ? ? ? ? ? mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq);
>> + ? ? ? ? ? ? ? ? ? ? ? areq = &mq->mqrq_cur->mmc_active;
>> + ? ? ? ? ? ? ? } else
>> + ? ? ? ? ? ? ? ? ? ? ? areq = NULL;
>> + ? ? ? ? ? ? ? areq = mmc_start_req(card->host, areq, (int *) &status);
>
> I think 'status' is used uninitialized.
> With this struct mmc_async_req *mmc_start_req in your first patch
> if (error)
> ? ? ? ?*error = err;
> return data;
> condition which always passes.
It's valid to pass in NULL as status.
Do you suggest to make the status pointer mandatory?
>
> You can have
> enum mmc_blk_status status = MMC_BLK_SUCCESS;
>
status will be set to MMC_BLK_SUCCESS for the first iteration of the
do-while loop.
It may look like:
MMC_BLK_RETRY
MMC_BLK_PARTIAL
MMC_BLK_PARTIAL
MMC_BLK_PARTIAL
MMC_BLK_SUCCESS
This means mmc_start_req needs to return MMC_BLK_SUCCESS.
Regards,
Per
next prev parent reply other threads:[~2011-06-21 21:01 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-19 21:17 [PATCH v6 00/11] mmc: use nonblock mmc requests to minimize latency Per Forlin
2011-06-19 21:17 ` [PATCH v6 01/11] mmc: add non-blocking mmc request function Per Forlin
2011-06-19 21:17 ` [PATCH v6 02/11] omap_hsmmc: add support for pre_req and post_req Per Forlin
2011-06-21 5:41 ` Kishore Kadiyala
2011-06-21 6:51 ` Per Forlin
2011-06-21 13:56 ` Kishore Kadiyala
2011-06-21 19:18 ` Nicolas Pitre
2011-06-21 20:18 ` Per Forlin
2011-06-21 20:29 ` Nicolas Pitre
2011-06-19 21:17 ` [PATCH v6 03/11] mmci: implement pre_req() and post_req() Per Forlin
2011-06-19 21:17 ` [PATCH v6 04/11] mmc: mmc_test: add debugfs file to list all tests Per Forlin
2011-06-19 21:17 ` [PATCH v6 05/11] mmc: mmc_test: add test for non-blocking transfers Per Forlin
2011-06-19 21:17 ` [PATCH v6 06/11] mmc: add member in mmc queue struct to hold request data Per Forlin
2011-06-19 21:17 ` [PATCH v6 07/11] mmc: add a block request prepare function Per Forlin
2011-06-19 21:17 ` [PATCH v6 08/11] mmc: move error code in mmc_block_issue_rw_rq to a separate function Per Forlin
2011-06-19 21:17 ` [PATCH v6 09/11] mmc: add a second mmc queue request member Per Forlin
2011-06-19 21:17 ` [PATCH v6 10/11] mmc: test: add random fault injection in core.c Per Forlin
2011-06-19 21:17 ` [PATCH v6 11/11] mmc: add handling for two parallel block requests in issue_rw_rq Per Forlin
2011-06-20 15:17 ` Kishore Kadiyala
2011-06-21 6:40 ` Per Forlin
2011-06-21 7:05 ` Per Forlin
2011-06-21 13:52 ` Kishore Kadiyala
2011-06-21 21:01 ` Per Forlin [this message]
2011-06-21 7:14 ` Per Forlin
2011-06-21 7:53 ` [PATCH v6 00/11] mmc: use nonblock mmc requests to minimize latency Russell King - ARM Linux
2011-06-21 8:09 ` Per Forlin
2011-06-21 9:26 ` Per Forlin
2011-06-23 13:37 ` Russell King - ARM Linux
2011-06-24 8:58 ` Per Forlin
2011-06-27 9:42 ` Per Forlin
2011-06-27 10:02 ` Russell King - ARM Linux
2011-06-27 10:21 ` Per Forlin
2011-06-27 15:29 ` Linus Walleij
2011-06-27 16:34 ` Vijaya Kumar K-1
2011-06-27 10:34 ` saeed bishara
2011-06-27 11:02 ` Russell King - ARM Linux
2011-06-28 6:22 ` saeed bishara
2011-07-03 14:47 ` Russell King - ARM Linux
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=BANLkTinZs4Jae84jFbfkfPCg31a4ba2m9g@mail.gmail.com \
--to=per.forlin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).