public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Herrmann <andreas.herrmann3@amd.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] x86: memtest: wipe out test pattern from memory
Date: Wed, 25 Feb 2009 11:30:04 +0100	[thread overview]
Message-ID: <20090225103004.GU6298@alberich.amd.com> (raw)
In-Reply-To: <20090225102337.GP6298@alberich.amd.com>


Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/mm/memtest.c |   56 ++++++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
index 3232397..9c52ef1 100644
--- a/arch/x86/mm/memtest.c
+++ b/arch/x86/mm/memtest.c
@@ -57,6 +57,29 @@ static void __init memtest(u64 pattern, u64 start_phys, u64 size)
 		reserve_bad_mem(pattern, start_bad, last_bad + incr);
 }
 
+static void __init do_one_pass(u64 pattern, u64 start, u64 end)
+{
+	u64 size = 0;
+
+	while (start < end) {
+		start = find_e820_area_size(start, &size, 1);
+
+		/* done ? */
+		if (start >= end)
+			break;
+		if (start + size > end)
+			size = end - start;
+
+		printk(KERN_INFO "  %010llx - %010llx pattern %016llx\n",
+		       (unsigned long long) start,
+		       (unsigned long long) start + size,
+		       (unsigned long long) cpu_to_be64(pattern));
+		memtest(pattern, start, size);
+
+		start += size;
+	}
+}
+
 /* default is disabled */
 static int memtest_pattern __initdata;
 
@@ -71,35 +94,22 @@ early_param("memtest", parse_memtest);
 
 void __init early_memtest(unsigned long start, unsigned long end)
 {
-	u64 t_start, t_size;
 	unsigned int i;
-	u64 pattern;
+	unsigned int idx = 0;
 
 	if (!memtest_pattern)
 		return;
 
 	printk(KERN_INFO "early_memtest: # of tests: %d\n", memtest_pattern);
 	for (i = 0; i < memtest_pattern; i++) {
-		unsigned int idx = i % ARRAY_SIZE(patterns);
-		pattern = patterns[idx];
-		t_start = start;
-		t_size = 0;
-		while (t_start < end) {
-			t_start = find_e820_area_size(t_start, &t_size, 1);
-
-			/* done ? */
-			if (t_start >= end)
-				break;
-			if (t_start + t_size > end)
-				t_size = end - t_start;
-
-			printk(KERN_INFO "  %010llx - %010llx pattern %016llx\n",
-			       (unsigned long long) t_start,
-			       (unsigned long long) t_start + t_size,
-			       (unsigned long long) cpu_to_be64(pattern));
-			memtest(pattern, t_start, t_size);
-
-			t_start += t_size;
-		}
+		idx = i % ARRAY_SIZE(patterns);
+		do_one_pass(patterns[idx], start, end);
+	}
+
+	if (idx > 0) {
+		printk(KERN_INFO "early_memtest: wipe out "
+		       "test pattern from memory\n");
+		/* additional test with pattern 0 will do this */
+		do_one_pass(0, start, end);
 	}
 }
-- 
1.6.1.3




  parent reply	other threads:[~2009-02-25 10:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25 10:23 [PATCH 0/7 v2] x86: memtest update Andreas Herrmann
2009-02-25 10:26 ` [PATCH 1/7] x86: memtest: reuse test patterns when memtest parameter exceeds number of available patterns Andreas Herrmann
2009-02-25 10:27 ` [PATCH 2/7] x86: memtest: introduce array to select memtest patterns Andreas Herrmann
2009-02-25 10:28 ` [PATCH 3/7] x86: memtest: cleanup memtest function Andreas Herrmann
2009-02-25 10:28 ` [PATCH 4/7] x86: memtest: adapt log messages Andreas Herrmann
2009-02-25 10:30 ` Andreas Herrmann [this message]
2009-02-25 10:30 ` [PATCH 6/7] x86: update description for memtest boot parameter Andreas Herrmann
2009-02-25 10:31 ` [PATCH 7/7] x86: memtest: add additional (regular) test patterns Andreas Herrmann
2009-02-25 11:20   ` Ingo Molnar
2009-02-25 11:20 ` [PATCH 0/7 v2] x86: memtest update Ingo Molnar

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=20090225103004.GU6298@alberich.amd.com \
    --to=andreas.herrmann3@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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