LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3
@ 2014-12-05 15:18 Roger Quadros
  2014-12-05 15:18 ` [PATCH 1/2] mtd: mtd_oobtest: Fix " Roger Quadros
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Roger Quadros @ 2014-12-05 15:18 UTC (permalink / raw)
  To: computersforpeace, dwmw2
  Cc: akinobu.mita, linux-mtd, linux-kernel, Roger Quadros

Hi,

The bitflip_limit parameter was recently introduced to oobtest.
However, it didn't implement the bitflip_limit check for all cases in test case 3.
Patch 1 tackles the missed scenarios in test case 3, to adhere to bitflip_limit parameter.

Patch 2 extends the memory compare helper so that we can pass a non-zero offset to be
printed in the error message. This is useful in the vary_offset case when we need to
compare only a section of the OOB available block.

--
cheers,
-roger

Roger Quadros (2):
  mtd: mtd_oobtest: Fix bitflip_limit usage in test case 3
  mtd: mtd_oobtest: Fix the address offset with vary_offset case

 drivers/mtd/tests/oobtest.c | 79 ++++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 33 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] mtd: mtd_oobtest: Fix bitflip_limit usage in test case 3
  2014-12-05 15:18 [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros
@ 2014-12-05 15:18 ` Roger Quadros
  2015-04-06  1:12   ` Brian Norris
  2014-12-05 15:18 ` [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Roger Quadros
  2015-03-31  8:28 ` [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros
  2 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2014-12-05 15:18 UTC (permalink / raw)
  To: computersforpeace, dwmw2
  Cc: akinobu.mita, linux-mtd, linux-kernel, Roger Quadros

In test case 3, we set vary_offset to write at different
offsets and lengths in the OOB available area. We need to
do the bitflip_limit check while checking for 0xff outside the
OOB offset + length area that we didn't modify during write.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mtd/tests/oobtest.c | 61 +++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c
index 1fd2cda..4da877b 100644
--- a/drivers/mtd/tests/oobtest.c
+++ b/drivers/mtd/tests/oobtest.c
@@ -141,6 +141,30 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
 	return bitflips;
 }
 
+/*
+ * Compare with 0xff and show the address, offset and data bytes at
+ * comparison failure. Return number of bitflips encountered.
+ */
+static size_t memffshow(loff_t addr, loff_t offset, const void *cs,
+			size_t count)
+{
+	const unsigned char *su1;
+	int res;
+	size_t i = 0;
+	size_t bitflips = 0;
+
+	for (su1 = cs; 0 < count; ++su1, count--, i++) {
+		res = *su1 ^ 0xff;
+		if (res) {
+			pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0xff diff 0x%x\n",
+				(unsigned long)addr, (unsigned long)offset + i,
+				*su1, res);
+			bitflips += hweight8(res);
+		}
+	}
+
+	return bitflips;
+}
 static int verify_eraseblock(int ebnum)
 {
 	int i;
@@ -203,6 +227,15 @@ static int verify_eraseblock(int ebnum)
 			bitflips = memcmpshow(addr, readbuf + use_offset,
 					      writebuf + (use_len_max * i) + use_offset,
 					      use_len);
+
+			/* verify pre-offset area for 0xff */
+			bitflips += memffshow(addr, 0, readbuf, use_offset);
+
+			/* verify post-(use_offset + use_len) area for 0xff */
+			k = use_offset + use_len;
+			bitflips += memffshow(addr, k, readbuf + k,
+					      mtd->ecclayout->oobavail - k);
+
 			if (bitflips > bitflip_limit) {
 				pr_err("error: verify failed at %#llx\n",
 						(long long)addr);
@@ -212,34 +245,8 @@ static int verify_eraseblock(int ebnum)
 					return -1;
 				}
 			} else if (bitflips) {
-				pr_info("ignoring error as within bitflip_limit\n");
+				pr_info("ignoring errors as within bitflip limit\n");
 			}
-
-			for (k = 0; k < use_offset; ++k)
-				if (readbuf[k] != 0xff) {
-					pr_err("error: verify 0xff "
-					       "failed at %#llx\n",
-					       (long long)addr);
-					errcnt += 1;
-					if (errcnt > 1000) {
-						pr_err("error: too "
-						       "many errors\n");
-						return -1;
-					}
-				}
-			for (k = use_offset + use_len;
-			     k < mtd->ecclayout->oobavail; ++k)
-				if (readbuf[k] != 0xff) {
-					pr_err("error: verify 0xff "
-					       "failed at %#llx\n",
-					       (long long)addr);
-					errcnt += 1;
-					if (errcnt > 1000) {
-						pr_err("error: too "
-						       "many errors\n");
-						return -1;
-					}
-				}
 		}
 		if (vary_offset)
 			do_vary_offset();
-- 
2.1.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case
  2014-12-05 15:18 [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros
  2014-12-05 15:18 ` [PATCH 1/2] mtd: mtd_oobtest: Fix " Roger Quadros
@ 2014-12-05 15:18 ` Roger Quadros
  2015-04-02 16:26   ` Brian Norris
  2015-03-31  8:28 ` [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros
  2 siblings, 1 reply; 7+ messages in thread
From: Roger Quadros @ 2014-12-05 15:18 UTC (permalink / raw)
  To: computersforpeace, dwmw2
  Cc: akinobu.mita, linux-mtd, linux-kernel, Roger Quadros

When vary_offset is set (e.g. test case 3), the offset is not always
zero so memcmpshow() will show the wrong offset in the print message.
To fix this we introduce a new function memcmpshowoffset() which takes
offset as a parameter and displays the right offset and use it in
the case where offset is non zero.

The old memcmpshow() functionality is preserved by converting it into
a macro with offset preset to 0.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mtd/tests/oobtest.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c
index 4da877b..0d5e85d 100644
--- a/drivers/mtd/tests/oobtest.c
+++ b/drivers/mtd/tests/oobtest.c
@@ -122,7 +122,8 @@ static int write_whole_device(void)
  * Display the address, offset and data bytes at comparison failure.
  * Return number of bitflips encountered.
  */
-static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t count)
+static size_t memcmpshowoffset(loff_t addr, loff_t offset, const void *cs,
+			       const void *ct, size_t count)
 {
 	const unsigned char *su1, *su2;
 	int res;
@@ -132,8 +133,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
 	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--, i++) {
 		res = *su1 ^ *su2;
 		if (res) {
-			pr_info("error @addr[0x%lx:0x%x] 0x%x -> 0x%x diff 0x%x\n",
-				(unsigned long)addr, i, *su1, *su2, res);
+			pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0x%x diff 0x%x\n",
+				(unsigned long)addr, (unsigned long)offset + i,
+				*su1, *su2, res);
 			bitflips += hweight8(res);
 		}
 	}
@@ -141,6 +143,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
 	return bitflips;
 }
 
+#define memcmpshow(addr, cs, ct, count) memcmpshowoffset((addr), 0, (cs), (ct),\
+							 (count))
+
 /*
  * Compare with 0xff and show the address, offset and data bytes at
  * comparison failure. Return number of bitflips encountered.
@@ -224,9 +229,10 @@ static int verify_eraseblock(int ebnum)
 				errcnt += 1;
 				return err ? err : -1;
 			}
-			bitflips = memcmpshow(addr, readbuf + use_offset,
-					      writebuf + (use_len_max * i) + use_offset,
-					      use_len);
+			bitflips = memcmpshowoffset(addr, use_offset,
+						    readbuf + use_offset,
+						    writebuf + (use_len_max * i) + use_offset,
+						    use_len);
 
 			/* verify pre-offset area for 0xff */
 			bitflips += memffshow(addr, 0, readbuf, use_offset);
-- 
2.1.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3
  2014-12-05 15:18 [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros
  2014-12-05 15:18 ` [PATCH 1/2] mtd: mtd_oobtest: Fix " Roger Quadros
  2014-12-05 15:18 ` [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Roger Quadros
@ 2015-03-31  8:28 ` Roger Quadros
  2 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2015-03-31  8:28 UTC (permalink / raw)
  To: computersforpeace, dwmw2; +Cc: akinobu.mita, linux-mtd, linux-kernel

Hi,

On 05/12/14 17:18, Roger Quadros wrote:
> Hi,
> 
> The bitflip_limit parameter was recently introduced to oobtest.
> However, it didn't implement the bitflip_limit check for all cases in test case 3.
> Patch 1 tackles the missed scenarios in test case 3, to adhere to bitflip_limit parameter.
> 
> Patch 2 extends the memory compare helper so that we can pass a non-zero offset to be
> printed in the error message. This is useful in the vary_offset case when we need to
> compare only a section of the OOB available block.

Gentle reminder to review and pick these. Thanks.

cheers,
-roger

> 
> --
> cheers,
> -roger
> 
> Roger Quadros (2):
>   mtd: mtd_oobtest: Fix bitflip_limit usage in test case 3
>   mtd: mtd_oobtest: Fix the address offset with vary_offset case
> 
>  drivers/mtd/tests/oobtest.c | 79 ++++++++++++++++++++++++++-------------------
>  1 file changed, 46 insertions(+), 33 deletions(-)
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case
  2014-12-05 15:18 ` [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Roger Quadros
@ 2015-04-02 16:26   ` Brian Norris
  2015-04-09 11:16     ` [PATCH v2 " Roger Quadros
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Norris @ 2015-04-02 16:26 UTC (permalink / raw)
  To: Roger Quadros; +Cc: dwmw2, akinobu.mita, linux-mtd, linux-kernel

On Fri, Dec 05, 2014 at 05:18:40PM +0200, Roger Quadros wrote:
> When vary_offset is set (e.g. test case 3), the offset is not always
> zero so memcmpshow() will show the wrong offset in the print message.
> To fix this we introduce a new function memcmpshowoffset() which takes
> offset as a parameter and displays the right offset and use it in
> the case where offset is non zero.
> 
> The old memcmpshow() functionality is preserved by converting it into
> a macro with offset preset to 0.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/mtd/tests/oobtest.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c
> index 4da877b..0d5e85d 100644
> --- a/drivers/mtd/tests/oobtest.c
> +++ b/drivers/mtd/tests/oobtest.c
> @@ -122,7 +122,8 @@ static int write_whole_device(void)
>   * Display the address, offset and data bytes at comparison failure.
>   * Return number of bitflips encountered.
>   */
> -static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t count)
> +static size_t memcmpshowoffset(loff_t addr, loff_t offset, const void *cs,
> +			       const void *ct, size_t count)
>  {
>  	const unsigned char *su1, *su2;
>  	int res;
> @@ -132,8 +133,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
>  	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--, i++) {
>  		res = *su1 ^ *su2;
>  		if (res) {
> -			pr_info("error @addr[0x%lx:0x%x] 0x%x -> 0x%x diff 0x%x\n",
> -				(unsigned long)addr, i, *su1, *su2, res);
> +			pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0x%x diff 0x%x\n",
> +				(unsigned long)addr, (unsigned long)offset + i,
> +				*su1, *su2, res);

This hunk doesn't apply. You seem to have missed this commit:

commit 806b6ef5676a1c6ea78592174aae15f59bb0a923
Author: Brian Norris <computersforpeace@gmail.com>
Date:   Thu Nov 20 01:26:51 2014 -0800

    mtd: oobtest: correct printf() format specifier for 'size_t'

Please rebase this patch on the latest l2-mtd.git.

Brian

>  			bitflips += hweight8(res);
>  		}
>  	}
> @@ -141,6 +143,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
>  	return bitflips;
>  }
>  
> +#define memcmpshow(addr, cs, ct, count) memcmpshowoffset((addr), 0, (cs), (ct),\
> +							 (count))
> +
>  /*
>   * Compare with 0xff and show the address, offset and data bytes at
>   * comparison failure. Return number of bitflips encountered.
> @@ -224,9 +229,10 @@ static int verify_eraseblock(int ebnum)
>  				errcnt += 1;
>  				return err ? err : -1;
>  			}
> -			bitflips = memcmpshow(addr, readbuf + use_offset,
> -					      writebuf + (use_len_max * i) + use_offset,
> -					      use_len);
> +			bitflips = memcmpshowoffset(addr, use_offset,
> +						    readbuf + use_offset,
> +						    writebuf + (use_len_max * i) + use_offset,
> +						    use_len);
>  
>  			/* verify pre-offset area for 0xff */
>  			bitflips += memffshow(addr, 0, readbuf, use_offset);
> -- 
> 2.1.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mtd: mtd_oobtest: Fix bitflip_limit usage in test case 3
  2014-12-05 15:18 ` [PATCH 1/2] mtd: mtd_oobtest: Fix " Roger Quadros
@ 2015-04-06  1:12   ` Brian Norris
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2015-04-06  1:12 UTC (permalink / raw)
  To: Roger Quadros; +Cc: dwmw2, akinobu.mita, linux-mtd, linux-kernel

On Fri, Dec 05, 2014 at 05:18:39PM +0200, Roger Quadros wrote:
> In test case 3, we set vary_offset to write at different
> offsets and lengths in the OOB available area. We need to
> do the bitflip_limit check while checking for 0xff outside the
> OOB offset + length area that we didn't modify during write.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Applied patch 1 to l2-mtd.git. Patch 2 couldn't be applied cleanly.

Brian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case
  2015-04-02 16:26   ` Brian Norris
@ 2015-04-09 11:16     ` Roger Quadros
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Quadros @ 2015-04-09 11:16 UTC (permalink / raw)
  To: Brian Norris; +Cc: dwmw2, akinobu.mita, linux-mtd, linux-kernel

When vary_offset is set (e.g. test case 3), the offset is not always
zero so memcmpshow() will show the wrong offset in the print message.
To fix this we introduce a new function memcmpshowoffset() which takes
offset as a parameter and displays the right offset and use it in
the case where offset is non zero.

The old memcmpshow() functionality is preserved by converting it into
a macro with offset preset to 0.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mtd/tests/oobtest.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c
index be6e181..0d5e85d 100644
--- a/drivers/mtd/tests/oobtest.c
+++ b/drivers/mtd/tests/oobtest.c
@@ -122,7 +122,8 @@ static int write_whole_device(void)
  * Display the address, offset and data bytes at comparison failure.
  * Return number of bitflips encountered.
  */
-static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t count)
+static size_t memcmpshowoffset(loff_t addr, loff_t offset, const void *cs,
+			       const void *ct, size_t count)
 {
 	const unsigned char *su1, *su2;
 	int res;
@@ -132,8 +133,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
 	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--, i++) {
 		res = *su1 ^ *su2;
 		if (res) {
-			pr_info("error @addr[0x%lx:0x%zx] 0x%x -> 0x%x diff 0x%x\n",
-				(unsigned long)addr, i, *su1, *su2, res);
+			pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0x%x diff 0x%x\n",
+				(unsigned long)addr, (unsigned long)offset + i,
+				*su1, *su2, res);
 			bitflips += hweight8(res);
 		}
 	}
@@ -141,6 +143,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou
 	return bitflips;
 }
 
+#define memcmpshow(addr, cs, ct, count) memcmpshowoffset((addr), 0, (cs), (ct),\
+							 (count))
+
 /*
  * Compare with 0xff and show the address, offset and data bytes at
  * comparison failure. Return number of bitflips encountered.
@@ -224,9 +229,10 @@ static int verify_eraseblock(int ebnum)
 				errcnt += 1;
 				return err ? err : -1;
 			}
-			bitflips = memcmpshow(addr, readbuf + use_offset,
-					      writebuf + (use_len_max * i) + use_offset,
-					      use_len);
+			bitflips = memcmpshowoffset(addr, use_offset,
+						    readbuf + use_offset,
+						    writebuf + (use_len_max * i) + use_offset,
+						    use_len);
 
 			/* verify pre-offset area for 0xff */
 			bitflips += memffshow(addr, 0, readbuf, use_offset);
-- 
2.1.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-04-09 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-05 15:18 [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros
2014-12-05 15:18 ` [PATCH 1/2] mtd: mtd_oobtest: Fix " Roger Quadros
2015-04-06  1:12   ` Brian Norris
2014-12-05 15:18 ` [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Roger Quadros
2015-04-02 16:26   ` Brian Norris
2015-04-09 11:16     ` [PATCH v2 " Roger Quadros
2015-03-31  8:28 ` [PATCH 0/2] mtd: mtd_oobtest: fix bitflip_limit usage in test case 3 Roger Quadros

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).