LinuxでECCエラーを検出する

kernel 2.6.16からEDAC (旧Bluesmoke)がマージされ(て)ました。

EDACとは、

EDAC (Error Detection and Correction) is a set of Linux kernel modules for handling hardware-related errors. Currently its major focus is ECC memory error handling. However it also detects and reports PCI bus parity errors. Eventually support will be added for handling other types of errors (cache, thermal throttling, hypertransport, etc.). Although all currently supported hardware is x86-based, we intend to eventually support other platforms.

ということで、メモリのECCエラーをOSで検知できる仕組みのようです。

手元に

# lspci | grep Memory
0000:00:00.0 Host bridge: Intel Corp. 82875P Memory Controller Hub (rev 02)

なマシンがあったので有効にしてみました。

# dmesg | grep -1 -i edac
mice: PS/2 mouse device common for all mice
MC: drivers/edac/edac_mc.c version edac_mc  Ver: 2.0.0 Apr 18 2006
i82875p init one
EDAC MC0: Giving out device to "i82875p_edac" i82875p: PCI 0000:00:00.0
EISA: Probing bus 0 at eisa.0

エラーはkernel logに出るようで、その他のエラーハンドリング(Uncorrectable Errorが出たときにpanicするとか)は、linux/Documentation/drivers/edac/edac.txtに書いてあります。

メモリが壊れるまで確認できないじゃんということなんですが、Subject: Re: [ecc] Can anyone help with testing tools?にメモリを工作して意図的にエラーを出させる方法が紹介されていて、これをやると、

kernel: MC0: CE page 0x1f0ee, offset 0x0, grain 4096, syndrome 0xc1, row 0, chan

なエラーがでるそうです。

メモリ故障はなかなか気づきにくいので、EDACが対応しているチップセットのマシンは有効にしておいた方がよいんじゃないかと思います。