* [PATCH 1/2] mtd: torturetest: rewrite the erase-write-verify process into one block unit.
@ 2013-02-05 2:20 Huang Shijie
2013-02-05 2:20 ` [PATCH 2/2] mtd: torturetest: add the support for random data pattern Huang Shijie
0 siblings, 1 reply; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 2:20 UTC (permalink / raw)
To: dwmw2; +Cc: Huang Shijie, linux-mtd, linux-kernel, dedekind1
Rewrite the torture cycle, do the erase-write-verify process in
one block unit, not in several blocks unit.
This patch makes preparations for adding the rand data pattern support.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/tests/mtd_torturetest.c | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index c4cde1e..516cf66 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -313,21 +313,18 @@ static int __init tort_init(void)
int i;
void *patt;
- /* Erase all eraseblocks */
for (i = eb; i < eb + ebcnt; i++) {
if (bad_ebs[i - eb])
continue;
+
+ /* Erase all eraseblocks */
err = erase_eraseblock(i);
if (err)
goto out;
cond_resched();
- }
- /* Check if the eraseblocks contain only 0xFF bytes */
- if (check) {
- for (i = eb; i < eb + ebcnt; i++) {
- if (bad_ebs[i - eb])
- continue;
+ /* Check if the eraseblocks contain only 0xFF bytes */
+ if (check) {
err = check_eraseblock(i, patt_FF);
if (err) {
pr_info("verify failed"
@@ -336,12 +333,8 @@ static int __init tort_init(void)
}
cond_resched();
}
- }
- /* Write the pattern */
- for (i = eb; i < eb + ebcnt; i++) {
- if (bad_ebs[i - eb])
- continue;
+ /* Write the pattern */
if ((eb + erase_cycles) & 1)
patt = patt_5A5;
else
@@ -350,17 +343,9 @@ static int __init tort_init(void)
if (err)
goto out;
cond_resched();
- }
- /* Verify what we wrote */
- if (check) {
- for (i = eb; i < eb + ebcnt; i++) {
- if (bad_ebs[i - eb])
- continue;
- if ((eb + erase_cycles) & 1)
- patt = patt_5A5;
- else
- patt = patt_A5A;
+ /* Verify what we wrote */
+ if (check) {
err = check_eraseblock(i, patt);
if (err) {
pr_info("verify failed for %s"
--
1.7.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] mtd: torturetest: add the support for random data pattern
2013-02-05 2:20 [PATCH 1/2] mtd: torturetest: rewrite the erase-write-verify process into one block unit Huang Shijie
@ 2013-02-05 2:20 ` Huang Shijie
2013-02-05 8:05 ` Ricard Wanderlof
0 siblings, 1 reply; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 2:20 UTC (permalink / raw)
To: dwmw2; +Cc: Huang Shijie, linux-mtd, linux-kernel, dedekind1
Add a new module parameter 'pattern'. If it is set to zero,
we will use the 55/AA pattern to torture the nand blocks; if it is set
to a non-zero value, we will use the random data pattern.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/tests/mtd_torturetest.c | 72 ++++++++++++++++++++++++-----------
1 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index 516cf66..07655bc 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -32,6 +32,7 @@
#include <linux/mtd/mtd.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/random.h>
#define RETRIES 3
@@ -64,6 +65,11 @@ module_param(cycles_count, uint, S_IRUGO);
MODULE_PARM_DESC(cycles_count, "how many erase cycles to do "
"(infinite by default)");
+static int pattern;
+module_param(pattern, int, S_IRUGO);
+MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default), else for
+ the random pattern");
+
static struct mtd_info *mtd;
/* This buffer contains 0x555555...0xAAAAAA... pattern */
@@ -72,6 +78,8 @@ static unsigned char *patt_5A5;
static unsigned char *patt_A5A;
/* This buffer contains all 0xFF bytes */
static unsigned char *patt_FF;
+/* This buffer contains the random data. */
+static unsigned char *patt_rd;
/* This a temporary buffer is use when checking data */
static unsigned char *check_buf;
/* How many erase cycles were done */
@@ -228,6 +236,8 @@ static int __init tort_init(void)
pr_info("torturing just %d pages per eraseblock\n",
pgcnt);
pr_info("write verify %s\n", check ? "enabled" : "disabled");
+ pr_info("Test pattern is %s\n",
+ pattern ? "random data pattern" : "55/AA pattern");
mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) {
@@ -249,16 +259,24 @@ static int __init tort_init(void)
}
err = -ENOMEM;
- patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_5A5) {
- pr_err("error: cannot allocate memory\n");
- goto out_mtd;
- }
+ if (!pattern) {
+ patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_5A5) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_mtd;
+ }
- patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_A5A) {
- pr_err("error: cannot allocate memory\n");
- goto out_patt_5A5;
+ patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_A5A) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_5A5;
+ }
+ } else {
+ patt_rd = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_rd) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_rd;
+ }
}
patt_FF = kmalloc(mtd->erasesize, GFP_KERNEL);
@@ -277,13 +295,15 @@ static int __init tort_init(void)
/* Initialize patterns */
memset(patt_FF, 0xFF, mtd->erasesize);
- for (i = 0; i < mtd->erasesize / pgsize; i++) {
- if (!(i & 1)) {
- memset(patt_5A5 + i * pgsize, 0x55, pgsize);
- memset(patt_A5A + i * pgsize, 0xAA, pgsize);
- } else {
- memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
- memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ if (!pattern) {
+ for (i = 0; i < mtd->erasesize / pgsize; i++) {
+ if (!(i & 1)) {
+ memset(patt_5A5 + i * pgsize, 0x55, pgsize);
+ memset(patt_A5A + i * pgsize, 0xAA, pgsize);
+ } else {
+ memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
+ memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ }
}
}
@@ -335,10 +355,15 @@ static int __init tort_init(void)
}
/* Write the pattern */
- if ((eb + erase_cycles) & 1)
- patt = patt_5A5;
- else
- patt = patt_A5A;
+ if (!pattern) {
+ if ((eb + erase_cycles) & 1)
+ patt = patt_5A5;
+ else
+ patt = patt_A5A;
+ } else {
+ patt = patt_rd;
+ prandom_bytes(patt, mtd->erasesize);
+ }
err = write_pattern(i, patt);
if (err)
goto out;
@@ -350,8 +375,9 @@ static int __init tort_init(void)
if (err) {
pr_info("verify failed for %s"
" pattern\n",
- ((eb + erase_cycles) & 1) ?
- "0x55AA55..." : "0xAA55AA...");
+ pattern ? "random pattern" :
+ (((eb + erase_cycles) & 1) ?
+ "0x55AA55..." : "0xAA55AA..."));
goto out;
}
cond_resched();
@@ -386,6 +412,8 @@ out_patt_A5A:
kfree(patt_A5A);
out_patt_5A5:
kfree(patt_5A5);
+out_patt_rd:
+ kfree(patt_rd);
out_mtd:
put_mtd_device(mtd);
if (err)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] mtd: torturetest: add the support for random data pattern
2013-02-05 2:20 ` [PATCH 2/2] mtd: torturetest: add the support for random data pattern Huang Shijie
@ 2013-02-05 8:05 ` Ricard Wanderlof
2013-02-05 8:21 ` [PATCH v2] " Huang Shijie
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Ricard Wanderlof @ 2013-02-05 8:05 UTC (permalink / raw)
To: Huang Shijie
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
linux-kernel@vger.kernel.org, dedekind1@gmail.com
On Tue, 5 Feb 2013, Huang Shijie wrote:
> Add a new module parameter 'pattern'. If it is set to zero, we will use
> the 55/AA pattern to torture the nand blocks; if it is set to a non-zero
> value, we will use the random data pattern.
Not a big issue in any way, but if you're using a numeric parameter value
anyway, could not one use a range of the permissable values to set a seed
for the random generation, so that the test can be repeated with the same
set of random numbers?
Something like
0 => 55/AA
-1 => random
1 and up => random, specifying seed for random number generator.
> +MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default), else for
> + the random pattern");
I'd suggest something like "0 for 55/AA pattern (default), non-zero for
random pattern".
(Or "-1 for 55/AA pattern (default), else random; >=1 sets seed" if
changed according to the above).
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-02-05 8:05 ` Ricard Wanderlof
@ 2013-02-05 8:21 ` Huang Shijie
2013-02-05 9:48 ` Ricard Wanderlof
2013-02-13 10:37 ` Artem Bityutskiy
2013-02-05 8:21 ` [PATCH 2/2] " Huang Shijie
2013-02-05 8:30 ` [PATCH V3] " Huang Shijie
2 siblings, 2 replies; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 8:21 UTC (permalink / raw)
To: dwmw2; +Cc: ricard.wanderlof, Huang Shijie, linux-mtd, dedekind1
Add a new module parameter 'pattern'. The meaning of the pattern is:
(1) pattern == 0 for 55/AA pattern.
(2) pattern < 0 for random pattern.
(3) pattern > 0 for random pattern too, the value of the pattern is used
as the seed for the random generator.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
v1 --> v2:
add the seed support.
---
drivers/mtd/tests/mtd_torturetest.c | 82 +++++++++++++++++++++++++---------
1 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index 516cf66..5481c99 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -32,6 +32,7 @@
#include <linux/mtd/mtd.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/random.h>
#define RETRIES 3
@@ -64,6 +65,13 @@ module_param(cycles_count, uint, S_IRUGO);
MODULE_PARM_DESC(cycles_count, "how many erase cycles to do "
"(infinite by default)");
+static int pattern;
+module_param(pattern, int, S_IRUGO);
+MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
+ "less then 0 for random pattern;"
+ "greater then 0 for random too, "
+ "the value of the pattern is the seed.");
+
static struct mtd_info *mtd;
/* This buffer contains 0x555555...0xAAAAAA... pattern */
@@ -72,6 +80,8 @@ static unsigned char *patt_5A5;
static unsigned char *patt_A5A;
/* This buffer contains all 0xFF bytes */
static unsigned char *patt_FF;
+/* This buffer contains the random data. */
+static unsigned char *patt_rd;
/* This a temporary buffer is use when checking data */
static unsigned char *check_buf;
/* How many erase cycles were done */
@@ -228,6 +238,12 @@ static int __init tort_init(void)
pr_info("torturing just %d pages per eraseblock\n",
pgcnt);
pr_info("write verify %s\n", check ? "enabled" : "disabled");
+ if (pattern == 0)
+ pr_info("Test pattern is 55/AA.\n");
+ else if (pattern < 0)
+ pr_info("Test pattern is random.\n");
+ else
+ pr_info("Test pattern is random, seed is 0x%d.\n", pattern);
mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) {
@@ -249,16 +265,24 @@ static int __init tort_init(void)
}
err = -ENOMEM;
- patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_5A5) {
- pr_err("error: cannot allocate memory\n");
- goto out_mtd;
- }
+ if (!pattern) {
+ patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_5A5) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_mtd;
+ }
- patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_A5A) {
- pr_err("error: cannot allocate memory\n");
- goto out_patt_5A5;
+ patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_A5A) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_5A5;
+ }
+ } else {
+ patt_rd = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_rd) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_rd;
+ }
}
patt_FF = kmalloc(mtd->erasesize, GFP_KERNEL);
@@ -277,14 +301,20 @@ static int __init tort_init(void)
/* Initialize patterns */
memset(patt_FF, 0xFF, mtd->erasesize);
- for (i = 0; i < mtd->erasesize / pgsize; i++) {
- if (!(i & 1)) {
- memset(patt_5A5 + i * pgsize, 0x55, pgsize);
- memset(patt_A5A + i * pgsize, 0xAA, pgsize);
- } else {
- memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
- memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ if (!pattern) {
+ for (i = 0; i < mtd->erasesize / pgsize; i++) {
+ if (!(i & 1)) {
+ memset(patt_5A5 + i * pgsize, 0x55, pgsize);
+ memset(patt_A5A + i * pgsize, 0xAA, pgsize);
+ } else {
+ memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
+ memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ }
}
+ } else {
+ /* set the seed. */
+ if (pattern > 0)
+ prandom_seed(pattern);
}
/*
@@ -335,10 +365,15 @@ static int __init tort_init(void)
}
/* Write the pattern */
- if ((eb + erase_cycles) & 1)
- patt = patt_5A5;
- else
- patt = patt_A5A;
+ if (!pattern) {
+ if ((eb + erase_cycles) & 1)
+ patt = patt_5A5;
+ else
+ patt = patt_A5A;
+ } else {
+ patt = patt_rd;
+ prandom_bytes(patt, mtd->erasesize);
+ }
err = write_pattern(i, patt);
if (err)
goto out;
@@ -350,8 +385,9 @@ static int __init tort_init(void)
if (err) {
pr_info("verify failed for %s"
" pattern\n",
- ((eb + erase_cycles) & 1) ?
- "0x55AA55..." : "0xAA55AA...");
+ pattern ? "random pattern" :
+ (((eb + erase_cycles) & 1) ?
+ "0x55AA55..." : "0xAA55AA..."));
goto out;
}
cond_resched();
@@ -386,6 +422,8 @@ out_patt_A5A:
kfree(patt_A5A);
out_patt_5A5:
kfree(patt_5A5);
+out_patt_rd:
+ kfree(patt_rd);
out_mtd:
put_mtd_device(mtd);
if (err)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] mtd: torturetest: add the support for random data pattern
2013-02-05 8:05 ` Ricard Wanderlof
2013-02-05 8:21 ` [PATCH v2] " Huang Shijie
@ 2013-02-05 8:21 ` Huang Shijie
2013-02-05 8:30 ` [PATCH V3] " Huang Shijie
2 siblings, 0 replies; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 8:21 UTC (permalink / raw)
To: Ricard Wanderlof
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
linux-kernel@vger.kernel.org, dedekind1@gmail.com
于 2013年02月05日 16:05, Ricard Wanderlof 写道:
>
> On Tue, 5 Feb 2013, Huang Shijie wrote:
>
>> Add a new module parameter 'pattern'. If it is set to zero, we will
>> use the 55/AA pattern to torture the nand blocks; if it is set to a
>> non-zero value, we will use the random data pattern.
>
> Not a big issue in any way, but if you're using a numeric parameter
> value anyway, could not one use a range of the permissable values to
> set a seed for the random generation, so that the test can be repeated
> with the same set of random numbers?
It's ok to provide a seed to the mtd_torturetest.
>
> Something like
>
> 0 => 55/AA
> -1 => random
> 1 and up => random, specifying seed for random number generator.
>
I will add it in next version.
thanks for your review.
Huang Shijie
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH V3] mtd: torturetest: add the support for random data pattern
2013-02-05 8:05 ` Ricard Wanderlof
2013-02-05 8:21 ` [PATCH v2] " Huang Shijie
2013-02-05 8:21 ` [PATCH 2/2] " Huang Shijie
@ 2013-02-05 8:30 ` Huang Shijie
2013-02-05 9:06 ` [PATCH v4] " Huang Shijie
2 siblings, 1 reply; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 8:30 UTC (permalink / raw)
To: dwmw2; +Cc: ricard.wanderlof, Huang Shijie, linux-mtd, dedekind1
Add a new module parameter 'pattern'. The meaning of the pattern is:
(1) pattern == 0 for 55/AA pattern.
(2) pattern < 0 for random pattern.
(3) pattern > 0 for random pattern too, the value of the pattern is used
as the seed for the random generator.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
v1 --> v2:
add seed support.
v2 --> v3:
fix a type in pr_info
---
drivers/mtd/tests/mtd_torturetest.c | 82 +++++++++++++++++++++++++---------
1 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index 516cf66..051015d 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -32,6 +32,7 @@
#include <linux/mtd/mtd.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/random.h>
#define RETRIES 3
@@ -64,6 +65,13 @@ module_param(cycles_count, uint, S_IRUGO);
MODULE_PARM_DESC(cycles_count, "how many erase cycles to do "
"(infinite by default)");
+static int pattern;
+module_param(pattern, int, S_IRUGO);
+MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
+ "less then 0 for random pattern;"
+ "greater then 0 for random too, "
+ "the value of the pattern is the seed.");
+
static struct mtd_info *mtd;
/* This buffer contains 0x555555...0xAAAAAA... pattern */
@@ -72,6 +80,8 @@ static unsigned char *patt_5A5;
static unsigned char *patt_A5A;
/* This buffer contains all 0xFF bytes */
static unsigned char *patt_FF;
+/* This buffer contains the random data. */
+static unsigned char *patt_rd;
/* This a temporary buffer is use when checking data */
static unsigned char *check_buf;
/* How many erase cycles were done */
@@ -228,6 +238,12 @@ static int __init tort_init(void)
pr_info("torturing just %d pages per eraseblock\n",
pgcnt);
pr_info("write verify %s\n", check ? "enabled" : "disabled");
+ if (pattern == 0)
+ pr_info("Test pattern is 55/AA.\n");
+ else if (pattern < 0)
+ pr_info("Test pattern is random.\n");
+ else
+ pr_info("Test pattern is random, seed is 0x%x.\n", pattern);
mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) {
@@ -249,16 +265,24 @@ static int __init tort_init(void)
}
err = -ENOMEM;
- patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_5A5) {
- pr_err("error: cannot allocate memory\n");
- goto out_mtd;
- }
+ if (!pattern) {
+ patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_5A5) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_mtd;
+ }
- patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_A5A) {
- pr_err("error: cannot allocate memory\n");
- goto out_patt_5A5;
+ patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_A5A) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_5A5;
+ }
+ } else {
+ patt_rd = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_rd) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_rd;
+ }
}
patt_FF = kmalloc(mtd->erasesize, GFP_KERNEL);
@@ -277,14 +301,20 @@ static int __init tort_init(void)
/* Initialize patterns */
memset(patt_FF, 0xFF, mtd->erasesize);
- for (i = 0; i < mtd->erasesize / pgsize; i++) {
- if (!(i & 1)) {
- memset(patt_5A5 + i * pgsize, 0x55, pgsize);
- memset(patt_A5A + i * pgsize, 0xAA, pgsize);
- } else {
- memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
- memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ if (!pattern) {
+ for (i = 0; i < mtd->erasesize / pgsize; i++) {
+ if (!(i & 1)) {
+ memset(patt_5A5 + i * pgsize, 0x55, pgsize);
+ memset(patt_A5A + i * pgsize, 0xAA, pgsize);
+ } else {
+ memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
+ memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ }
}
+ } else {
+ /* set the seed. */
+ if (pattern > 0)
+ prandom_seed(pattern);
}
/*
@@ -335,10 +365,15 @@ static int __init tort_init(void)
}
/* Write the pattern */
- if ((eb + erase_cycles) & 1)
- patt = patt_5A5;
- else
- patt = patt_A5A;
+ if (!pattern) {
+ if ((eb + erase_cycles) & 1)
+ patt = patt_5A5;
+ else
+ patt = patt_A5A;
+ } else {
+ patt = patt_rd;
+ prandom_bytes(patt, mtd->erasesize);
+ }
err = write_pattern(i, patt);
if (err)
goto out;
@@ -350,8 +385,9 @@ static int __init tort_init(void)
if (err) {
pr_info("verify failed for %s"
" pattern\n",
- ((eb + erase_cycles) & 1) ?
- "0x55AA55..." : "0xAA55AA...");
+ pattern ? "random pattern" :
+ (((eb + erase_cycles) & 1) ?
+ "0x55AA55..." : "0xAA55AA..."));
goto out;
}
cond_resched();
@@ -386,6 +422,8 @@ out_patt_A5A:
kfree(patt_A5A);
out_patt_5A5:
kfree(patt_5A5);
+out_patt_rd:
+ kfree(patt_rd);
out_mtd:
put_mtd_device(mtd);
if (err)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4] mtd: torturetest: add the support for random data pattern
2013-02-05 8:30 ` [PATCH V3] " Huang Shijie
@ 2013-02-05 9:06 ` Huang Shijie
2013-02-13 11:26 ` Ezequiel Garcia
0 siblings, 1 reply; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 9:06 UTC (permalink / raw)
To: dwmw2; +Cc: ricard.wanderlof, Huang Shijie, linux-mtd, dedekind1
Add a new module parameter 'pattern'. The meaning of the pattern is:
(1) pattern == 0 for 55/AA pattern.
(2) pattern < 0 for random pattern.
(3) pattern > 0 for random pattern too, the value of the pattern is used
as the seed for the random generator.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
v1 --> v2:
add seed support.
v2 --> v3:
fix a type in pr_info
v3 --> v4:
fix a confusing description.
---
drivers/mtd/tests/mtd_torturetest.c | 82 +++++++++++++++++++++++++---------
1 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index 516cf66..671e8dd 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -32,6 +32,7 @@
#include <linux/mtd/mtd.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/random.h>
#define RETRIES 3
@@ -64,6 +65,13 @@ module_param(cycles_count, uint, S_IRUGO);
MODULE_PARM_DESC(cycles_count, "how many erase cycles to do "
"(infinite by default)");
+static int pattern;
+module_param(pattern, int, S_IRUGO);
+MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
+ "less then 0 for random pattern;"
+ "greater then 0 for random pattern too, "
+ "the value of the parameter is the seed.");
+
static struct mtd_info *mtd;
/* This buffer contains 0x555555...0xAAAAAA... pattern */
@@ -72,6 +80,8 @@ static unsigned char *patt_5A5;
static unsigned char *patt_A5A;
/* This buffer contains all 0xFF bytes */
static unsigned char *patt_FF;
+/* This buffer contains the random data. */
+static unsigned char *patt_rd;
/* This a temporary buffer is use when checking data */
static unsigned char *check_buf;
/* How many erase cycles were done */
@@ -228,6 +238,12 @@ static int __init tort_init(void)
pr_info("torturing just %d pages per eraseblock\n",
pgcnt);
pr_info("write verify %s\n", check ? "enabled" : "disabled");
+ if (pattern == 0)
+ pr_info("Test pattern is 55/AA.\n");
+ else if (pattern < 0)
+ pr_info("Test pattern is random.\n");
+ else
+ pr_info("Test pattern is random, seed is 0x%x.\n", pattern);
mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) {
@@ -249,16 +265,24 @@ static int __init tort_init(void)
}
err = -ENOMEM;
- patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_5A5) {
- pr_err("error: cannot allocate memory\n");
- goto out_mtd;
- }
+ if (!pattern) {
+ patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_5A5) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_mtd;
+ }
- patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (!patt_A5A) {
- pr_err("error: cannot allocate memory\n");
- goto out_patt_5A5;
+ patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_A5A) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_5A5;
+ }
+ } else {
+ patt_rd = kmalloc(mtd->erasesize, GFP_KERNEL);
+ if (!patt_rd) {
+ pr_err("error: cannot allocate memory\n");
+ goto out_patt_rd;
+ }
}
patt_FF = kmalloc(mtd->erasesize, GFP_KERNEL);
@@ -277,14 +301,20 @@ static int __init tort_init(void)
/* Initialize patterns */
memset(patt_FF, 0xFF, mtd->erasesize);
- for (i = 0; i < mtd->erasesize / pgsize; i++) {
- if (!(i & 1)) {
- memset(patt_5A5 + i * pgsize, 0x55, pgsize);
- memset(patt_A5A + i * pgsize, 0xAA, pgsize);
- } else {
- memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
- memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ if (!pattern) {
+ for (i = 0; i < mtd->erasesize / pgsize; i++) {
+ if (!(i & 1)) {
+ memset(patt_5A5 + i * pgsize, 0x55, pgsize);
+ memset(patt_A5A + i * pgsize, 0xAA, pgsize);
+ } else {
+ memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
+ memset(patt_A5A + i * pgsize, 0x55, pgsize);
+ }
}
+ } else {
+ /* set the seed. */
+ if (pattern > 0)
+ prandom_seed(pattern);
}
/*
@@ -335,10 +365,15 @@ static int __init tort_init(void)
}
/* Write the pattern */
- if ((eb + erase_cycles) & 1)
- patt = patt_5A5;
- else
- patt = patt_A5A;
+ if (!pattern) {
+ if ((eb + erase_cycles) & 1)
+ patt = patt_5A5;
+ else
+ patt = patt_A5A;
+ } else {
+ patt = patt_rd;
+ prandom_bytes(patt, mtd->erasesize);
+ }
err = write_pattern(i, patt);
if (err)
goto out;
@@ -350,8 +385,9 @@ static int __init tort_init(void)
if (err) {
pr_info("verify failed for %s"
" pattern\n",
- ((eb + erase_cycles) & 1) ?
- "0x55AA55..." : "0xAA55AA...");
+ pattern ? "random pattern" :
+ (((eb + erase_cycles) & 1) ?
+ "0x55AA55..." : "0xAA55AA..."));
goto out;
}
cond_resched();
@@ -386,6 +422,8 @@ out_patt_A5A:
kfree(patt_A5A);
out_patt_5A5:
kfree(patt_5A5);
+out_patt_rd:
+ kfree(patt_rd);
out_mtd:
put_mtd_device(mtd);
if (err)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-02-05 8:21 ` [PATCH v2] " Huang Shijie
@ 2013-02-05 9:48 ` Ricard Wanderlof
2013-02-05 10:01 ` Huang Shijie
2013-02-13 10:37 ` Artem Bityutskiy
1 sibling, 1 reply; 15+ messages in thread
From: Ricard Wanderlof @ 2013-02-05 9:48 UTC (permalink / raw)
To: Huang Shijie
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
dedekind1@gmail.com
On Tue, 5 Feb 2013, Huang Shijie wrote:
> Add a new module parameter 'pattern'. The meaning of the pattern is:
> (1) pattern == 0 for 55/AA pattern.
> (2) pattern < 0 for random pattern.
> (3) pattern > 0 for random pattern too, the value of the pattern is used
> as the seed for the random generator.
>
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ...
> +static int pattern;
> +module_param(pattern, int, S_IRUGO);
> +MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
> + "less then 0 for random pattern;"
> + "greater then 0 for random too, "
> + "the value of the pattern is the seed.");
^^^^^^^^ parameter ?
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-02-05 9:48 ` Ricard Wanderlof
@ 2013-02-05 10:01 ` Huang Shijie
0 siblings, 0 replies; 15+ messages in thread
From: Huang Shijie @ 2013-02-05 10:01 UTC (permalink / raw)
To: Ricard Wanderlof
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
dedekind1@gmail.com
于 2013年02月05日 17:48, Ricard Wanderlof 写道:
>
> On Tue, 5 Feb 2013, Huang Shijie wrote:
>
>> Add a new module parameter 'pattern'. The meaning of the pattern is:
>> (1) pattern == 0 for 55/AA pattern.
>> (2) pattern < 0 for random pattern.
>> (3) pattern > 0 for random pattern too, the value of the pattern is used
>> as the seed for the random generator.
>>
>> Signed-off-by: Huang Shijie <b32955@freescale.com>
>> ...
>> +static int pattern;
>> +module_param(pattern, int, S_IRUGO);
>> +MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
>> + "less then 0 for random pattern;"
>> + "greater then 0 for random too, "
>> + "the value of the pattern is the seed.");
> ^^^^^^^^ parameter ?
ok, thanks.
Huang Shijie
>
> /Ricard
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-02-05 8:21 ` [PATCH v2] " Huang Shijie
2013-02-05 9:48 ` Ricard Wanderlof
@ 2013-02-13 10:37 ` Artem Bityutskiy
2013-02-16 4:00 ` Huang Shijie
1 sibling, 1 reply; 15+ messages in thread
From: Artem Bityutskiy @ 2013-02-13 10:37 UTC (permalink / raw)
To: Huang Shijie; +Cc: ricard.wanderlof, linux-mtd, dwmw2
On Tue, 2013-02-05 at 16:21 +0800, Huang Shijie wrote:
> Add a new module parameter 'pattern'. The meaning of the pattern is:
> (1) pattern == 0 for 55/AA pattern.
> (2) pattern < 0 for random pattern.
> (3) pattern > 0 for random pattern too, the value of the pattern is used
> as the seed for the random generator.
Please, do not add parameters, make it simple - teach the test to use
both the old patterns plus additional cycles with random patterns.
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4] mtd: torturetest: add the support for random data pattern
2013-02-05 9:06 ` [PATCH v4] " Huang Shijie
@ 2013-02-13 11:26 ` Ezequiel Garcia
2013-02-16 4:01 ` Huang Shijie
0 siblings, 1 reply; 15+ messages in thread
From: Ezequiel Garcia @ 2013-02-13 11:26 UTC (permalink / raw)
To: Huang Shijie; +Cc: joe, ricard.wanderlof, dwmw2, linux-mtd, dedekind1
Hi Huang,
On Tue, Feb 05, 2013 at 05:06:39PM +0800, Huang Shijie wrote:
> Add a new module parameter 'pattern'. The meaning of the pattern is:
> (1) pattern == 0 for 55/AA pattern.
> (2) pattern < 0 for random pattern.
> (3) pattern > 0 for random pattern too, the value of the pattern is used
> as the seed for the random generator.
>
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
> v1 --> v2:
> add seed support.
>
> v2 --> v3:
> fix a type in pr_info
>
> v3 --> v4:
> fix a confusing description.
> ---
> drivers/mtd/tests/mtd_torturetest.c | 82 +++++++++++++++++++++++++---------
> 1 files changed, 60 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
> index 516cf66..671e8dd 100644
> --- a/drivers/mtd/tests/mtd_torturetest.c
> +++ b/drivers/mtd/tests/mtd_torturetest.c
> @@ -32,6 +32,7 @@
> #include <linux/mtd/mtd.h>
> #include <linux/slab.h>
> #include <linux/sched.h>
> +#include <linux/random.h>
>
> #define RETRIES 3
>
> @@ -64,6 +65,13 @@ module_param(cycles_count, uint, S_IRUGO);
> MODULE_PARM_DESC(cycles_count, "how many erase cycles to do "
> "(infinite by default)");
>
> +static int pattern;
> +module_param(pattern, int, S_IRUGO);
> +MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
> + "less then 0 for random pattern;"
> + "greater then 0 for random pattern too, "
> + "the value of the parameter is the seed.");
> +
> static struct mtd_info *mtd;
>
> /* This buffer contains 0x555555...0xAAAAAA... pattern */
> @@ -72,6 +80,8 @@ static unsigned char *patt_5A5;
> static unsigned char *patt_A5A;
> /* This buffer contains all 0xFF bytes */
> static unsigned char *patt_FF;
> +/* This buffer contains the random data. */
> +static unsigned char *patt_rd;
> /* This a temporary buffer is use when checking data */
> static unsigned char *check_buf;
> /* How many erase cycles were done */
> @@ -228,6 +238,12 @@ static int __init tort_init(void)
> pr_info("torturing just %d pages per eraseblock\n",
> pgcnt);
> pr_info("write verify %s\n", check ? "enabled" : "disabled");
> + if (pattern == 0)
> + pr_info("Test pattern is 55/AA.\n");
> + else if (pattern < 0)
> + pr_info("Test pattern is random.\n");
> + else
> + pr_info("Test pattern is random, seed is 0x%x.\n", pattern);
>
> mtd = get_mtd_device(NULL, dev);
> if (IS_ERR(mtd)) {
> @@ -249,16 +265,24 @@ static int __init tort_init(void)
> }
>
> err = -ENOMEM;
> - patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
> - if (!patt_5A5) {
> - pr_err("error: cannot allocate memory\n");
Once again: you don't want to print this message!
In case the kmalloc actually fails, your "cannot allocate memory"
message won't be of any use to anyone.
When the system gets out of memory it will print a lot
of more useful information, including a stack dump
(see warn_alloc_failed in mm/page_alloc.c).
Moreover, printing an unneeded message adds a string increasing kernel
size.
Joe Perches is massively removing this sort of printing,
and I'm sure he will appreciate if we stop adding them :-)
http://lkml.org/lkml/2013/2/11/364
> - goto out_mtd;
> - }
> + if (!pattern) {
> + patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
> + if (!patt_5A5) {
> + pr_err("error: cannot allocate memory\n");
ditto.
> + goto out_mtd;
> + }
>
> - patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
> - if (!patt_A5A) {
> - pr_err("error: cannot allocate memory\n");
ditto.
> - goto out_patt_5A5;
> + patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL);
> + if (!patt_A5A) {
> + pr_err("error: cannot allocate memory\n");
ditto.
> + goto out_patt_5A5;
> + }
> + } else {
> + patt_rd = kmalloc(mtd->erasesize, GFP_KERNEL);
> + if (!patt_rd) {
> + pr_err("error: cannot allocate memory\n");
ditto.
> + goto out_patt_rd;
> + }
> }
>
> patt_FF = kmalloc(mtd->erasesize, GFP_KERNEL);
> @@ -277,14 +301,20 @@ static int __init tort_init(void)
>
> /* Initialize patterns */
> memset(patt_FF, 0xFF, mtd->erasesize);
> - for (i = 0; i < mtd->erasesize / pgsize; i++) {
> - if (!(i & 1)) {
> - memset(patt_5A5 + i * pgsize, 0x55, pgsize);
> - memset(patt_A5A + i * pgsize, 0xAA, pgsize);
> - } else {
> - memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
> - memset(patt_A5A + i * pgsize, 0x55, pgsize);
> + if (!pattern) {
> + for (i = 0; i < mtd->erasesize / pgsize; i++) {
> + if (!(i & 1)) {
> + memset(patt_5A5 + i * pgsize, 0x55, pgsize);
> + memset(patt_A5A + i * pgsize, 0xAA, pgsize);
> + } else {
> + memset(patt_5A5 + i * pgsize, 0xAA, pgsize);
> + memset(patt_A5A + i * pgsize, 0x55, pgsize);
> + }
> }
> + } else {
> + /* set the seed. */
> + if (pattern > 0)
> + prandom_seed(pattern);
> }
>
> /*
> @@ -335,10 +365,15 @@ static int __init tort_init(void)
> }
>
> /* Write the pattern */
> - if ((eb + erase_cycles) & 1)
> - patt = patt_5A5;
> - else
> - patt = patt_A5A;
> + if (!pattern) {
> + if ((eb + erase_cycles) & 1)
> + patt = patt_5A5;
> + else
> + patt = patt_A5A;
> + } else {
> + patt = patt_rd;
> + prandom_bytes(patt, mtd->erasesize);
> + }
> err = write_pattern(i, patt);
> if (err)
> goto out;
> @@ -350,8 +385,9 @@ static int __init tort_init(void)
> if (err) {
> pr_info("verify failed for %s"
> " pattern\n",
> - ((eb + erase_cycles) & 1) ?
> - "0x55AA55..." : "0xAA55AA...");
> + pattern ? "random pattern" :
> + (((eb + erase_cycles) & 1) ?
> + "0x55AA55..." : "0xAA55AA..."));
> goto out;
> }
> cond_resched();
> @@ -386,6 +422,8 @@ out_patt_A5A:
> kfree(patt_A5A);
> out_patt_5A5:
> kfree(patt_5A5);
> +out_patt_rd:
> + kfree(patt_rd);
> out_mtd:
> put_mtd_device(mtd);
> if (err)
> --
> 1.7.0.4
>
>
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-02-13 10:37 ` Artem Bityutskiy
@ 2013-02-16 4:00 ` Huang Shijie
2013-03-02 14:44 ` Artem Bityutskiy
0 siblings, 1 reply; 15+ messages in thread
From: Huang Shijie @ 2013-02-16 4:00 UTC (permalink / raw)
To: dedekind1; +Cc: Huang Shijie, ricard.wanderlof, dwmw2, linux-mtd
On Wed, Feb 13, 2013 at 6:37 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Tue, 2013-02-05 at 16:21 +0800, Huang Shijie wrote:
>> Add a new module parameter 'pattern'. The meaning of the pattern is:
>> (1) pattern == 0 for 55/AA pattern.
>> (2) pattern < 0 for random pattern.
>> (3) pattern > 0 for random pattern too, the value of the pattern is used
>> as the seed for the random generator.
>
> Please, do not add parameters, make it simple - teach the test to use
> both the old patterns plus additional cycles with random patterns.
but if we do not add new parameter, how can we create a random seed?
Is it ok without set the random seed?
thanks
Huang Shijie
>
> --
> Best Regards,
> Artem Bityutskiy
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4] mtd: torturetest: add the support for random data pattern
2013-02-13 11:26 ` Ezequiel Garcia
@ 2013-02-16 4:01 ` Huang Shijie
0 siblings, 0 replies; 15+ messages in thread
From: Huang Shijie @ 2013-02-16 4:01 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: ricard.wanderlof, dedekind1, Huang Shijie, linux-mtd, joe, dwmw2
On Wed, Feb 13, 2013 at 7:26 PM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:
> Hi Huang,
>
> On Tue, Feb 05, 2013 at 05:06:39PM +0800, Huang Shijie wrote:
>> Add a new module parameter 'pattern'. The meaning of the pattern is:
>> (1) pattern == 0 for 55/AA pattern.
>> (2) pattern < 0 for random pattern.
>> (3) pattern > 0 for random pattern too, the value of the pattern is used
>> as the seed for the random generator.
>>
>> Signed-off-by: Huang Shijie <b32955@freescale.com>
>> ---
>> v1 --> v2:
>> add seed support.
>>
>> v2 --> v3:
>> fix a type in pr_info
>>
>> v3 --> v4:
>> fix a confusing description.
>> ---
>> drivers/mtd/tests/mtd_torturetest.c | 82 +++++++++++++++++++++++++---------
>> 1 files changed, 60 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
>> index 516cf66..671e8dd 100644
>> --- a/drivers/mtd/tests/mtd_torturetest.c
>> +++ b/drivers/mtd/tests/mtd_torturetest.c
>> @@ -32,6 +32,7 @@
>> #include <linux/mtd/mtd.h>
>> #include <linux/slab.h>
>> #include <linux/sched.h>
>> +#include <linux/random.h>
>>
>> #define RETRIES 3
>>
>> @@ -64,6 +65,13 @@ module_param(cycles_count, uint, S_IRUGO);
>> MODULE_PARM_DESC(cycles_count, "how many erase cycles to do "
>> "(infinite by default)");
>>
>> +static int pattern;
>> +module_param(pattern, int, S_IRUGO);
>> +MODULE_PARM_DESC(pattern, "0 for 55/AA pattern(default);"
>> + "less then 0 for random pattern;"
>> + "greater then 0 for random pattern too, "
>> + "the value of the parameter is the seed.");
>> +
>> static struct mtd_info *mtd;
>>
>> /* This buffer contains 0x555555...0xAAAAAA... pattern */
>> @@ -72,6 +80,8 @@ static unsigned char *patt_5A5;
>> static unsigned char *patt_A5A;
>> /* This buffer contains all 0xFF bytes */
>> static unsigned char *patt_FF;
>> +/* This buffer contains the random data. */
>> +static unsigned char *patt_rd;
>> /* This a temporary buffer is use when checking data */
>> static unsigned char *check_buf;
>> /* How many erase cycles were done */
>> @@ -228,6 +238,12 @@ static int __init tort_init(void)
>> pr_info("torturing just %d pages per eraseblock\n",
>> pgcnt);
>> pr_info("write verify %s\n", check ? "enabled" : "disabled");
>> + if (pattern == 0)
>> + pr_info("Test pattern is 55/AA.\n");
>> + else if (pattern < 0)
>> + pr_info("Test pattern is random.\n");
>> + else
>> + pr_info("Test pattern is random, seed is 0x%x.\n", pattern);
>>
>> mtd = get_mtd_device(NULL, dev);
>> if (IS_ERR(mtd)) {
>> @@ -249,16 +265,24 @@ static int __init tort_init(void)
>> }
>>
>> err = -ENOMEM;
>> - patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL);
>> - if (!patt_5A5) {
>> - pr_err("error: cannot allocate memory\n");
>
> Once again: you don't want to print this message!
> In case the kmalloc actually fails, your "cannot allocate memory"
> message won't be of any use to anyone.
>
got it.
thanks.
Huang Shijie
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-02-16 4:00 ` Huang Shijie
@ 2013-03-02 14:44 ` Artem Bityutskiy
2013-03-04 2:29 ` Huang Shijie
0 siblings, 1 reply; 15+ messages in thread
From: Artem Bityutskiy @ 2013-03-02 14:44 UTC (permalink / raw)
To: Huang Shijie; +Cc: Huang Shijie, ricard.wanderlof, dwmw2, linux-mtd
On Sat, 2013-02-16 at 12:00 +0800, Huang Shijie wrote:
> On Wed, Feb 13, 2013 at 6:37 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> > On Tue, 2013-02-05 at 16:21 +0800, Huang Shijie wrote:
> >> Add a new module parameter 'pattern'. The meaning of the pattern is:
> >> (1) pattern == 0 for 55/AA pattern.
> >> (2) pattern < 0 for random pattern.
> >> (3) pattern > 0 for random pattern too, the value of the pattern is used
> >> as the seed for the random generator.
> >
> > Please, do not add parameters, make it simple - teach the test to use
> > both the old patterns plus additional cycles with random patterns.
>
> but if we do not add new parameter, how can we create a random seed?
Unless you have a real practical reason to let users pass the initial
random seed, do not do this.
> Is it ok without set the random seed?
I think so.
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] mtd: torturetest: add the support for random data pattern
2013-03-02 14:44 ` Artem Bityutskiy
@ 2013-03-04 2:29 ` Huang Shijie
0 siblings, 0 replies; 15+ messages in thread
From: Huang Shijie @ 2013-03-04 2:29 UTC (permalink / raw)
To: dedekind1; +Cc: ricard.wanderlof, Huang Shijie, dwmw2, linux-mtd
于 2013年03月02日 22:44, Artem Bityutskiy 写道:
> On Sat, 2013-02-16 at 12:00 +0800, Huang Shijie wrote:
>> On Wed, Feb 13, 2013 at 6:37 PM, Artem Bityutskiy<dedekind1@gmail.com> wrote:
>>> On Tue, 2013-02-05 at 16:21 +0800, Huang Shijie wrote:
>>>> Add a new module parameter 'pattern'. The meaning of the pattern is:
>>>> (1) pattern == 0 for 55/AA pattern.
>>>> (2) pattern< 0 for random pattern.
>>>> (3) pattern> 0 for random pattern too, the value of the pattern is used
>>>> as the seed for the random generator.
>>> Please, do not add parameters, make it simple - teach the test to use
>>> both the old patterns plus additional cycles with random patterns.
>> but if we do not add new parameter, how can we create a random seed?
> Unless you have a real practical reason to let users pass the initial
> random seed, do not do this.
>
ok. got it.
thanks
Huang Shijie
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-03-04 2:29 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 2:20 [PATCH 1/2] mtd: torturetest: rewrite the erase-write-verify process into one block unit Huang Shijie
2013-02-05 2:20 ` [PATCH 2/2] mtd: torturetest: add the support for random data pattern Huang Shijie
2013-02-05 8:05 ` Ricard Wanderlof
2013-02-05 8:21 ` [PATCH v2] " Huang Shijie
2013-02-05 9:48 ` Ricard Wanderlof
2013-02-05 10:01 ` Huang Shijie
2013-02-13 10:37 ` Artem Bityutskiy
2013-02-16 4:00 ` Huang Shijie
2013-03-02 14:44 ` Artem Bityutskiy
2013-03-04 2:29 ` Huang Shijie
2013-02-05 8:21 ` [PATCH 2/2] " Huang Shijie
2013-02-05 8:30 ` [PATCH V3] " Huang Shijie
2013-02-05 9:06 ` [PATCH v4] " Huang Shijie
2013-02-13 11:26 ` Ezequiel Garcia
2013-02-16 4:01 ` Huang Shijie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox