linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] memtest cleanups
@ 2015-07-14  8:40 Vladimir Murzin
  2015-07-14  8:40 ` [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul Vladimir Murzin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Vladimir Murzin @ 2015-07-14  8:40 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, leon

Hi,

This patch set does simple cleanup in mm/memtest.c code.

There is no changes in functionality, but some logging may slightly differ
after patch 2/3 is applied.

Patches were generated against 4.2-rc2

Thanks!

Changelog:

v1 -> v2
	- do not fallback to the memtest_pattern = ARRAY_SIZE(patterns) in
          case we couldn't parse memtest's arg (per Leon Romanovsky)


Vladimir Murzin (3):
  memtest: use kstrtouint instead of simple_strtoul
  memtest: cleanup log messages
  memtest: remove unused header files

 mm/memtest.c |   27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul
  2015-07-14  8:40 [PATCH v2 0/3] memtest cleanups Vladimir Murzin
@ 2015-07-14  8:40 ` Vladimir Murzin
  2015-07-15 23:55   ` David Rientjes
  2015-07-14  8:40 ` [PATCH v2 2/3] memtest: cleanup log messages Vladimir Murzin
  2015-07-14  8:40 ` [PATCH v2 3/3] memtest: remove unused header files Vladimir Murzin
  2 siblings, 1 reply; 8+ messages in thread
From: Vladimir Murzin @ 2015-07-14  8:40 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, leon

Since simple_strtoul is obsolete and memtest_pattern is type of int, use
kstrtouint instead.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 mm/memtest.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/memtest.c b/mm/memtest.c
index 0a1cc13..20e8361 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -89,16 +89,18 @@ static void __init do_one_pass(u64 pattern, phys_addr_t start, phys_addr_t end)
 }
 
 /* default is disabled */
-static int memtest_pattern __initdata;
+static unsigned int memtest_pattern __initdata;
 
 static int __init parse_memtest(char *arg)
 {
+	int ret = 0;
+
 	if (arg)
-		memtest_pattern = simple_strtoul(arg, NULL, 0);
+		ret = kstrtouint(arg, 0, &memtest_pattern);
 	else
 		memtest_pattern = ARRAY_SIZE(patterns);
 
-	return 0;
+	return ret;
 }
 
 early_param("memtest", parse_memtest);
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH v2 2/3] memtest: cleanup log messages
  2015-07-14  8:40 [PATCH v2 0/3] memtest cleanups Vladimir Murzin
  2015-07-14  8:40 ` [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul Vladimir Murzin
@ 2015-07-14  8:40 ` Vladimir Murzin
  2015-07-15 23:56   ` David Rientjes
  2015-07-14  8:40 ` [PATCH v2 3/3] memtest: remove unused header files Vladimir Murzin
  2 siblings, 1 reply; 8+ messages in thread
From: Vladimir Murzin @ 2015-07-14  8:40 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, leon

- prefer pr_info(...  to printk(KERN_INFO ...
- use %pa for phys_addr_t
- use cpu_to_be64 while printing pattern in reserve_bad_mem()

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 mm/memtest.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/mm/memtest.c b/mm/memtest.c
index 20e8361..ca52d08 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -31,10 +31,8 @@ static u64 patterns[] __initdata = {
 
 static void __init reserve_bad_mem(u64 pattern, phys_addr_t start_bad, phys_addr_t end_bad)
 {
-	printk(KERN_INFO "  %016llx bad mem addr %010llx - %010llx reserved\n",
-	       (unsigned long long) pattern,
-	       (unsigned long long) start_bad,
-	       (unsigned long long) end_bad);
+	pr_info("%016llx bad mem addr %pa - %pa reserved\n",
+		cpu_to_be64(pattern), &start_bad, &end_bad);
 	memblock_reserve(start_bad, end_bad - start_bad);
 }
 
@@ -79,10 +77,8 @@ static void __init do_one_pass(u64 pattern, phys_addr_t start, phys_addr_t end)
 		this_start = clamp(this_start, start, end);
 		this_end = clamp(this_end, start, end);
 		if (this_start < this_end) {
-			printk(KERN_INFO "  %010llx - %010llx pattern %016llx\n",
-			       (unsigned long long)this_start,
-			       (unsigned long long)this_end,
-			       (unsigned long long)cpu_to_be64(pattern));
+			pr_info("  %pa - %pa pattern %016llx\n",
+				&this_start, &this_end, cpu_to_be64(pattern));
 			memtest(pattern, this_start, this_end - this_start);
 		}
 	}
@@ -113,7 +109,7 @@ void __init early_memtest(phys_addr_t start, phys_addr_t end)
 	if (!memtest_pattern)
 		return;
 
-	printk(KERN_INFO "early_memtest: # of tests: %d\n", memtest_pattern);
+	pr_info("early_memtest: # of tests: %u\n", memtest_pattern);
 	for (i = memtest_pattern-1; i < UINT_MAX; --i) {
 		idx = i % ARRAY_SIZE(patterns);
 		do_one_pass(patterns[idx], start, end);
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH v2 3/3] memtest: remove unused header files
  2015-07-14  8:40 [PATCH v2 0/3] memtest cleanups Vladimir Murzin
  2015-07-14  8:40 ` [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul Vladimir Murzin
  2015-07-14  8:40 ` [PATCH v2 2/3] memtest: cleanup log messages Vladimir Murzin
@ 2015-07-14  8:40 ` Vladimir Murzin
  2015-07-16  0:09   ` David Rientjes
  2 siblings, 1 reply; 8+ messages in thread
From: Vladimir Murzin @ 2015-07-14  8:40 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, leon

memtest does not require these headers to be included.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 mm/memtest.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/mm/memtest.c b/mm/memtest.c
index ca52d08..8bbb0c2 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -1,11 +1,6 @@
 #include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
 #include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
 #include <linux/init.h>
-#include <linux/pfn.h>
 #include <linux/memblock.h>
 
 static u64 patterns[] __initdata = {
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul
  2015-07-14  8:40 ` [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul Vladimir Murzin
@ 2015-07-15 23:55   ` David Rientjes
  0 siblings, 0 replies; 8+ messages in thread
From: David Rientjes @ 2015-07-15 23:55 UTC (permalink / raw)
  To: Vladimir Murzin; +Cc: linux-mm, akpm, leon

On Tue, 14 Jul 2015, Vladimir Murzin wrote:

> Since simple_strtoul is obsolete and memtest_pattern is type of int, use
> kstrtouint instead.
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 2/3] memtest: cleanup log messages
  2015-07-14  8:40 ` [PATCH v2 2/3] memtest: cleanup log messages Vladimir Murzin
@ 2015-07-15 23:56   ` David Rientjes
  2015-07-16 10:19     ` Vladimir Murzin
  0 siblings, 1 reply; 8+ messages in thread
From: David Rientjes @ 2015-07-15 23:56 UTC (permalink / raw)
  To: Vladimir Murzin; +Cc: linux-mm, akpm, leon

On Tue, 14 Jul 2015, Vladimir Murzin wrote:

> - prefer pr_info(...  to printk(KERN_INFO ...
> - use %pa for phys_addr_t
> - use cpu_to_be64 while printing pattern in reserve_bad_mem()
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

Acked-by: David Rientjes <rientjes@google.com>

Not sure why you changed the whitespace in reserve_bad_mem() though.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 3/3] memtest: remove unused header files
  2015-07-14  8:40 ` [PATCH v2 3/3] memtest: remove unused header files Vladimir Murzin
@ 2015-07-16  0:09   ` David Rientjes
  0 siblings, 0 replies; 8+ messages in thread
From: David Rientjes @ 2015-07-16  0:09 UTC (permalink / raw)
  To: Vladimir Murzin; +Cc: linux-mm, akpm, leon

On Tue, 14 Jul 2015, Vladimir Murzin wrote:

> memtest does not require these headers to be included.
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 2/3] memtest: cleanup log messages
  2015-07-15 23:56   ` David Rientjes
@ 2015-07-16 10:19     ` Vladimir Murzin
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir Murzin @ 2015-07-16 10:19 UTC (permalink / raw)
  To: David Rientjes
  Cc: linux-mm@kvack.org, akpm@linux-foundation.org, leon@leon.nu

On 16/07/15 00:56, David Rientjes wrote:
> On Tue, 14 Jul 2015, Vladimir Murzin wrote:
> 
>> - prefer pr_info(...  to printk(KERN_INFO ...
>> - use %pa for phys_addr_t
>> - use cpu_to_be64 while printing pattern in reserve_bad_mem()
>>
>> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
> 
> Acked-by: David Rientjes <rientjes@google.com>
> 
> Not sure why you changed the whitespace in reserve_bad_mem() though.
> 
> 

I was changed by accident, thanks for pointing it out!

Andrew, could you apply the following fixup, please?

---8<---
diff --git a/mm/memtest.c b/mm/memtest.c
index 332facd..4b4f36b 100644
--- a/mm/memtest.c
+++ b/mm/memtest.c
@@ -26,7 +26,7 @@ static u64 patterns[] __initdata = {

 static void __init reserve_bad_mem(u64 pattern, phys_addr_t start_bad,
phys_addr_t end_bad)
 {
-	pr_info("%016llx bad mem addr %pa - %pa reserved\n",
+	pr_info("  %016llx bad mem addr %pa - %pa reserved\n",
 		cpu_to_be64(pattern), &start_bad, &end_bad);
 	memblock_reserve(start_bad, end_bad - start_bad);
 }
--->8---

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2015-07-16 10:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14  8:40 [PATCH v2 0/3] memtest cleanups Vladimir Murzin
2015-07-14  8:40 ` [PATCH v2 1/3] memtest: use kstrtouint instead of simple_strtoul Vladimir Murzin
2015-07-15 23:55   ` David Rientjes
2015-07-14  8:40 ` [PATCH v2 2/3] memtest: cleanup log messages Vladimir Murzin
2015-07-15 23:56   ` David Rientjes
2015-07-16 10:19     ` Vladimir Murzin
2015-07-14  8:40 ` [PATCH v2 3/3] memtest: remove unused header files Vladimir Murzin
2015-07-16  0:09   ` David Rientjes

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