Skip to contentSkip to conversation

x86: memtest fix use of reserve_early()

PATCH Applied Daniele Calore 4 participants 5 messages Oct 13, 2008 – Oct 22, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: memtest fix use of reserve_early()

Hi all,

Wrong usage of 2nd parameter in reserve_early call.

66/75: reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
                                ^^^^^^^^^^^^^^^^^^^^

The correct way is to use 'end' address and not 'size'. As a bonus a fix to the printk format.

---

arch/x86/mm/memtest.c +3 -4
index 672e17f..9cab18b 100644
@@ -61,9 +61,9 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
 				last_bad += incr;
 			} else {
 				if (start_bad) {
-					printk(KERN_CONT "\n  %010lx bad mem addr %010lx - %010lx reserved",
+					printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
 						val, start_bad, last_bad + incr);
-					reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
+					reserve_early(start_bad, last_bad + incr, "BAD RAM");
 				}
 				start_bad = last_bad = start_phys_aligned;
 			}
@@ -72,9 +72,8 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
 	if (start_bad) {
 		printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
 			val, start_bad, last_bad + incr);
-		reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
+		reserve_early(start_bad, last_bad + incr, "BAD RAM");
 	}
-
 }
 
 /* default is disabled */
#1 lore raw

Hi Ingo and all,

Is there any news about this patch ?
AFAIK without this fix memtest is unusefull.
But if I'm wrong, apologise for the noise.

Bye,

Daniele
--

Quoted 43 lines · On Mon, 13 Oct 2008 10:34:12 +0200 Daniele Calore <[email protected]> wrote:

Hi all,

Wrong usage of 2nd parameter in reserve_early call.

66/75: reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
                                ^^^^^^^^^^^^^^^^^^^^

The correct way is to use 'end' address and not 'size'. As a bonus a fix to the printk format.

---

arch/x86/mm/memtest.c +1 -1
index 672e17f..9cab18b 100644
@@ -61,9 +61,9 @@ static void __init memtest(unsigned long
 start_phys, unsigned long size, last_bad += incr;
 			} else {
 				if (start_bad) {
-					printk(KERN_CONT "\n  %010lx
 bad mem addr %010lx - %010lx reserved",
+					printk(KERN_CONT "\n  %016lx

bad mem addr %010lx - %010lx reserved", val, start_bad, last_bad + incr);

arch/x86/mm/memtest.c +0 -1
-					reserve_early(start_bad,

last_bad - start_bad, "BAD RAM");

arch/x86/mm/memtest.c +1 -0
+					reserve_early(start_bad,

last_bad + incr, "BAD RAM"); }
start_bad = last_bad =
start_phys_aligned; }

arch/x86/mm/memtest.c +1 -2
@@ -72,9 +72,8 @@ static void __init memtest(unsigned long
 start_phys, unsigned long size, if (start_bad) {
 		printk(KERN_CONT "\n  %016lx bad mem addr %010lx -
 %010lx reserved", val, start_bad, last_bad + incr);
-		reserve_early(start_bad, last_bad - start_bad, "BAD
 RAM");
+		reserve_early(start_bad, last_bad + incr, "BAD RAM");
 	}
-
 }
 

/* default is disabled */

Acked-by on v1 1/1
#2 lore raw
In reply to Daniele Calore
Quoted 29 lines · Daniele Calore

Hi all,

Wrong usage of 2nd parameter in reserve_early call.

66/75: reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
                               ^^^^^^^^^^^^^^^^^^^^

The correct way is to use 'end' address and not 'size'. As a bonus a fix to the printk format.

---

arch/x86/mm/memtest.c +2 -2
index 672e17f..9cab18b 100644
@@ -61,9 +61,9 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
                               last_bad += incr;
                       } else {
                               if (start_bad) {
-                                       printk(KERN_CONT "\n  %010lx bad mem addr %010lx - %010lx reserved",
+                                       printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
                                               val, start_bad, last_bad + incr);
-                                       reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
+                                       reserve_early(start_bad, last_bad + incr, "BAD RAM");
                               }
                               start_bad = last_bad = start_phys_aligned;
                       }

arch/x86/mm/memtest.c static void __init memtest(unsigned long start_phys, unsigned long size, · line 79

Quoted 10 lines
arch/x86/mm/memtest.c +1 -2
@@ -72,9 +72,8 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
       if (start_bad) {
               printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
                       val, start_bad, last_bad + incr);
-               reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
+               reserve_early(start_bad, last_bad + incr, "BAD RAM");
       }
-
 }
 
 /* default is disabled */

Thanks

YH

Applied
#4 lore raw
In reply to Yinghai Lu
Quoted 39 lines · Yinghai Lu
Quoted 38 lines · Daniele Calore

Hi all,

Wrong usage of 2nd parameter in reserve_early call.

66/75: reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
                               ^^^^^^^^^^^^^^^^^^^^

The correct way is to use 'end' address and not 'size'. As a bonus a fix to the printk format.

---

arch/x86/mm/memtest.c +3 -4
index 672e17f..9cab18b 100644
@@ -61,9 +61,9 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
                               last_bad += incr;
                       } else {
                               if (start_bad) {
-                                       printk(KERN_CONT "\n  %010lx bad mem addr %010lx - %010lx reserved",
+                                       printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
                                               val, start_bad, last_bad + incr);
-                                       reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
+                                       reserve_early(start_bad, last_bad + incr, "BAD RAM");
                               }
                               start_bad = last_bad = start_phys_aligned;
                       }
@@ -72,9 +72,8 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
       if (start_bad) {
               printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
                       val, start_bad, last_bad + incr);
-               reserve_early(start_bad, last_bad - start_bad, "BAD RAM");
+               reserve_early(start_bad, last_bad + incr, "BAD RAM");
       }
-
 }
 
Quoted 3 lines

arch/x86/mm/memtest.c static void __init memtest(unsigned long start_phys, unsigned long size, · line 79

Quoted 1 line
arch/x86/mm/memtest.c +0 -0
 /* default is disabled */

applied to tip/x86/urgent, thanks!

Ingo