How to exclude Bad Ram area in 2.4

From: dLux (dlux@kapu.hu)
Date: Wed May 31 2000 - 12:15:25 EST


Hello!

I have just read the patch by Rik van Rein, which can be used to
mark bad memory regions, but unfortunately it only works in 2.2.x.
Then I started to look at the 2.4 kernel (test1), finding the way
porting the patch. I had problems with the different meory handling,
then I gave up this.
  I've found the bootmem.c, and I started to hack in my way.

  The result is not a patch, only a quick and dirty method, but it
works. For those who need a cleaner solution, please wait for Rik's
patch, he promised he is working on it!

- get memtest86 and install it
  (http://reality.sgi.com/cbrady_denver/memtest86), then write up
  the bad memory addresses
- open the arch/i386/kernel/setup.c:
- search for the "reserve_bootmem" string
- before the first string, insert additional lines, one per bad
  address like this: "reserve_bootmem(address,4);"
- You will see a code like this:

  reserve_bootmem(0x7d07e20,4); // your code: wrong bit: 7d07e20
  reserve_bootmem(0x7e53b4c,4); // your code: wrong bit: 7e53b4c
  reserve_bootmem(0x1b2ce98,4); // your code: wrong bit: 1b2ce98
  // Original code follows:
  reserve_bootmem(HIGH_MEMORY, (PFN_PHYS(start_pfn) +
      bootmap_size + PAGE_SIZE-1) - (HIGH_MEMORY));

- then you need to recompile the kernel and reboot.

- If you wanna see that the pages really reserved, then apply the
  following short patch (cd /usr/src/linux; patch -p1 <patchfile):

--- linux/arch/i386/mm/init.c.orig Wed May 31 19:04:29 2000
+++ linux/arch/i386/mm/init.c Wed May 31 18:42:20 2000
@@ -537,6 +559,7 @@
 void __init mem_init(void)
 {
   int codesize, reservedpages, datasize, initsize;
+ int res_start=-1; // -1 means: no reservation
   int tmp;

   if (!mem_map)
@@ -559,12 +582,31 @@
   totalram_pages += free_all_bootmem();

   reservedpages = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
+ printk("Reserved Pages:");
+ for (tmp = 0; tmp < max_low_pfn; tmp++) {
     /*
      * Only count reserved RAM pages
      */
- if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
+ if (page_is_ram(tmp) && PageReserved(mem_map+tmp)) {
+ if (res_start == -1) {
+ printk("%x",tmp);
+ res_start=tmp;
+ };
       reservedpages++;
+ } else if (res_start != -1) {
+ if (res_start != tmp-1) {
+ printk("-%x,",tmp-1);
+ } else {
+ printk(",");
+ };
+ res_start=-1;
+ };
+ };
+ if (res_start!= -1 && res_start != tmp-1) {
+ printk("-%x",tmp-1);
+ };
+
+ printk("\n");
 #ifdef CONFIG_HIGHMEM
   for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
     struct page *page = mem_map + tmp;

- after that you can watch the output of the dmesg!

Hope this helps for some people,

Regards,

dLux

--
..all in all it's just another rule in the firewall. /Ping Flood/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:28 EST