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 1/7] x86: memtest: reuse test patterns when memtest parameter exceeds number of available patterns
Date: Wed, 25 Feb 2009 11:26:18 +0100 [thread overview]
Message-ID: <20090225102618.GQ6298@alberich.amd.com> (raw)
In-Reply-To: <20090225102337.GP6298@alberich.amd.com>
Impact: fix unexpected behaviour when pattern number is out of range
Current implementation provides 4 patterns for memtest. The code doesn't
check whether the memtest parameter value exceeds the maximum pattern number.
Instead the memtest code pretends to test with non-existing patterns, e.g.
when booting with memtest=10 I've observed the following
...
early_memtest: pattern num 10
0000001000 - 0000006000 pattern 0
...
0000001000 - 0000006000 pattern 1
...
0000001000 - 0000006000 pattern 2
...
0000001000 - 0000006000 pattern 3
...
0000001000 - 0000006000 pattern 4
...
0000001000 - 0000006000 pattern 5
...
0000001000 - 0000006000 pattern 6
...
0000001000 - 0000006000 pattern 7
...
0000001000 - 0000006000 pattern 8
...
0000001000 - 0000006000 pattern 9
...
But in fact Linux didn't test anything for patterns > 4 as the default
case in memtest() is to leave the function.
I suggest to use the memtest parameter as the number of tests to be
performed and to re-iterate over all existing patterns.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
arch/x86/mm/memtest.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
index 9cab18b..00b8bdc 100644
--- a/arch/x86/mm/memtest.c
+++ b/arch/x86/mm/memtest.c
@@ -9,6 +9,8 @@
#include <asm/e820.h>
+#define _MAX_MEM_PATTERNS 4
+
static void __init memtest(unsigned long start_phys, unsigned long size,
unsigned pattern)
{
@@ -21,6 +23,8 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
unsigned long count;
unsigned long incr;
+ pattern = pattern % _MAX_MEM_PATTERNS;
+
switch (pattern) {
case 0:
val = 0UL;
@@ -110,8 +114,9 @@ void __init early_memtest(unsigned long start, unsigned long end)
t_size = end - t_start;
printk(KERN_CONT "\n %010llx - %010llx pattern %d",
- (unsigned long long)t_start,
- (unsigned long long)t_start + t_size, pattern);
+ (unsigned long long)t_start,
+ (unsigned long long)t_start + t_size,
+ pattern % _MAX_MEM_PATTERNS);
memtest(t_start, t_size, pattern);
--
1.6.1.3
next prev parent reply other threads:[~2009-02-25 10:27 UTC|newest]
Thread overview: 11+ 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 ` Andreas Herrmann [this message]
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 ` [PATCH 5/7] x86: memtest: wipe out test pattern from memory Andreas Herrmann
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
-- strict thread matches above, loose matches on Subject: below --
2009-02-13 14:46 [PATCH 0/7] " Andreas Herrmann
2009-02-13 14:49 ` [PATCH 1/7] x86: memtest: reuse test patterns when memtest parameter exceeds number of available patterns Andreas Herrmann
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=20090225102618.GQ6298@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.