memmap
There is this tutorial titled: Bad Memory HowTo which discusses disabling memory via the kernel using the memmap
argument to the kernel. According to the howto you have 2 options when it comes to memmap
:
- Turn off everything after the bad memory -
(mem=###M option)
- Turn off just the memory around the bad memory -
(memmap=#M$###M option)
With the first option, if memtest reports that there is bad memory at 600M then you could disable the RAM from that point up until the end of RAM with this:
mem=595M
If there's bad RAM at 802M and 807M, you can disable a 10M section of RAM starting at 800M like this:
memmap=10M$800M
NOTE: This will blacklist the 10M after the 800M base address. You should run memtest86+
afterwards to confirm that this argument is correct.
BadRAM
There is a patch available for Ubuntu called BadRam. It's covered very well here in this post titled: BadRAM on the Ubuntu Community site.
After applying the patch to the kernel using the details from that page you make modifications to your Grub2 setup:
excerpt from that site for Grub2
The GRUB2 config file in Natty has a line for configuring kernel bad
ram exclusions. So, I will assume that is the preferred way of mapping
out a section of memory that is showing errors. The line I set was
GRUB_BADRAM="0x7DDF0000,0xffffc000"
The suggested way on every web site I could find was to set this was
to run memtest86 and let it show you the BadRAM settings. memtest86
gave me a page of stuff I would have had to enter. I could see that
all the addresses were in one 16K block, so I just wanted to map that
16K block out of action. Here is how I generated the correct entry.
The first parameter is easy. That is the base address of the bad
memory. In my case, I could see that all the bad addresses were
greater than 0x7DDF0000 and less than 0x7DDF4000. So, I took the
beginning of the 16K block as my starting address.
The second parameter is a mask. You put 1s where the address range you
want shares the same values and 0s where it will vary. This means you
need to pick your address range such that only the low order bits
vary. Looking at my address, the first part of the mask is easy. You
want to start with 0xffff. For the next nibble, I will explain with
bit maps. I want to range from 0000 to 0011. So, the mask for badram
would be 1100 or a hex c. The last 3 nibbles need to be all 0s in the
mask, since we want the entire range mapped out. So, we get a total
result of 0xffffc000.
After setting this line in /etc/default/grub, I ran sudo update-grub
and rebooted and my bad memory was no longer being used. No kernel
patches are needed to map out bad memory using this method.
Follow up #1
Looking through the wikipedia page for memtest86+ it states as follows:
excerpt from Memtest86 wikipedia page
Starting from Memtest86 2.3 and Memtest86+ 1.60, the program can
output a list of bad RAM regions in the format expected by the BadRAM
patch for the Linux kernel; using this information, a Linux system can
reliably use a RAM module even if it has a few bad bits. Grub2 is able
to supply this same information to an unpatched kernel, negating the
need for the BadRAM patch.
Also I came across this Gentoo page which specified the memmap=...
using a hex address, so you could specify it like this:
memmap=5M$0x2f796c48
The 5M is just a guess, obviously you could adjust it lower or higher depending on how much RAM around that region you want/need to omit.
Finally you can specify the size in hex as well:
memmap=0x10000$0x2f796c48
Would ignore 64KB's starting at address 0x2f796c48.
References