From: Vitaly Wool <vwool@ru.mvista.com>
To: Vitaly Wool <vwool@ru.mvista.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH/RFC] HW ECC optimization
Date: Fri, 16 Dec 2005 12:31:59 +0300 [thread overview]
Message-ID: <43A2898F.5030205@ru.mvista.com> (raw)
In-Reply-To: <20051215122842.7ec739ca.vwool@ru.mvista.com>
So, if noone disagrees, I'm gonna commit that...
Vitaly
Vitaly Wool wrote:
>Hi,
>
>currently the whole page is being written for nand_write_oob in HW ECC case.
>This is done in order to support some HW ECC generators which need a whole page to be written to generate proper ECC. However, for most of those generators it's not necessary and it results in perfrormance penalty during OOB writes.
>Well, the patch inlined below presents a proof-of-concept approach for speeding this up. The main problem is how to distinguish between different types of HW ECC generators? I'm using SYNDROME flag for this purpose, although it may make sense to create a separate one.
>
>Anyway, here's some measurements with and w/o this patch applied on my 2k-page NAND.
>
>layout {data, oob, ecc, data, oob, ecc, data, oob, ecc, data, oob, ecc}, w/ the patch:
>root@192.168.3.101:~# time flash_eraseall -j /dev/mtd/3
>Erasing 128 Kibyte @ 12e0000 -- 99 % complete. Cleanmarker written at 12e0000.
>
>real 0m0.709s
>user 0m0.010s
>sys 0m0.350s
>
>layout {data, oob, ecc, data, oob, ecc, data, oob, ecc, data, oob, ecc}, w/o the patch:
>root@192.168.3.101:~# time flash_eraseall -j /dev/mtd/3
>Erasing 128 Kibyte @ 12e0000 -- 99 % complete. Cleanmarker written at 12e0000.
>
>real 0m0.811s
>user 0m0.000s
>sys 0m0.370s
>
>layout {data, oob, ecc, oob, ecc, oob, ecc, oob, ecc}, w/o the patch:
>root@192.168.3.101:~# ./xx.sh
>root@192.168.3.101:~# time flash_eraseall -j /dev/mtd/3
>Erasing 128 Kibyte @ 12e0000 -- 99 % complete. Cleanmarker written at 12e0000.
>
>real 0m0.849s
>user 0m0.000s
>sys 0m0.330s
>
>layout {data, oob, ecc, oob, ecc, oob, ecc, oob, ecc}, w/ the patch:
>root@192.168.3.101:~# time flash_eraseall -j /dev/mtd/3
>Erasing 128 Kibyte @ 12e0000 -- 99 % complete. Cleanmarker written at 12e0000.
>
>real 0m0.709s
>user 0m0.000s
>sys 0m0.340s
>
>Any comments are welcome.
>
>Vitaly
>
>--- drivers/mtd/nand/nand_base.c 2005-12-14 15:29:42.000000000 +0300
>+++ drivers/mtd/nand/nand_base.c 2005-12-14 21:37:47.324960872 +0300
>@@ -1948,7 +1948,7 @@
> }
> } else {
> int i = 0, j = 0;
>- int fflen = 0, ooblen = 0;
>+ int fflen = 0, old_fflen = 0, ooblen = 0;
>
> /* Write out desired data */
> this->cmdfunc (mtd, NAND_CMD_SEQIN, 0, page & this->pagemask);
>@@ -1957,9 +1957,27 @@
> for (j = 0; this->layout[j].length; j++) {
> switch (this->layout[j].type) {
> case ITEM_TYPE_DATA:
>- this->enable_hwecc(mtd, NAND_ECC_WRITE);
>- this->write_buf(mtd, ffchars, this->layout[j].length);
>- fflen += this->layout[j].length;
>+ if (this->options & NAND_HWECC_SYNDROME) {
>+ this->enable_hwecc(mtd, NAND_ECC_WRITE);
>+ this->write_buf(mtd, ffchars, this->layout[j].length);
>+ fflen += this->layout[j].length;
>+ } else {
>+ if (old_fflen < fflen) {
>+ this->cmdfunc (mtd, NAND_CMD_PAGEPROG, -1, -1);
>+ status = this->waitfunc (mtd, this, FL_WRITING);
>+ if (status & NAND_STATUS_FAIL) {
>+ DEBUG (MTD_DEBUG_LEVEL0, "%s: Failed write, page 0x%08x\n", __FUNCTION__, page);
>+ ret = -EIO;
>+ goto out;
>+ }
>+ }
>+ fflen += this->layout[j].length;
>+ if (this->options & NAND_BUSWIDTH_16 && (fflen + ooblen) & 1)
>+ this->cmdfunc (mtd, NAND_CMD_SEQIN, fflen + ooblen - 1, page & this->pagemask);
>+ else
>+ this->cmdfunc (mtd, NAND_CMD_SEQIN, fflen + ooblen, page & this->pagemask);
>+ old_fflen = fflen;
>+ }
> break;
>
> case ITEM_TYPE_ECC:
>
>
>______________________________________________________
>Linux MTD discussion mailing list
>http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
>
>
>
prev parent reply other threads:[~2005-12-16 9:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-15 9:28 [PATCH/RFC] HW ECC optimization Vitaly Wool
2005-12-16 9:31 ` Vitaly Wool [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=43A2898F.5030205@ru.mvista.com \
--to=vwool@ru.mvista.com \
--cc=linux-mtd@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