edac.txt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. EDAC - Error Detection And Correction
  2. Written by Doug Thompson <dougthompson@xmission.com>
  3. 7 Dec 2005
  4. 17 Jul 2007 Updated
  5. (c) Mauro Carvalho Chehab <mchehab@redhat.com>
  6. 05 Aug 2009 Nehalem interface
  7. EDAC is maintained and written by:
  8. Doug Thompson, Dave Jiang, Dave Peterson et al,
  9. original author: Thayne Harbaugh,
  10. Contact:
  11. website: bluesmoke.sourceforge.net
  12. mailing list: bluesmoke-devel@lists.sourceforge.net
  13. "bluesmoke" was the name for this device driver when it was "out-of-tree"
  14. and maintained at sourceforge.net. When it was pushed into 2.6.16 for the
  15. first time, it was renamed to 'EDAC'.
  16. The bluesmoke project at sourceforge.net is now utilized as a 'staging area'
  17. for EDAC development, before it is sent upstream to kernel.org
  18. At the bluesmoke/EDAC project site is a series of quilt patches against
  19. recent kernels, stored in a SVN repository. For easier downloading, there
  20. is also a tarball snapshot available.
  21. ============================================================================
  22. EDAC PURPOSE
  23. The 'edac' kernel module goal is to detect and report errors that occur
  24. within the computer system running under linux.
  25. MEMORY
  26. In the initial release, memory Correctable Errors (CE) and Uncorrectable
  27. Errors (UE) are the primary errors being harvested. These types of errors
  28. are harvested by the 'edac_mc' class of device.
  29. Detecting CE events, then harvesting those events and reporting them,
  30. CAN be a predictor of future UE events. With CE events, the system can
  31. continue to operate, but with less safety. Preventive maintenance and
  32. proactive part replacement of memory DIMMs exhibiting CEs can reduce
  33. the likelihood of the dreaded UE events and system 'panics'.
  34. NON-MEMORY
  35. A new feature for EDAC, the edac_device class of device, was added in
  36. the 2.6.23 version of the kernel.
  37. This new device type allows for non-memory type of ECC hardware detectors
  38. to have their states harvested and presented to userspace via the sysfs
  39. interface.
  40. Some architectures have ECC detectors for L1, L2 and L3 caches, along with DMA
  41. engines, fabric switches, main data path switches, interconnections,
  42. and various other hardware data paths. If the hardware reports it, then
  43. a edac_device device probably can be constructed to harvest and present
  44. that to userspace.
  45. PCI BUS SCANNING
  46. In addition, PCI Bus Parity and SERR Errors are scanned for on PCI devices
  47. in order to determine if errors are occurring on data transfers.
  48. The presence of PCI Parity errors must be examined with a grain of salt.
  49. There are several add-in adapters that do NOT follow the PCI specification
  50. with regards to Parity generation and reporting. The specification says
  51. the vendor should tie the parity status bits to 0 if they do not intend
  52. to generate parity. Some vendors do not do this, and thus the parity bit
  53. can "float" giving false positives.
  54. In the kernel there is a PCI device attribute located in sysfs that is
  55. checked by the EDAC PCI scanning code. If that attribute is set,
  56. PCI parity/error scanning is skipped for that device. The attribute
  57. is:
  58. broken_parity_status
  59. as is located in /sys/devices/pci<XXX>/0000:XX:YY.Z directories for
  60. PCI devices.
  61. FUTURE HARDWARE SCANNING
  62. EDAC will have future error detectors that will be integrated with
  63. EDAC or added to it, in the following list:
  64. MCE Machine Check Exception
  65. MCA Machine Check Architecture
  66. NMI NMI notification of ECC errors
  67. MSRs Machine Specific Register error cases
  68. and other mechanisms.
  69. These errors are usually bus errors, ECC errors, thermal throttling
  70. and the like.
  71. ============================================================================
  72. EDAC VERSIONING
  73. EDAC is composed of a "core" module (edac_core.ko) and several Memory
  74. Controller (MC) driver modules. On a given system, the CORE
  75. is loaded and one MC driver will be loaded. Both the CORE and
  76. the MC driver (or edac_device driver) have individual versions that reflect
  77. current release level of their respective modules.
  78. Thus, to "report" on what version a system is running, one must report both
  79. the CORE's and the MC driver's versions.
  80. LOADING
  81. If 'edac' was statically linked with the kernel then no loading is
  82. necessary. If 'edac' was built as modules then simply modprobe the
  83. 'edac' pieces that you need. You should be able to modprobe
  84. hardware-specific modules and have the dependencies load the necessary core
  85. modules.
  86. Example:
  87. $> modprobe amd76x_edac
  88. loads both the amd76x_edac.ko memory controller module and the edac_mc.ko
  89. core module.
  90. ============================================================================
  91. EDAC sysfs INTERFACE
  92. EDAC presents a 'sysfs' interface for control, reporting and attribute
  93. reporting purposes.
  94. EDAC lives in the /sys/devices/system/edac directory.
  95. Within this directory there currently reside 2 'edac' components:
  96. mc memory controller(s) system
  97. pci PCI control and status system
  98. ============================================================================
  99. Memory Controller (mc) Model
  100. First a background on the memory controller's model abstracted in EDAC.
  101. Each 'mc' device controls a set of DIMM memory modules. These modules are
  102. laid out in a Chip-Select Row (csrowX) and Channel table (chX). There can
  103. be multiple csrows and multiple channels.
  104. Memory controllers allow for several csrows, with 8 csrows being a typical value.
  105. Yet, the actual number of csrows depends on the electrical "loading"
  106. of a given motherboard, memory controller and DIMM characteristics.
  107. Dual channels allows for 128 bit data transfers to the CPU from memory.
  108. Some newer chipsets allow for more than 2 channels, like Fully Buffered DIMMs
  109. (FB-DIMMs). The following example will assume 2 channels:
  110. Channel 0 Channel 1
  111. ===================================
  112. csrow0 | DIMM_A0 | DIMM_B0 |
  113. csrow1 | DIMM_A0 | DIMM_B0 |
  114. ===================================
  115. ===================================
  116. csrow2 | DIMM_A1 | DIMM_B1 |
  117. csrow3 | DIMM_A1 | DIMM_B1 |
  118. ===================================
  119. In the above example table there are 4 physical slots on the motherboard
  120. for memory DIMMs:
  121. DIMM_A0
  122. DIMM_B0
  123. DIMM_A1
  124. DIMM_B1
  125. Labels for these slots are usually silk screened on the motherboard. Slots
  126. labeled 'A' are channel 0 in this example. Slots labeled 'B'
  127. are channel 1. Notice that there are two csrows possible on a
  128. physical DIMM. These csrows are allocated their csrow assignment
  129. based on the slot into which the memory DIMM is placed. Thus, when 1 DIMM
  130. is placed in each Channel, the csrows cross both DIMMs.
  131. Memory DIMMs come single or dual "ranked". A rank is a populated csrow.
  132. Thus, 2 single ranked DIMMs, placed in slots DIMM_A0 and DIMM_B0 above
  133. will have 1 csrow, csrow0. csrow1 will be empty. On the other hand,
  134. when 2 dual ranked DIMMs are similarly placed, then both csrow0 and
  135. csrow1 will be populated. The pattern repeats itself for csrow2 and
  136. csrow3.
  137. The representation of the above is reflected in the directory tree
  138. in EDAC's sysfs interface. Starting in directory
  139. /sys/devices/system/edac/mc each memory controller will be represented
  140. by its own 'mcX' directory, where 'X' is the index of the MC.
  141. ..../edac/mc/
  142. |
  143. |->mc0
  144. |->mc1
  145. |->mc2
  146. ....
  147. Under each 'mcX' directory each 'csrowX' is again represented by a
  148. 'csrowX', where 'X' is the csrow index:
  149. .../mc/mc0/
  150. |
  151. |->csrow0
  152. |->csrow2
  153. |->csrow3
  154. ....
  155. Notice that there is no csrow1, which indicates that csrow0 is
  156. composed of a single ranked DIMMs. This should also apply in both
  157. Channels, in order to have dual-channel mode be operational. Since
  158. both csrow2 and csrow3 are populated, this indicates a dual ranked
  159. set of DIMMs for channels 0 and 1.
  160. Within each of the 'mcX' and 'csrowX' directories are several
  161. EDAC control and attribute files.
  162. ============================================================================
  163. 'mcX' DIRECTORIES
  164. In 'mcX' directories are EDAC control and attribute files for
  165. this 'X' instance of the memory controllers:
  166. Counter reset control file:
  167. 'reset_counters'
  168. This write-only control file will zero all the statistical counters
  169. for UE and CE errors. Zeroing the counters will also reset the timer
  170. indicating how long since the last counter zero. This is useful
  171. for computing errors/time. Since the counters are always reset at
  172. driver initialization time, no module/kernel parameter is available.
  173. RUN TIME: echo "anything" >/sys/devices/system/edac/mc/mc0/counter_reset
  174. This resets the counters on memory controller 0
  175. Seconds since last counter reset control file:
  176. 'seconds_since_reset'
  177. This attribute file displays how many seconds have elapsed since the
  178. last counter reset. This can be used with the error counters to
  179. measure error rates.
  180. Memory Controller name attribute file:
  181. 'mc_name'
  182. This attribute file displays the type of memory controller
  183. that is being utilized.
  184. Total memory managed by this memory controller attribute file:
  185. 'size_mb'
  186. This attribute file displays, in count of megabytes, of memory
  187. that this instance of memory controller manages.
  188. Total Uncorrectable Errors count attribute file:
  189. 'ue_count'
  190. This attribute file displays the total count of uncorrectable
  191. errors that have occurred on this memory controller. If panic_on_ue
  192. is set this counter will not have a chance to increment,
  193. since EDAC will panic the system.
  194. Total UE count that had no information attribute fileY:
  195. 'ue_noinfo_count'
  196. This attribute file displays the number of UEs that have occurred
  197. with no information as to which DIMM slot is having errors.
  198. Total Correctable Errors count attribute file:
  199. 'ce_count'
  200. This attribute file displays the total count of correctable
  201. errors that have occurred on this memory controller. This
  202. count is very important to examine. CEs provide early
  203. indications that a DIMM is beginning to fail. This count
  204. field should be monitored for non-zero values and report
  205. such information to the system administrator.
  206. Total Correctable Errors count attribute file:
  207. 'ce_noinfo_count'
  208. This attribute file displays the number of CEs that
  209. have occurred wherewith no information as to which DIMM slot
  210. is having errors. Memory is handicapped, but operational,
  211. yet no information is available to indicate which slot
  212. the failing memory is in. This count field should be also
  213. be monitored for non-zero values.
  214. Device Symlink:
  215. 'device'
  216. Symlink to the memory controller device.
  217. Sdram memory scrubbing rate:
  218. 'sdram_scrub_rate'
  219. Read/Write attribute file that controls memory scrubbing. The scrubbing
  220. rate is set by writing a minimum bandwidth in bytes/sec to the attribute
  221. file. The rate will be translated to an internal value that gives at
  222. least the specified rate.
  223. Reading the file will return the actual scrubbing rate employed.
  224. If configuration fails or memory scrubbing is not implemented, the value
  225. of the attribute file will be -1.
  226. ============================================================================
  227. 'csrowX' DIRECTORIES
  228. In the 'csrowX' directories are EDAC control and attribute files for
  229. this 'X' instance of csrow:
  230. Total Uncorrectable Errors count attribute file:
  231. 'ue_count'
  232. This attribute file displays the total count of uncorrectable
  233. errors that have occurred on this csrow. If panic_on_ue is set
  234. this counter will not have a chance to increment, since EDAC
  235. will panic the system.
  236. Total Correctable Errors count attribute file:
  237. 'ce_count'
  238. This attribute file displays the total count of correctable
  239. errors that have occurred on this csrow. This
  240. count is very important to examine. CEs provide early
  241. indications that a DIMM is beginning to fail. This count
  242. field should be monitored for non-zero values and report
  243. such information to the system administrator.
  244. Total memory managed by this csrow attribute file:
  245. 'size_mb'
  246. This attribute file displays, in count of megabytes, of memory
  247. that this csrow contains.
  248. Memory Type attribute file:
  249. 'mem_type'
  250. This attribute file will display what type of memory is currently
  251. on this csrow. Normally, either buffered or unbuffered memory.
  252. Examples:
  253. Registered-DDR
  254. Unbuffered-DDR
  255. EDAC Mode of operation attribute file:
  256. 'edac_mode'
  257. This attribute file will display what type of Error detection
  258. and correction is being utilized.
  259. Device type attribute file:
  260. 'dev_type'
  261. This attribute file will display what type of DRAM device is
  262. being utilized on this DIMM.
  263. Examples:
  264. x1
  265. x2
  266. x4
  267. x8
  268. Channel 0 CE Count attribute file:
  269. 'ch0_ce_count'
  270. This attribute file will display the count of CEs on this
  271. DIMM located in channel 0.
  272. Channel 0 UE Count attribute file:
  273. 'ch0_ue_count'
  274. This attribute file will display the count of UEs on this
  275. DIMM located in channel 0.
  276. Channel 0 DIMM Label control file:
  277. 'ch0_dimm_label'
  278. This control file allows this DIMM to have a label assigned
  279. to it. With this label in the module, when errors occur
  280. the output can provide the DIMM label in the system log.
  281. This becomes vital for panic events to isolate the
  282. cause of the UE event.
  283. DIMM Labels must be assigned after booting, with information
  284. that correctly identifies the physical slot with its
  285. silk screen label. This information is currently very
  286. motherboard specific and determination of this information
  287. must occur in userland at this time.
  288. Channel 1 CE Count attribute file:
  289. 'ch1_ce_count'
  290. This attribute file will display the count of CEs on this
  291. DIMM located in channel 1.
  292. Channel 1 UE Count attribute file:
  293. 'ch1_ue_count'
  294. This attribute file will display the count of UEs on this
  295. DIMM located in channel 0.
  296. Channel 1 DIMM Label control file:
  297. 'ch1_dimm_label'
  298. This control file allows this DIMM to have a label assigned
  299. to it. With this label in the module, when errors occur
  300. the output can provide the DIMM label in the system log.
  301. This becomes vital for panic events to isolate the
  302. cause of the UE event.
  303. DIMM Labels must be assigned after booting, with information
  304. that correctly identifies the physical slot with its
  305. silk screen label. This information is currently very
  306. motherboard specific and determination of this information
  307. must occur in userland at this time.
  308. ============================================================================
  309. SYSTEM LOGGING
  310. If logging for UEs and CEs are enabled then system logs will have
  311. error notices indicating errors that have been detected:
  312. EDAC MC0: CE page 0x283, offset 0xce0, grain 8, syndrome 0x6ec3, row 0,
  313. channel 1 "DIMM_B1": amd76x_edac
  314. EDAC MC0: CE page 0x1e5, offset 0xfb0, grain 8, syndrome 0xb741, row 0,
  315. channel 1 "DIMM_B1": amd76x_edac
  316. The structure of the message is:
  317. the memory controller (MC0)
  318. Error type (CE)
  319. memory page (0x283)
  320. offset in the page (0xce0)
  321. the byte granularity (grain 8)
  322. or resolution of the error
  323. the error syndrome (0xb741)
  324. memory row (row 0)
  325. memory channel (channel 1)
  326. DIMM label, if set prior (DIMM B1
  327. and then an optional, driver-specific message that may
  328. have additional information.
  329. Both UEs and CEs with no info will lack all but memory controller,
  330. error type, a notice of "no info" and then an optional,
  331. driver-specific error message.
  332. ============================================================================
  333. PCI Bus Parity Detection
  334. On Header Type 00 devices the primary status is looked at
  335. for any parity error regardless of whether Parity is enabled on the
  336. device. (The spec indicates parity is generated in some cases).
  337. On Header Type 01 bridges, the secondary status register is also
  338. looked at to see if parity occurred on the bus on the other side of
  339. the bridge.
  340. SYSFS CONFIGURATION
  341. Under /sys/devices/system/edac/pci are control and attribute files as follows:
  342. Enable/Disable PCI Parity checking control file:
  343. 'check_pci_parity'
  344. This control file enables or disables the PCI Bus Parity scanning
  345. operation. Writing a 1 to this file enables the scanning. Writing
  346. a 0 to this file disables the scanning.
  347. Enable:
  348. echo "1" >/sys/devices/system/edac/pci/check_pci_parity
  349. Disable:
  350. echo "0" >/sys/devices/system/edac/pci/check_pci_parity
  351. Parity Count:
  352. 'pci_parity_count'
  353. This attribute file will display the number of parity errors that
  354. have been detected.
  355. ============================================================================
  356. MODULE PARAMETERS
  357. Panic on UE control file:
  358. 'edac_mc_panic_on_ue'
  359. An uncorrectable error will cause a machine panic. This is usually
  360. desirable. It is a bad idea to continue when an uncorrectable error
  361. occurs - it is indeterminate what was uncorrected and the operating
  362. system context might be so mangled that continuing will lead to further
  363. corruption. If the kernel has MCE configured, then EDAC will never
  364. notice the UE.
  365. LOAD TIME: module/kernel parameter: edac_mc_panic_on_ue=[0|1]
  366. RUN TIME: echo "1" > /sys/module/edac_core/parameters/edac_mc_panic_on_ue
  367. Log UE control file:
  368. 'edac_mc_log_ue'
  369. Generate kernel messages describing uncorrectable errors. These errors
  370. are reported through the system message log system. UE statistics
  371. will be accumulated even when UE logging is disabled.
  372. LOAD TIME: module/kernel parameter: edac_mc_log_ue=[0|1]
  373. RUN TIME: echo "1" > /sys/module/edac_core/parameters/edac_mc_log_ue
  374. Log CE control file:
  375. 'edac_mc_log_ce'
  376. Generate kernel messages describing correctable errors. These
  377. errors are reported through the system message log system.
  378. CE statistics will be accumulated even when CE logging is disabled.
  379. LOAD TIME: module/kernel parameter: edac_mc_log_ce=[0|1]
  380. RUN TIME: echo "1" > /sys/module/edac_core/parameters/edac_mc_log_ce
  381. Polling period control file:
  382. 'edac_mc_poll_msec'
  383. The time period, in milliseconds, for polling for error information.
  384. Too small a value wastes resources. Too large a value might delay
  385. necessary handling of errors and might loose valuable information for
  386. locating the error. 1000 milliseconds (once each second) is the current
  387. default. Systems which require all the bandwidth they can get, may
  388. increase this.
  389. LOAD TIME: module/kernel parameter: edac_mc_poll_msec=[0|1]
  390. RUN TIME: echo "1000" > /sys/module/edac_core/parameters/edac_mc_poll_msec
  391. Panic on PCI PARITY Error:
  392. 'panic_on_pci_parity'
  393. This control files enables or disables panicking when a parity
  394. error has been detected.
  395. module/kernel parameter: edac_panic_on_pci_pe=[0|1]
  396. Enable:
  397. echo "1" > /sys/module/edac_core/parameters/edac_panic_on_pci_pe
  398. Disable:
  399. echo "0" > /sys/module/edac_core/parameters/edac_panic_on_pci_pe
  400. =======================================================================
  401. EDAC_DEVICE type of device
  402. In the header file, edac_core.h, there is a series of edac_device structures
  403. and APIs for the EDAC_DEVICE.
  404. User space access to an edac_device is through the sysfs interface.
  405. At the location /sys/devices/system/edac (sysfs) new edac_device devices will
  406. appear.
  407. There is a three level tree beneath the above 'edac' directory. For example,
  408. the 'test_device_edac' device (found at the bluesmoke.sourceforget.net website)
  409. installs itself as:
  410. /sys/devices/systm/edac/test-instance
  411. in this directory are various controls, a symlink and one or more 'instance'
  412. directorys.
  413. The standard default controls are:
  414. log_ce boolean to log CE events
  415. log_ue boolean to log UE events
  416. panic_on_ue boolean to 'panic' the system if an UE is encountered
  417. (default off, can be set true via startup script)
  418. poll_msec time period between POLL cycles for events
  419. The test_device_edac device adds at least one of its own custom control:
  420. test_bits which in the current test driver does nothing but
  421. show how it is installed. A ported driver can
  422. add one or more such controls and/or attributes
  423. for specific uses.
  424. One out-of-tree driver uses controls here to allow
  425. for ERROR INJECTION operations to hardware
  426. injection registers
  427. The symlink points to the 'struct dev' that is registered for this edac_device.
  428. INSTANCES
  429. One or more instance directories are present. For the 'test_device_edac' case:
  430. test-instance0
  431. In this directory there are two default counter attributes, which are totals of
  432. counter in deeper subdirectories.
  433. ce_count total of CE events of subdirectories
  434. ue_count total of UE events of subdirectories
  435. BLOCKS
  436. At the lowest directory level is the 'block' directory. There can be 0, 1
  437. or more blocks specified in each instance.
  438. test-block0
  439. In this directory the default attributes are:
  440. ce_count which is counter of CE events for this 'block'
  441. of hardware being monitored
  442. ue_count which is counter of UE events for this 'block'
  443. of hardware being monitored
  444. The 'test_device_edac' device adds 4 attributes and 1 control:
  445. test-block-bits-0 for every POLL cycle this counter
  446. is incremented
  447. test-block-bits-1 every 10 cycles, this counter is bumped once,
  448. and test-block-bits-0 is set to 0
  449. test-block-bits-2 every 100 cycles, this counter is bumped once,
  450. and test-block-bits-1 is set to 0
  451. test-block-bits-3 every 1000 cycles, this counter is bumped once,
  452. and test-block-bits-2 is set to 0
  453. reset-counters writing ANY thing to this control will
  454. reset all the above counters.
  455. Use of the 'test_device_edac' driver should any others to create their own
  456. unique drivers for their hardware systems.
  457. The 'test_device_edac' sample driver is located at the
  458. bluesmoke.sourceforge.net project site for EDAC.
  459. =======================================================================
  460. NEHALEM USAGE OF EDAC APIs
  461. This chapter documents some EXPERIMENTAL mappings for EDAC API to handle
  462. Nehalem EDAC driver. They will likely be changed on future versions
  463. of the driver.
  464. Due to the way Nehalem exports Memory Controller data, some adjustments
  465. were done at i7core_edac driver. This chapter will cover those differences
  466. 1) On Nehalem, there are one Memory Controller per Quick Patch Interconnect
  467. (QPI). At the driver, the term "socket" means one QPI. This is
  468. associated with a physical CPU socket.
  469. Each MC have 3 physical read channels, 3 physical write channels and
  470. 3 logic channels. The driver currenty sees it as just 3 channels.
  471. Each channel can have up to 3 DIMMs.
  472. The minimum known unity is DIMMs. There are no information about csrows.
  473. As EDAC API maps the minimum unity is csrows, the driver sequencially
  474. maps channel/dimm into different csrows.
  475. For example, supposing the following layout:
  476. Ch0 phy rd0, wr0 (0x063f4031): 2 ranks, UDIMMs
  477. dimm 0 1024 Mb offset: 0, bank: 8, rank: 1, row: 0x4000, col: 0x400
  478. dimm 1 1024 Mb offset: 4, bank: 8, rank: 1, row: 0x4000, col: 0x400
  479. Ch1 phy rd1, wr1 (0x063f4031): 2 ranks, UDIMMs
  480. dimm 0 1024 Mb offset: 0, bank: 8, rank: 1, row: 0x4000, col: 0x400
  481. Ch2 phy rd3, wr3 (0x063f4031): 2 ranks, UDIMMs
  482. dimm 0 1024 Mb offset: 0, bank: 8, rank: 1, row: 0x4000, col: 0x400
  483. The driver will map it as:
  484. csrow0: channel 0, dimm0
  485. csrow1: channel 0, dimm1
  486. csrow2: channel 1, dimm0
  487. csrow3: channel 2, dimm0
  488. exports one
  489. DIMM per csrow.
  490. Each QPI is exported as a different memory controller.
  491. 2) Nehalem MC has the hability to generate errors. The driver implements this
  492. functionality via some error injection nodes:
  493. For injecting a memory error, there are some sysfs nodes, under
  494. /sys/devices/system/edac/mc/mc?/:
  495. inject_addrmatch/*:
  496. Controls the error injection mask register. It is possible to specify
  497. several characteristics of the address to match an error code:
  498. dimm = the affected dimm. Numbers are relative to a channel;
  499. rank = the memory rank;
  500. channel = the channel that will generate an error;
  501. bank = the affected bank;
  502. page = the page address;
  503. column (or col) = the address column.
  504. each of the above values can be set to "any" to match any valid value.
  505. At driver init, all values are set to any.
  506. For example, to generate an error at rank 1 of dimm 2, for any channel,
  507. any bank, any page, any column:
  508. echo 2 >/sys/devices/system/edac/mc/mc0/inject_addrmatch/dimm
  509. echo 1 >/sys/devices/system/edac/mc/mc0/inject_addrmatch/rank
  510. To return to the default behaviour of matching any, you can do:
  511. echo any >/sys/devices/system/edac/mc/mc0/inject_addrmatch/dimm
  512. echo any >/sys/devices/system/edac/mc/mc0/inject_addrmatch/rank
  513. inject_eccmask:
  514. specifies what bits will have troubles,
  515. inject_section:
  516. specifies what ECC cache section will get the error:
  517. 3 for both
  518. 2 for the highest
  519. 1 for the lowest
  520. inject_type:
  521. specifies the type of error, being a combination of the following bits:
  522. bit 0 - repeat
  523. bit 1 - ecc
  524. bit 2 - parity
  525. inject_enable starts the error generation when something different
  526. than 0 is written.
  527. All inject vars can be read. root permission is needed for write.
  528. Datasheet states that the error will only be generated after a write on an
  529. address that matches inject_addrmatch. It seems, however, that reading will
  530. also produce an error.
  531. For example, the following code will generate an error for any write access
  532. at socket 0, on any DIMM/address on channel 2:
  533. echo 2 >/sys/devices/system/edac/mc/mc0/inject_addrmatch/channel
  534. echo 2 >/sys/devices/system/edac/mc/mc0/inject_type
  535. echo 64 >/sys/devices/system/edac/mc/mc0/inject_eccmask
  536. echo 3 >/sys/devices/system/edac/mc/mc0/inject_section
  537. echo 1 >/sys/devices/system/edac/mc/mc0/inject_enable
  538. dd if=/dev/mem of=/dev/null seek=16k bs=4k count=1 >& /dev/null
  539. For socket 1, it is needed to replace "mc0" by "mc1" at the above
  540. commands.
  541. The generated error message will look like:
  542. EDAC MC0: UE row 0, channel-a= 0 channel-b= 0 labels "-": NON_FATAL (addr = 0x0075b980, socket=0, Dimm=0, Channel=2, syndrome=0x00000040, count=1, Err=8c0000400001009f:4000080482 (read error: read ECC error))
  543. 3) Nehalem specific Corrected Error memory counters
  544. Nehalem have some registers to count memory errors. The driver uses those
  545. registers to report Corrected Errors on devices with Registered Dimms.
  546. However, those counters don't work with Unregistered Dimms. As the chipset
  547. offers some counters that also work with UDIMMS (but with a worse level of
  548. granularity than the default ones), the driver exposes those registers for
  549. UDIMM memories.
  550. They can be read by looking at the contents of all_channel_counts/
  551. $ for i in /sys/devices/system/edac/mc/mc0/all_channel_counts/*; do echo $i; cat $i; done
  552. /sys/devices/system/edac/mc/mc0/all_channel_counts/udimm0
  553. 0
  554. /sys/devices/system/edac/mc/mc0/all_channel_counts/udimm1
  555. 0
  556. /sys/devices/system/edac/mc/mc0/all_channel_counts/udimm2
  557. 0
  558. What happens here is that errors on different csrows, but at the same
  559. dimm number will increment the same counter.
  560. So, in this memory mapping:
  561. csrow0: channel 0, dimm0
  562. csrow1: channel 0, dimm1
  563. csrow2: channel 1, dimm0
  564. csrow3: channel 2, dimm0
  565. The hardware will increment udimm0 for an error at the first dimm at either
  566. csrow0, csrow2 or csrow3;
  567. The hardware will increment udimm1 for an error at the second dimm at either
  568. csrow0, csrow2 or csrow3;
  569. The hardware will increment udimm2 for an error at the third dimm at either
  570. csrow0, csrow2 or csrow3;
  571. 4) Standard error counters
  572. The standard error counters are generated when an mcelog error is received
  573. by the driver. Since, with udimm, this is counted by software, it is
  574. possible that some errors could be lost. With rdimm's, they displays the
  575. contents of the registers