* [PATCH 0/5] mtd: test patches and bug fixes
@ 2011-02-08 10:02 Adrian Hunter
2011-02-08 10:02 ` [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read Adrian Hunter
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Adrian Hunter @ 2011-02-08 10:02 UTC (permalink / raw)
To: David Woodhouse
Cc: Kyungmin Park, Adrian Hunter, linux-mtd Mailing List,
Roman Tereshonkov, Artem Bityutskiy
Hi
Here are a couple of patches for MTD tests
and also a couple of OneNAND bug fixes.
Adrian Hunter (2):
mtd: OneNAND: return read error for 4KiB page read
mtd: tests: add count parameter to mtd_speedtest
Roman Tereshonkov (3):
mtd: tests: add multiblock erase test to the mtd_speedtest
mtd: tests : move ebcnt and pgcnt definitions before usage in printing.
mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address
drivers/mtd/onenand/onenand_base.c | 12 +++--
drivers/mtd/tests/mtd_speedtest.c | 74 +++++++++++++++++++++++++++++++++--
drivers/mtd/tests/mtd_subpagetest.c | 10 ++--
3 files changed, 82 insertions(+), 14 deletions(-)
Regards
Adrian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read
2011-02-08 10:02 [PATCH 0/5] mtd: test patches and bug fixes Adrian Hunter
@ 2011-02-08 10:02 ` Adrian Hunter
2011-02-08 10:21 ` Kyungmin Park
2011-02-08 10:02 ` [PATCH 2/5] mtd: tests: add count parameter to mtd_speedtest Adrian Hunter
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2011-02-08 10:02 UTC (permalink / raw)
To: David Woodhouse
Cc: Kyungmin Park, Adrian Hunter, linux-mtd Mailing List,
Roman Tereshonkov, Artem Bityutskiy
When reading using the 4KiB page read function, I/O
errors could be ignored if more than 1 page was read
at a time.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
drivers/mtd/onenand/onenand_base.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index bac41ca..38e6d76 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1132,6 +1132,8 @@ static int onenand_mlc_read_ops_nolock(struct mtd_info *mtd, loff_t from,
onenand_update_bufferram(mtd, from, !ret);
if (ret == -EBADMSG)
ret = 0;
+ if (ret)
+ break;
}
this->read_bufferram(mtd, ONENAND_DATARAM, buf, column, thislen);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] mtd: tests: add count parameter to mtd_speedtest
2011-02-08 10:02 [PATCH 0/5] mtd: test patches and bug fixes Adrian Hunter
2011-02-08 10:02 ` [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read Adrian Hunter
@ 2011-02-08 10:02 ` Adrian Hunter
2011-02-08 10:02 ` [PATCH 3/5] mtd: tests: add multiblock erase test to the mtd_speedtest Adrian Hunter
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Adrian Hunter @ 2011-02-08 10:02 UTC (permalink / raw)
To: David Woodhouse
Cc: Kyungmin Park, Adrian Hunter, linux-mtd Mailing List,
Roman Tereshonkov, Artem Bityutskiy
By default mtd_speedtest uses all the eraseblocks of the
MTD partition being tested. For large partitions a
smaller number is sufficient and makes running the test
quicker. For that reason, add a parameter 'count' to
specify the maximum number of eraseblocks to use for
testing.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
drivers/mtd/tests/mtd_speedtest.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c
index 161feeb..9bd986e 100644
--- a/drivers/mtd/tests/mtd_speedtest.c
+++ b/drivers/mtd/tests/mtd_speedtest.c
@@ -16,7 +16,7 @@
*
* Test read and write speed of a MTD device.
*
- * Author: Adrian Hunter <ext-adrian.hunter@nokia.com>
+ * Author: Adrian Hunter <adrian.hunter@nokia.com>
*/
#include <linux/init.h>
@@ -33,6 +33,11 @@ static int dev;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");
+static int count;
+module_param(count, int, S_IRUGO);
+MODULE_PARM_DESC(count, "Maximum number of eraseblocks to use "
+ "(0 means use all)");
+
static struct mtd_info *mtd;
static unsigned char *iobuf;
static unsigned char *bbt;
@@ -326,7 +331,10 @@ static int __init mtd_speedtest_init(void)
printk(KERN_INFO "\n");
printk(KERN_INFO "=================================================\n");
- printk(PRINT_PREF "MTD device: %d\n", dev);
+ if (count)
+ printk(PRINT_PREF "MTD device: %d count: %d\n", dev, count);
+ else
+ printk(PRINT_PREF "MTD device: %d\n", dev);
mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) {
@@ -353,6 +361,9 @@ static int __init mtd_speedtest_init(void)
(unsigned long long)mtd->size, mtd->erasesize,
pgsize, ebcnt, pgcnt, mtd->oobsize);
+ if (count > 0 && count < ebcnt)
+ ebcnt = count;
+
err = -ENOMEM;
iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
if (!iobuf) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] mtd: tests: add multiblock erase test to the mtd_speedtest
2011-02-08 10:02 [PATCH 0/5] mtd: test patches and bug fixes Adrian Hunter
2011-02-08 10:02 ` [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read Adrian Hunter
2011-02-08 10:02 ` [PATCH 2/5] mtd: tests: add count parameter to mtd_speedtest Adrian Hunter
@ 2011-02-08 10:02 ` Adrian Hunter
2011-02-08 10:02 ` [PATCH 4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing Adrian Hunter
2011-02-08 10:02 ` [PATCH 5/5] mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address Adrian Hunter
4 siblings, 0 replies; 9+ messages in thread
From: Adrian Hunter @ 2011-02-08 10:02 UTC (permalink / raw)
To: David Woodhouse
Cc: Kyungmin Park, Adrian Hunter, linux-mtd Mailing List,
Roman Tereshonkov, Artem Bityutskiy
From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
New multiblock erase speed test is added to mtd_speedtest.
It consists of 2-, 4-, 8-, 16-, 32- and 64-blocks at once
multiblock erase tests.
Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
---
drivers/mtd/tests/mtd_speedtest.c | 59 +++++++++++++++++++++++++++++++++++-
1 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c
index 9bd986e..3ce6fce 100644
--- a/drivers/mtd/tests/mtd_speedtest.c
+++ b/drivers/mtd/tests/mtd_speedtest.c
@@ -94,6 +94,33 @@ static int erase_eraseblock(int ebnum)
return 0;
}
+static int multiblock_erase(int ebnum, int blocks)
+{
+ int err;
+ struct erase_info ei;
+ loff_t addr = ebnum * mtd->erasesize;
+
+ memset(&ei, 0, sizeof(struct erase_info));
+ ei.mtd = mtd;
+ ei.addr = addr;
+ ei.len = mtd->erasesize * blocks;
+
+ err = mtd->erase(mtd, &ei);
+ if (err) {
+ printk(PRINT_PREF "error %d while erasing EB %d, blocks %d\n",
+ err, ebnum, blocks);
+ return err;
+ }
+
+ if (ei.state == MTD_ERASE_FAILED) {
+ printk(PRINT_PREF "some erase error occurred at EB %d,"
+ "blocks %d\n", ebnum, blocks);
+ return -EIO;
+ }
+
+ return 0;
+}
+
static int erase_whole_device(void)
{
int err;
@@ -292,7 +319,10 @@ static long calc_speed(void)
ms = (finish.tv_sec - start.tv_sec) * 1000 +
(finish.tv_usec - start.tv_usec) / 1000;
k = goodebcnt * mtd->erasesize / 1024;
- speed = (k * 1000) / ms;
+ if (ms)
+ speed = (k * 1000) / ms;
+ else
+ speed = 0;
return speed;
}
@@ -325,7 +355,7 @@ out:
static int __init mtd_speedtest_init(void)
{
- int err, i;
+ int err, i, blocks, j, k;
long speed;
uint64_t tmp;
@@ -495,6 +525,31 @@ static int __init mtd_speedtest_init(void)
speed = calc_speed();
printk(PRINT_PREF "erase speed is %ld KiB/s\n", speed);
+ /* Multi-block erase all eraseblocks */
+ for (k = 1; k < 7; k++) {
+ blocks = 1 << k;
+ printk(PRINT_PREF "Testing %dx multi-block erase speed\n",
+ blocks);
+ start_timing();
+ for (i = 0; i < ebcnt; ) {
+ for (j = 0; j < blocks && (i + j) < ebcnt; j++)
+ if (bbt[i + j])
+ break;
+ if (j < 1) {
+ i++;
+ continue;
+ }
+ err = multiblock_erase(i, j);
+ if (err)
+ goto out;
+ cond_resched();
+ i += j;
+ }
+ stop_timing();
+ speed = calc_speed();
+ printk(PRINT_PREF "%dx multi-block erase speed is %ld KiB/s\n",
+ blocks, speed);
+ }
printk(PRINT_PREF "finished\n");
out:
kfree(iobuf);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing.
2011-02-08 10:02 [PATCH 0/5] mtd: test patches and bug fixes Adrian Hunter
` (2 preceding siblings ...)
2011-02-08 10:02 ` [PATCH 3/5] mtd: tests: add multiblock erase test to the mtd_speedtest Adrian Hunter
@ 2011-02-08 10:02 ` Adrian Hunter
2011-02-11 14:22 ` Artem Bityutskiy
2011-02-08 10:02 ` [PATCH 5/5] mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address Adrian Hunter
4 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2011-02-08 10:02 UTC (permalink / raw)
To: David Woodhouse
Cc: Kyungmin Park, Adrian Hunter, linux-mtd Mailing List,
Roman Tereshonkov, Artem Bityutskiy
From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
ebcnt and pgcnt variable initialization is moved before printk which
uses them.
Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
---
drivers/mtd/tests/mtd_subpagetest.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c
index 11204e8..334eae5 100644
--- a/drivers/mtd/tests/mtd_subpagetest.c
+++ b/drivers/mtd/tests/mtd_subpagetest.c
@@ -394,6 +394,11 @@ static int __init mtd_subpagetest_init(void)
}
subpgsize = mtd->writesize >> mtd->subpage_sft;
+ tmp = mtd->size;
+ do_div(tmp, mtd->erasesize);
+ ebcnt = tmp;
+ pgcnt = mtd->erasesize / mtd->writesize;
+
printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
"page size %u, subpage size %u, count of eraseblocks %u, "
"pages per eraseblock %u, OOB size %u\n",
@@ -413,11 +418,6 @@ static int __init mtd_subpagetest_init(void)
goto out;
}
- tmp = mtd->size;
- do_div(tmp, mtd->erasesize);
- ebcnt = tmp;
- pgcnt = mtd->erasesize / mtd->writesize;
-
err = scan_for_bad_eraseblocks();
if (err)
goto out;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5] mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address
2011-02-08 10:02 [PATCH 0/5] mtd: test patches and bug fixes Adrian Hunter
` (3 preceding siblings ...)
2011-02-08 10:02 ` [PATCH 4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing Adrian Hunter
@ 2011-02-08 10:02 ` Adrian Hunter
2011-02-08 10:21 ` Kyungmin Park
4 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2011-02-08 10:02 UTC (permalink / raw)
To: David Woodhouse
Cc: Kyungmin Park, Adrian Hunter, linux-mtd Mailing List,
Roman Tereshonkov, Artem Bityutskiy
From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
In onenand_verify function the address can be writepage non-aligned.
When a page is read for comparing the right offset should be used
for "this->verify_buf" to get the right matching with compared
"buf" buffer.
Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
---
drivers/mtd/onenand/onenand_base.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 38e6d76..4205b94 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1648,11 +1648,10 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr,
int ret = 0;
int thislen, column;
+ column = addr & (this->writesize - 1);
+
while (len != 0) {
- thislen = min_t(int, this->writesize, len);
- column = addr & (this->writesize - 1);
- if (column + thislen > this->writesize)
- thislen = this->writesize - column;
+ thislen = min_t(int, this->writesize - column, len);
this->command(mtd, ONENAND_CMD_READ, addr, this->writesize);
@@ -1666,12 +1665,13 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr,
this->read_bufferram(mtd, ONENAND_DATARAM, this->verify_buf, 0, mtd->writesize);
- if (memcmp(buf, this->verify_buf, thislen))
+ if (memcmp(buf, this->verify_buf + column, thislen))
return -EBADMSG;
len -= thislen;
buf += thislen;
addr += thislen;
+ column = 0;
}
return 0;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5] mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address
2011-02-08 10:02 ` [PATCH 5/5] mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address Adrian Hunter
@ 2011-02-08 10:21 ` Kyungmin Park
0 siblings, 0 replies; 9+ messages in thread
From: Kyungmin Park @ 2011-02-08 10:21 UTC (permalink / raw)
To: Adrian Hunter
Cc: linux-mtd Mailing List, David Woodhouse, Roman Tereshonkov,
Artem Bityutskiy
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
On Tue, Feb 8, 2011 at 7:02 PM, Adrian Hunter <adrian.hunter@nokia.com> wrote:
> From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
>
> In onenand_verify function the address can be writepage non-aligned.
> When a page is read for comparing the right offset should be used
> for "this->verify_buf" to get the right matching with compared
> "buf" buffer.
>
> Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
> ---
> drivers/mtd/onenand/onenand_base.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
> index 38e6d76..4205b94 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -1648,11 +1648,10 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr,
> int ret = 0;
> int thislen, column;
>
> + column = addr & (this->writesize - 1);
> +
> while (len != 0) {
> - thislen = min_t(int, this->writesize, len);
> - column = addr & (this->writesize - 1);
> - if (column + thislen > this->writesize)
> - thislen = this->writesize - column;
> + thislen = min_t(int, this->writesize - column, len);
>
> this->command(mtd, ONENAND_CMD_READ, addr, this->writesize);
>
> @@ -1666,12 +1665,13 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr,
>
> this->read_bufferram(mtd, ONENAND_DATARAM, this->verify_buf, 0, mtd->writesize);
>
> - if (memcmp(buf, this->verify_buf, thislen))
> + if (memcmp(buf, this->verify_buf + column, thislen))
> return -EBADMSG;
>
> len -= thislen;
> buf += thislen;
> addr += thislen;
> + column = 0;
> }
>
> return 0;
> --
> 1.7.0.4
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read
2011-02-08 10:02 ` [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read Adrian Hunter
@ 2011-02-08 10:21 ` Kyungmin Park
0 siblings, 0 replies; 9+ messages in thread
From: Kyungmin Park @ 2011-02-08 10:21 UTC (permalink / raw)
To: Adrian Hunter
Cc: linux-mtd Mailing List, David Woodhouse, Roman Tereshonkov,
Artem Bityutskiy
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
On Tue, Feb 8, 2011 at 7:02 PM, Adrian Hunter <adrian.hunter@nokia.com> wrote:
> When reading using the 4KiB page read function, I/O
> errors could be ignored if more than 1 page was read
> at a time.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
> ---
> drivers/mtd/onenand/onenand_base.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
> index bac41ca..38e6d76 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -1132,6 +1132,8 @@ static int onenand_mlc_read_ops_nolock(struct mtd_info *mtd, loff_t from,
> onenand_update_bufferram(mtd, from, !ret);
> if (ret == -EBADMSG)
> ret = 0;
> + if (ret)
> + break;
> }
>
> this->read_bufferram(mtd, ONENAND_DATARAM, buf, column, thislen);
> --
> 1.7.0.4
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing.
2011-02-08 10:02 ` [PATCH 4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing Adrian Hunter
@ 2011-02-11 14:22 ` Artem Bityutskiy
0 siblings, 0 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2011-02-11 14:22 UTC (permalink / raw)
To: Adrian Hunter
Cc: linux-mtd Mailing List, Kyungmin Park, David Woodhouse,
Roman Tereshonkov
On Tue, 2011-02-08 at 12:02 +0200, Adrian Hunter wrote:
> From: Roman Tereshonkov <roman.tereshonkov@nokia.com>
>
> ebcnt and pgcnt variable initialization is moved before printk which
> uses them.
>
> Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
Pushed all patches to l2-mtd-2.6.git except of this one, because Roman
had already sent it and I already applied it.
Thanks!
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-02-11 14:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-08 10:02 [PATCH 0/5] mtd: test patches and bug fixes Adrian Hunter
2011-02-08 10:02 ` [PATCH 1/5] mtd: OneNAND: return read error for 4KiB page read Adrian Hunter
2011-02-08 10:21 ` Kyungmin Park
2011-02-08 10:02 ` [PATCH 2/5] mtd: tests: add count parameter to mtd_speedtest Adrian Hunter
2011-02-08 10:02 ` [PATCH 3/5] mtd: tests: add multiblock erase test to the mtd_speedtest Adrian Hunter
2011-02-08 10:02 ` [PATCH 4/5] mtd: tests : move ebcnt and pgcnt definitions before usage in printing Adrian Hunter
2011-02-11 14:22 ` Artem Bityutskiy
2011-02-08 10:02 ` [PATCH 5/5] mtd: onenand_base: onenand_verify bugfix for writepage non-aligned address Adrian Hunter
2011-02-08 10:21 ` Kyungmin Park
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).