edac.txt 21 KB

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