Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Seungwon Jeon <tgih.jun@samsung.com>
To: 'Will Newton' <will.newton@gmail.com>
Cc: linux-mmc@vger.kernel.org, cjb@laptop.org,
	'James Hogan' <james.hogan@imgtec.com>
Subject: RE: [RFC] mmc: dw_mmc: Fix the max_blk_count in IDMAC
Date: Tue, 28 Feb 2012 11:05:51 +0900	[thread overview]
Message-ID: <000101ccf5bd$7f17ec00$7d47c400$%jun@samsung.com> (raw)
In-Reply-To: <CAFbHwiRagAH7Hp6V6367CRfAxCBtC26OO19tAhCe6jUtAxb4Jw@mail.gmail.com>

Will Newton <will.newton@gmail.com> wrote:
> On Thu, Feb 23, 2012 at 11:58 PM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> > Will Newton <will.newton@gmail.com> wrote:
> >> 2012/2/23 Seungwon Jeon <tgih.jun@samsung.com>:
> >> > Hi all,
> >> >
> >> > Even though 1MB is reserved for descriptor table in IDMAC,
> >> > the dw_mmc host driver is allowed to receive only maximum
> >> > 128KB block length in one request. This is caused by setting
> >> > improper max_blk_count. It needs to be e adjusted so that
> >> > descriptor table is used fully.
> >> >
> >> > It is found that the performance is improved with the increased the
> >> > max_blk_count. In my case, there is 82%(6%) improvement in sequential
> >> > write(read). Is there anybody who knows the reason about the old setting?
> >> >
> >> > Best regards,
> >> > Seungwon Jeon.
> >> >
> >> > Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> >> > ---
> >> >  drivers/mmc/host/dw_mmc.c |    4 ++--
> >> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> >> > index bf3c9b4..af2b901 100644
> >> > --- a/drivers/mmc/host/dw_mmc.c
> >> > +++ b/drivers/mmc/host/dw_mmc.c
> >> > @@ -1804,9 +1804,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
> >> >  #ifdef CONFIG_MMC_DW_IDMAC
> >> >                mmc->max_segs = host->ring_size;
> >> >                mmc->max_blk_size = 65536;
> >> > -               mmc->max_blk_count = host->ring_size;
> >> >                mmc->max_seg_size = 0x1000;
> >> > -               mmc->max_req_size = mmc->max_seg_size * mmc->max_blk_count;
> >> > +               mmc->max_req_size = mmc->max_seg_size * host->ring_size;
> >> > +               mmc->max_blk_count = mmc->max_req_size / 512;
> >>
> >> I am not sure this is correct, it seems like most drivers calculate
> >> max_req_size like this:
> >>
> >> mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
> >
> > Could you explain the following origin code in dw_mmc?
> > We need to change like most other drivers?
> >  mmc->max_req_size = mmc->max_seg_size * mmc->max_blk_count;
> 
> All the other drivers seem to set max_req_size based on blk_size and
> blk_count not seg_size so the current code looks like it may be wrong.
Then, How can determine the blk_count?
max_req_size is a limitation which should be submitted to mmc stack.
dw_mmc can transfer the data as max_req_size with the DMA descriptors.
So I think max_seg_size and ring_size are good information for max_req_size in IDMAC
and current setting of mmc->max_req_size is fine.

> 
> >  - mmc->max_blk_count is set as host->ring_size.
> >  - max_seg_size seems to represent max_blk_size.
> 
> I believe max_seg_size should be set to a higher value as it appears
> to be only relevant for IOMMU-based drivers, possibly the same as
> max_req_size.
As we can refer kernel/block, several segments of max_seg_size make up
a request ,which has hardware sectors in the usual 512b unit.
Max hardware sectors can be offered to block layer like the following in drivers/mmc/card/queue.c.

	blk_queue_max_hw_sectors(mq->queue, min(host->max_blk_count, host->max_req_size / 512));

That means "host->max_blk_count" or "host->max_req_size / 512" decides the max request size.
So we need to set the proper max-blk_count. This RFC patch is intended for that.

Thanks,
Seungwon Jeon.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2012-02-28  2:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  7:26 [RFC] mmc: dw_mmc: Fix the max_blk_count in IDMAC Seungwon Jeon
2012-02-23 12:14 ` Will Newton
2012-02-23 23:58   ` Seungwon Jeon
2012-02-24 11:34     ` Will Newton
2012-02-28  2:05       ` Seungwon Jeon [this message]

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='000101ccf5bd$7f17ec00$7d47c400$%jun@samsung.com' \
    --to=tgih.jun@samsung.com \
    --cc=cjb@laptop.org \
    --cc=james.hogan@imgtec.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=will.newton@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox