main.rst 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. include:: <isonum.txt>
  3. ==================================================
  4. Reliability, Availability and Serviceability (RAS)
  5. ==================================================
  6. This documents different aspects of the RAS functionality present in the
  7. kernel.
  8. RAS concepts
  9. ************
  10. Reliability, Availability and Serviceability (RAS) is a concept used on
  11. servers meant to measure their robustness.
  12. Reliability
  13. is the probability that a system will produce correct outputs.
  14. * Generally measured as Mean Time Between Failures (MTBF)
  15. * Enhanced by features that help to avoid, detect and repair hardware faults
  16. Availability
  17. is the probability that a system is operational at a given time
  18. * Generally measured as a percentage of downtime per a period of time
  19. * Often uses mechanisms to detect and correct hardware faults in
  20. runtime;
  21. Serviceability (or maintainability)
  22. is the simplicity and speed with which a system can be repaired or
  23. maintained
  24. * Generally measured on Mean Time Between Repair (MTBR)
  25. Improving RAS
  26. -------------
  27. In order to reduce systems downtime, a system should be capable of detecting
  28. hardware errors, and, when possible correcting them in runtime. It should
  29. also provide mechanisms to detect hardware degradation, in order to warn
  30. the system administrator to take the action of replacing a component before
  31. it causes data loss or system downtime.
  32. Among the monitoring measures, the most usual ones include:
  33. * CPU – detect errors at instruction execution and at L1/L2/L3 caches;
  34. * Memory – add error correction logic (ECC) to detect and correct errors;
  35. * I/O – add CRC checksums for transferred data;
  36. * Storage – RAID, journal file systems, checksums,
  37. Self-Monitoring, Analysis and Reporting Technology (SMART).
  38. By monitoring the number of occurrences of error detections, it is possible
  39. to identify if the probability of hardware errors is increasing, and, on such
  40. case, do a preventive maintenance to replace a degraded component while
  41. those errors are correctable.
  42. Types of errors
  43. ---------------
  44. Most mechanisms used on modern systems use technologies like Hamming
  45. Codes that allow error correction when the number of errors on a bit packet
  46. is below a threshold. If the number of errors is above, those mechanisms
  47. can indicate with a high degree of confidence that an error happened, but
  48. they can't correct.
  49. Also, sometimes an error occur on a component that it is not used. For
  50. example, a part of the memory that it is not currently allocated.
  51. That defines some categories of errors:
  52. * **Correctable Error (CE)** - the error detection mechanism detected and
  53. corrected the error. Such errors are usually not fatal, although some
  54. Kernel mechanisms allow the system administrator to consider them as fatal.
  55. * **Uncorrected Error (UE)** - the amount of errors happened above the error
  56. correction threshold, and the system was unable to auto-correct.
  57. * **Fatal Error** - when an UE error happens on a critical component of the
  58. system (for example, a piece of the Kernel got corrupted by an UE), the
  59. only reliable way to avoid data corruption is to hang or reboot the machine.
  60. * **Non-fatal Error** - when an UE error happens on an unused component,
  61. like a CPU in power down state or an unused memory bank, the system may
  62. still run, eventually replacing the affected hardware by a hot spare,
  63. if available.
  64. Also, when an error happens on a userspace process, it is also possible to
  65. kill such process and let userspace restart it.
  66. The mechanism for handling non-fatal errors is usually complex and may
  67. require the help of some userspace application, in order to apply the
  68. policy desired by the system administrator.
  69. Identifying a bad hardware component
  70. ------------------------------------
  71. Just detecting a hardware flaw is usually not enough, as the system needs
  72. to pinpoint to the minimal replaceable unit (MRU) that should be exchanged
  73. to make the hardware reliable again.
  74. So, it requires not only error logging facilities, but also mechanisms that
  75. will translate the error message to the silkscreen or component label for
  76. the MRU.
  77. Typically, it is very complex for memory, as modern CPUs interlace memory
  78. from different memory modules, in order to provide a better performance. The
  79. DMI BIOS usually have a list of memory module labels, with can be obtained
  80. using the ``dmidecode`` tool. For example, on a desktop machine, it shows::
  81. Memory Device
  82. Total Width: 64 bits
  83. Data Width: 64 bits
  84. Size: 16384 MB
  85. Form Factor: SODIMM
  86. Set: None
  87. Locator: ChannelA-DIMM0
  88. Bank Locator: BANK 0
  89. Type: DDR4
  90. Type Detail: Synchronous
  91. Speed: 2133 MHz
  92. Rank: 2
  93. Configured Clock Speed: 2133 MHz
  94. On the above example, a DDR4 SO-DIMM memory module is located at the
  95. system's memory labeled as "BANK 0", as given by the *bank locator* field.
  96. Please notice that, on such system, the *total width* is equal to the
  97. *data width*. It means that such memory module doesn't have error
  98. detection/correction mechanisms.
  99. Unfortunately, not all systems use the same field to specify the memory
  100. bank. On this example, from an older server, ``dmidecode`` shows::
  101. Memory Device
  102. Array Handle: 0x1000
  103. Error Information Handle: Not Provided
  104. Total Width: 72 bits
  105. Data Width: 64 bits
  106. Size: 8192 MB
  107. Form Factor: DIMM
  108. Set: 1
  109. Locator: DIMM_A1
  110. Bank Locator: Not Specified
  111. Type: DDR3
  112. Type Detail: Synchronous Registered (Buffered)
  113. Speed: 1600 MHz
  114. Rank: 2
  115. Configured Clock Speed: 1600 MHz
  116. There, the DDR3 RDIMM memory module is located at the system's memory labeled
  117. as "DIMM_A1", as given by the *locator* field. Please notice that this
  118. memory module has 64 bits of *data width* and 72 bits of *total width*. So,
  119. it has 8 extra bits to be used by error detection and correction mechanisms.
  120. Such kind of memory is called Error-correcting code memory (ECC memory).
  121. To make things even worse, it is not uncommon that systems with different
  122. labels on their system's board to use exactly the same BIOS, meaning that
  123. the labels provided by the BIOS won't match the real ones.
  124. ECC memory
  125. ----------
  126. As mentioned in the previous section, ECC memory has extra bits to be
  127. used for error correction. In the above example, a memory module has
  128. 64 bits of *data width*, and 72 bits of *total width*. The extra 8
  129. bits which are used for the error detection and correction mechanisms
  130. are referred to as the *syndrome*\ [#f1]_\ [#f2]_.
  131. So, when the cpu requests the memory controller to write a word with
  132. *data width*, the memory controller calculates the *syndrome* in real time,
  133. using Hamming code, or some other error correction code, like SECDED+,
  134. producing a code with *total width* size. Such code is then written
  135. on the memory modules.
  136. At read, the *total width* bits code is converted back, using the same
  137. ECC code used on write, producing a word with *data width* and a *syndrome*.
  138. The word with *data width* is sent to the CPU, even when errors happen.
  139. The memory controller also looks at the *syndrome* in order to check if
  140. there was an error, and if the ECC code was able to fix such error.
  141. If the error was corrected, a Corrected Error (CE) happened. If not, an
  142. Uncorrected Error (UE) happened.
  143. The information about the CE/UE errors is stored on some special registers
  144. at the memory controller and can be accessed by reading such registers,
  145. either by BIOS, by some special CPUs or by Linux EDAC driver. On x86 64
  146. bit CPUs, such errors can also be retrieved via the Machine Check
  147. Architecture (MCA)\ [#f3]_.
  148. .. [#f1] Please notice that several memory controllers allow operation on a
  149. mode called "Lock-Step", where it groups two memory modules together,
  150. doing 128-bit reads/writes. That gives 16 bits for error correction, with
  151. significantly improves the error correction mechanism, at the expense
  152. that, when an error happens, there's no way to know what memory module is
  153. to blame. So, it has to blame both memory modules.
  154. .. [#f2] Some memory controllers also allow using memory in mirror mode.
  155. On such mode, the same data is written to two memory modules. At read,
  156. the system checks both memory modules, in order to check if both provide
  157. identical data. On such configuration, when an error happens, there's no
  158. way to know what memory module is to blame. So, it has to blame both
  159. memory modules (or 4 memory modules, if the system is also on Lock-step
  160. mode).
  161. .. [#f3] For more details about the Machine Check Architecture (MCA),
  162. please read Documentation/arch/x86/x86_64/machinecheck.rst at the Kernel tree.
  163. EDAC - Error Detection And Correction
  164. *************************************
  165. .. note::
  166. "bluesmoke" was the name for this device driver subsystem when it
  167. was "out-of-tree" and maintained at http://bluesmoke.sourceforge.net.
  168. That site is mostly archaic now and can be used only for historical
  169. purposes.
  170. When the subsystem was pushed upstream for the first time, on
  171. Kernel 2.6.16, it was renamed to ``EDAC``.
  172. Purpose
  173. -------
  174. The ``edac`` kernel module's goal is to detect and report hardware errors
  175. that occur within the computer system running under linux.
  176. Memory
  177. ------
  178. Memory Correctable Errors (CE) and Uncorrectable Errors (UE) are the
  179. primary errors being harvested. These types of errors are harvested by
  180. the ``edac_mc`` device.
  181. Detecting CE events, then harvesting those events and reporting them,
  182. **can** but must not necessarily be a predictor of future UE events. With
  183. CE events only, the system can and will continue to operate as no data
  184. has been damaged yet.
  185. However, preventive maintenance and proactive part replacement of memory
  186. modules exhibiting CEs can reduce the likelihood of the dreaded UE events
  187. and system panics.
  188. Other hardware elements
  189. -----------------------
  190. A new feature for EDAC, the ``edac_device`` class of device, was added in
  191. the 2.6.23 version of the kernel.
  192. This new device type allows for non-memory type of ECC hardware detectors
  193. to have their states harvested and presented to userspace via the sysfs
  194. interface.
  195. Some architectures have ECC detectors for L1, L2 and L3 caches,
  196. along with DMA engines, fabric switches, main data path switches,
  197. interconnections, and various other hardware data paths. If the hardware
  198. reports it, then an edac_device device probably can be constructed to
  199. harvest and present that to userspace.
  200. PCI bus scanning
  201. ----------------
  202. In addition, PCI devices are scanned for PCI Bus Parity and SERR Errors
  203. in order to determine if errors are occurring during data transfers.
  204. The presence of PCI Parity errors must be examined with a grain of salt.
  205. There are several add-in adapters that do **not** follow the PCI specification
  206. with regards to Parity generation and reporting. The specification says
  207. the vendor should tie the parity status bits to 0 if they do not intend
  208. to generate parity. Some vendors do not do this, and thus the parity bit
  209. can "float" giving false positives.
  210. There is a PCI device attribute located in sysfs that is checked by
  211. the EDAC PCI scanning code. If that attribute is set, PCI parity/error
  212. scanning is skipped for that device. The attribute is::
  213. broken_parity_status
  214. and is located in ``/sys/devices/pci<XXX>/0000:XX:YY.Z`` directories for
  215. PCI devices.
  216. Versioning
  217. ----------
  218. EDAC is composed of a "core" module (``edac_core.ko``) and several Memory
  219. Controller (MC) driver modules. On a given system, the CORE is loaded
  220. and one MC driver will be loaded. Both the CORE and the MC driver (or
  221. ``edac_device`` driver) have individual versions that reflect current
  222. release level of their respective modules.
  223. Thus, to "report" on what version a system is running, one must report
  224. both the CORE's and the MC driver's versions.
  225. Loading
  226. -------
  227. If ``edac`` was statically linked with the kernel then no loading
  228. is necessary. If ``edac`` was built as modules then simply modprobe
  229. the ``edac`` pieces that you need. You should be able to modprobe
  230. hardware-specific modules and have the dependencies load the necessary
  231. core modules.
  232. Example::
  233. $ modprobe amd76x_edac
  234. loads both the ``amd76x_edac.ko`` memory controller module and the
  235. ``edac_mc.ko`` core module.
  236. Sysfs interface
  237. ---------------
  238. EDAC presents a ``sysfs`` interface for control and reporting purposes. It
  239. lives in the /sys/devices/system/edac directory.
  240. Within this directory there currently reside 2 components:
  241. ======= ==============================
  242. mc memory controller(s) system
  243. pci PCI control and status system
  244. ======= ==============================
  245. Memory Controller (mc) Model
  246. ----------------------------
  247. Each ``mc`` device controls a set of memory modules [#f4]_. These modules
  248. are laid out in a Chip-Select Row (``csrowX``) and Channel table (``chX``).
  249. There can be multiple csrows and multiple channels.
  250. .. [#f4] Nowadays, the term DIMM (Dual In-line Memory Module) is widely
  251. used to refer to a memory module, although there are other memory
  252. packaging alternatives, like SO-DIMM, SIMM, etc. The UEFI
  253. specification (Version 2.7) defines a memory module in the Common
  254. Platform Error Record (CPER) section to be an SMBIOS Memory Device
  255. (Type 17). Along this document, and inside the EDAC subsystem, the term
  256. "dimm" is used for all memory modules, even when they use a
  257. different kind of packaging.
  258. Memory controllers allow for several csrows, with 8 csrows being a
  259. typical value. Yet, the actual number of csrows depends on the layout of
  260. a given motherboard, memory controller and memory module characteristics.
  261. Dual channels allow for dual data length (e. g. 128 bits, on 64 bit systems)
  262. data transfers to/from the CPU from/to memory. Some newer chipsets allow
  263. for more than 2 channels, like Fully Buffered DIMMs (FB-DIMMs) memory
  264. controllers. The following example will assume 2 channels:
  265. +------------+-----------------------+
  266. | CS Rows | Channels |
  267. +------------+-----------+-----------+
  268. | | ``ch0`` | ``ch1`` |
  269. +============+===========+===========+
  270. | |**DIMM_A0**|**DIMM_B0**|
  271. +------------+-----------+-----------+
  272. | ``csrow0`` | rank0 | rank0 |
  273. +------------+-----------+-----------+
  274. | ``csrow1`` | rank1 | rank1 |
  275. +------------+-----------+-----------+
  276. | |**DIMM_A1**|**DIMM_B1**|
  277. +------------+-----------+-----------+
  278. | ``csrow2`` | rank0 | rank0 |
  279. +------------+-----------+-----------+
  280. | ``csrow3`` | rank1 | rank1 |
  281. +------------+-----------+-----------+
  282. In the above example, there are 4 physical slots on the motherboard
  283. for memory DIMMs:
  284. +---------+---------+
  285. | DIMM_A0 | DIMM_B0 |
  286. +---------+---------+
  287. | DIMM_A1 | DIMM_B1 |
  288. +---------+---------+
  289. Labels for these slots are usually silk-screened on the motherboard.
  290. Slots labeled ``A`` are channel 0 in this example. Slots labeled ``B`` are
  291. channel 1. Notice that there are two csrows possible on a physical DIMM.
  292. These csrows are allocated their csrow assignment based on the slot into
  293. which the memory DIMM is placed. Thus, when 1 DIMM is placed in each
  294. Channel, the csrows cross both DIMMs.
  295. Memory DIMMs come single or dual "ranked". A rank is a populated csrow.
  296. In the example above 2 dual ranked DIMMs are similarly placed. Thus,
  297. both csrow0 and csrow1 are populated. On the other hand, when 2 single
  298. ranked DIMMs are placed in slots DIMM_A0 and DIMM_B0, then they will
  299. have just one csrow (csrow0) and csrow1 will be empty. The pattern
  300. repeats itself for csrow2 and csrow3. Also note that some memory
  301. controllers don't have any logic to identify the memory module, see
  302. ``rankX`` directories below.
  303. The representation of the above is reflected in the directory
  304. tree in EDAC's sysfs interface. Starting in directory
  305. ``/sys/devices/system/edac/mc``, each memory controller will be
  306. represented by its own ``mcX`` directory, where ``X`` is the
  307. index of the MC::
  308. ..../edac/mc/
  309. |
  310. |->mc0
  311. |->mc1
  312. |->mc2
  313. ....
  314. Within each of the ``mcX`` directory are several EDAC control and
  315. attribute files.
  316. ``mcX`` directories
  317. -------------------
  318. In ``mcX`` directories are EDAC control and attribute files for
  319. this ``X`` instance of the memory controllers.
  320. For a description of the sysfs API, please see:
  321. Documentation/ABI/testing/sysfs-devices-edac
  322. ``dimmX`` or ``rankX`` directories
  323. ----------------------------------
  324. The recommended way to use the EDAC subsystem is to look at the information
  325. provided by the ``dimmX`` or ``rankX`` directories [#f5]_.
  326. A typical EDAC system has the following structure under
  327. ``/sys/devices/system/edac/``\ [#f6]_::
  328. /sys/devices/system/edac/
  329. ├── mc
  330. │   ├── mc0
  331. │   │   ├── ce_count
  332. │   │   ├── ce_noinfo_count
  333. │   │   ├── dimm0
  334. │   │   │   ├── dimm_ce_count
  335. │   │   │   ├── dimm_dev_type
  336. │   │   │   ├── dimm_edac_mode
  337. │   │   │   ├── dimm_label
  338. │   │   │   ├── dimm_location
  339. │   │   │   ├── dimm_mem_type
  340. │   │   │   ├── dimm_ue_count
  341. │   │   │   ├── size
  342. │   │   │   └── uevent
  343. │   │   ├── max_location
  344. │   │   ├── mc_name
  345. │   │   ├── reset_counters
  346. │   │   ├── seconds_since_reset
  347. │   │   ├── size_mb
  348. │   │   ├── ue_count
  349. │   │   ├── ue_noinfo_count
  350. │   │   └── uevent
  351. │   ├── mc1
  352. │   │   ├── ce_count
  353. │   │   ├── ce_noinfo_count
  354. │   │   ├── dimm0
  355. │   │   │   ├── dimm_ce_count
  356. │   │   │   ├── dimm_dev_type
  357. │   │   │   ├── dimm_edac_mode
  358. │   │   │   ├── dimm_label
  359. │   │   │   ├── dimm_location
  360. │   │   │   ├── dimm_mem_type
  361. │   │   │   ├── dimm_ue_count
  362. │   │   │   ├── size
  363. │   │   │   └── uevent
  364. │   │   ├── max_location
  365. │   │   ├── mc_name
  366. │   │   ├── reset_counters
  367. │   │   ├── seconds_since_reset
  368. │   │   ├── size_mb
  369. │   │   ├── ue_count
  370. │   │   ├── ue_noinfo_count
  371. │   │   └── uevent
  372. │   └── uevent
  373. └── uevent
  374. In the ``dimmX`` directories are EDAC control and attribute files for
  375. this ``X`` memory module:
  376. - ``size`` - Total memory managed by this csrow attribute file
  377. This attribute file displays, in count of megabytes, the memory
  378. that this csrow contains.
  379. - ``dimm_ue_count`` - Uncorrectable Errors count attribute file
  380. This attribute file displays the total count of uncorrectable
  381. errors that have occurred on this DIMM. If panic_on_ue is set
  382. this counter will not have a chance to increment, since EDAC
  383. will panic the system.
  384. - ``dimm_ce_count`` - Correctable Errors count attribute file
  385. This attribute file displays the total count of correctable
  386. errors that have occurred on this DIMM. This count is very
  387. important to examine. CEs provide early indications that a
  388. DIMM is beginning to fail. This count field should be
  389. monitored for non-zero values and report such information
  390. to the system administrator.
  391. - ``dimm_dev_type`` - Device type attribute file
  392. This attribute file will display what type of DRAM device is
  393. being utilized on this DIMM.
  394. Examples:
  395. - x1
  396. - x2
  397. - x4
  398. - x8
  399. - ``dimm_edac_mode`` - EDAC Mode of operation attribute file
  400. This attribute file will display what type of Error detection
  401. and correction is being utilized.
  402. - ``dimm_label`` - memory module label control file
  403. This control file allows this DIMM to have a label assigned
  404. to it. With this label in the module, when errors occur
  405. the output can provide the DIMM label in the system log.
  406. This becomes vital for panic events to isolate the
  407. cause of the UE event.
  408. DIMM Labels must be assigned after booting, with information
  409. that correctly identifies the physical slot with its
  410. silk screen label. This information is currently very
  411. motherboard specific and determination of this information
  412. must occur in userland at this time.
  413. - ``dimm_location`` - location of the memory module
  414. The location can have up to 3 levels, and describe how the
  415. memory controller identifies the location of a memory module.
  416. Depending on the type of memory and memory controller, it
  417. can be:
  418. - *csrow* and *channel* - used when the memory controller
  419. doesn't identify a single DIMM - e. g. in ``rankX`` dir;
  420. - *branch*, *channel*, *slot* - typically used on FB-DIMM memory
  421. controllers;
  422. - *channel*, *slot* - used on Nehalem and newer Intel drivers.
  423. - ``dimm_mem_type`` - Memory Type attribute file
  424. This attribute file will display what type of memory is currently
  425. on this csrow. Normally, either buffered or unbuffered memory.
  426. Examples:
  427. - Registered-DDR
  428. - Unbuffered-DDR
  429. .. [#f5] On some systems, the memory controller doesn't have any logic
  430. to identify the memory module. On such systems, the directory is called ``rankX``.
  431. On modern Intel memory controllers, the memory controller identifies the
  432. memory modules directly. On such systems, the directory is called ``dimmX``.
  433. .. [#f6] There are also some ``power`` directories and ``subsystem``
  434. symlinks inside the sysfs mapping that are automatically created by
  435. the sysfs subsystem. Currently, they serve no purpose.
  436. System Logging
  437. --------------
  438. If logging for UEs and CEs is enabled, then system logs will contain
  439. information indicating that errors have been detected::
  440. EDAC MC0: CE page 0x283, offset 0xce0, grain 8, syndrome 0x6ec3, row 0, channel 1 "DIMM_B1": amd76x_edac
  441. EDAC MC0: CE page 0x1e5, offset 0xfb0, grain 8, syndrome 0xb741, row 0, channel 1 "DIMM_B1": amd76x_edac
  442. The structure of the message is:
  443. +---------------------------------------+-------------+
  444. | Content | Example |
  445. +=======================================+=============+
  446. | The memory controller | MC0 |
  447. +---------------------------------------+-------------+
  448. | Error type | CE |
  449. +---------------------------------------+-------------+
  450. | Memory page | 0x283 |
  451. +---------------------------------------+-------------+
  452. | Offset in the page | 0xce0 |
  453. +---------------------------------------+-------------+
  454. | The byte granularity | grain 8 |
  455. | or resolution of the error | |
  456. +---------------------------------------+-------------+
  457. | The error syndrome | 0xb741 |
  458. +---------------------------------------+-------------+
  459. | Memory row | row 0 |
  460. +---------------------------------------+-------------+
  461. | Memory channel | channel 1 |
  462. +---------------------------------------+-------------+
  463. | DIMM label, if set prior | DIMM B1 |
  464. +---------------------------------------+-------------+
  465. | And then an optional, driver-specific | |
  466. | message that may have additional | |
  467. | information. | |
  468. +---------------------------------------+-------------+
  469. Both UEs and CEs with no info will lack all but memory controller, error
  470. type, a notice of "no info" and then an optional, driver-specific error
  471. message.
  472. PCI Bus Parity Detection
  473. ------------------------
  474. On Header Type 00 devices, the primary status is looked at for any
  475. parity error regardless of whether parity is enabled on the device or
  476. not. (The spec indicates parity is generated in some cases). On Header
  477. Type 01 bridges, the secondary status register is also looked at to see
  478. if parity occurred on the bus on the other side of the bridge.
  479. Sysfs configuration
  480. -------------------
  481. Under ``/sys/devices/system/edac/pci`` are control and attribute files as
  482. follows:
  483. - ``check_pci_parity`` - Enable/Disable PCI Parity checking control file
  484. This control file enables or disables the PCI Bus Parity scanning
  485. operation. Writing a 1 to this file enables the scanning. Writing
  486. a 0 to this file disables the scanning.
  487. Enable::
  488. echo "1" >/sys/devices/system/edac/pci/check_pci_parity
  489. Disable::
  490. echo "0" >/sys/devices/system/edac/pci/check_pci_parity
  491. - ``pci_parity_count`` - Parity Count
  492. This attribute file will display the number of parity errors that
  493. have been detected.
  494. Module parameters
  495. -----------------
  496. - ``edac_mc_panic_on_ue`` - Panic on UE control file
  497. An uncorrectable error will cause a machine panic. This is usually
  498. desirable. It is a bad idea to continue when an uncorrectable error
  499. occurs - it is indeterminate what was uncorrected and the operating
  500. system context might be so mangled that continuing will lead to further
  501. corruption. If the kernel has MCE configured, then EDAC will never
  502. notice the UE.
  503. LOAD TIME::
  504. module/kernel parameter: edac_mc_panic_on_ue=[0|1]
  505. RUN TIME::
  506. echo "1" > /sys/module/edac_core/parameters/edac_mc_panic_on_ue
  507. - ``edac_mc_log_ue`` - Log UE control file
  508. Generate kernel messages describing uncorrectable errors. These errors
  509. are reported through the system message log system. UE statistics
  510. will be accumulated even when UE logging is disabled.
  511. LOAD TIME::
  512. module/kernel parameter: edac_mc_log_ue=[0|1]
  513. RUN TIME::
  514. echo "1" > /sys/module/edac_core/parameters/edac_mc_log_ue
  515. - ``edac_mc_log_ce`` - Log CE control file
  516. Generate kernel messages describing correctable errors. These
  517. errors are reported through the system message log system.
  518. CE statistics will be accumulated even when CE logging is disabled.
  519. LOAD TIME::
  520. module/kernel parameter: edac_mc_log_ce=[0|1]
  521. RUN TIME::
  522. echo "1" > /sys/module/edac_core/parameters/edac_mc_log_ce
  523. - ``edac_mc_poll_msec`` - Polling period control file
  524. The time period, in milliseconds, for polling for error information.
  525. Too small a value wastes resources. Too large a value might delay
  526. necessary handling of errors and might loose valuable information for
  527. locating the error. 1000 milliseconds (once each second) is the current
  528. default. Systems which require all the bandwidth they can get, may
  529. increase this.
  530. LOAD TIME::
  531. module/kernel parameter: edac_mc_poll_msec=[0|1]
  532. RUN TIME::
  533. echo "1000" > /sys/module/edac_core/parameters/edac_mc_poll_msec
  534. - ``panic_on_pci_parity`` - Panic on PCI PARITY Error
  535. This control file enables or disables panicking when a parity
  536. error has been detected.
  537. module/kernel parameter::
  538. edac_panic_on_pci_pe=[0|1]
  539. Enable::
  540. echo "1" > /sys/module/edac_core/parameters/edac_panic_on_pci_pe
  541. Disable::
  542. echo "0" > /sys/module/edac_core/parameters/edac_panic_on_pci_pe
  543. EDAC device type
  544. ----------------
  545. In the header file, edac_pci.h, there is a series of edac_device structures
  546. and APIs for the EDAC_DEVICE.
  547. User space access to an edac_device is through the sysfs interface.
  548. At the location ``/sys/devices/system/edac`` (sysfs) new edac_device devices
  549. will appear.
  550. There is a three level tree beneath the above ``edac`` directory. For example,
  551. the ``test_device_edac`` device (found at the http://bluesmoke.sourceforget.net
  552. website) installs itself as::
  553. /sys/devices/system/edac/test-instance
  554. in this directory are various controls, a symlink and one or more ``instance``
  555. directories.
  556. The standard default controls are:
  557. ============== =======================================================
  558. log_ce boolean to log CE events
  559. log_ue boolean to log UE events
  560. panic_on_ue boolean to ``panic`` the system if an UE is encountered
  561. (default off, can be set true via startup script)
  562. poll_msec time period between POLL cycles for events
  563. ============== =======================================================
  564. The test_device_edac device adds at least one of its own custom control:
  565. ============== ==================================================
  566. test_bits which in the current test driver does nothing but
  567. show how it is installed. A ported driver can
  568. add one or more such controls and/or attributes
  569. for specific uses.
  570. One out-of-tree driver uses controls here to allow
  571. for ERROR INJECTION operations to hardware
  572. injection registers
  573. ============== ==================================================
  574. The symlink points to the 'struct dev' that is registered for this edac_device.
  575. Instances
  576. ---------
  577. One or more instance directories are present. For the ``test_device_edac``
  578. case:
  579. +----------------+
  580. | test-instance0 |
  581. +----------------+
  582. In this directory there are two default counter attributes, which are totals of
  583. counter in deeper subdirectories.
  584. ============== ====================================
  585. ce_count total of CE events of subdirectories
  586. ue_count total of UE events of subdirectories
  587. ============== ====================================
  588. Blocks
  589. ------
  590. At the lowest directory level is the ``block`` directory. There can be 0, 1
  591. or more blocks specified in each instance:
  592. +-------------+
  593. | test-block0 |
  594. +-------------+
  595. In this directory the default attributes are:
  596. ============== ================================================
  597. ce_count which is counter of CE events for this ``block``
  598. of hardware being monitored
  599. ue_count which is counter of UE events for this ``block``
  600. of hardware being monitored
  601. ============== ================================================
  602. The ``test_device_edac`` device adds 4 attributes and 1 control:
  603. ================== ====================================================
  604. test-block-bits-0 for every POLL cycle this counter
  605. is incremented
  606. test-block-bits-1 every 10 cycles, this counter is bumped once,
  607. and test-block-bits-0 is set to 0
  608. test-block-bits-2 every 100 cycles, this counter is bumped once,
  609. and test-block-bits-1 is set to 0
  610. test-block-bits-3 every 1000 cycles, this counter is bumped once,
  611. and test-block-bits-2 is set to 0
  612. ================== ====================================================
  613. ================== ====================================================
  614. reset-counters writing ANY thing to this control will
  615. reset all the above counters.
  616. ================== ====================================================
  617. Use of the ``test_device_edac`` driver should enable any others to create their own
  618. unique drivers for their hardware systems.
  619. The ``test_device_edac`` sample driver is located at the
  620. http://bluesmoke.sourceforge.net project site for EDAC.
  621. Usage of EDAC APIs on Nehalem and newer Intel CPUs
  622. --------------------------------------------------
  623. On older Intel architectures, the memory controller was part of the North
  624. Bridge chipset. Nehalem, Sandy Bridge, Ivy Bridge, Haswell, Sky Lake and
  625. newer Intel architectures integrated an enhanced version of the memory
  626. controller (MC) inside the CPUs.
  627. This chapter will cover the differences of the enhanced memory controllers
  628. found on newer Intel CPUs, such as ``i7core_edac``, ``sb_edac`` and
  629. ``sbx_edac`` drivers.
  630. .. note::
  631. The Xeon E7 processor families use a separate chip for the memory
  632. controller, called Intel Scalable Memory Buffer. This section doesn't
  633. apply for such families.
  634. 1) There is one Memory Controller per Quick Patch Interconnect
  635. (QPI). At the driver, the term "socket" means one QPI. This is
  636. associated with a physical CPU socket.
  637. Each MC have 3 physical read channels, 3 physical write channels and
  638. 3 logic channels. The driver currently sees it as just 3 channels.
  639. Each channel can have up to 3 DIMMs.
  640. The minimum known unity is DIMMs. There are no information about csrows.
  641. As EDAC API maps the minimum unity is csrows, the driver sequentially
  642. maps channel/DIMM into different csrows.
  643. For example, supposing the following layout::
  644. Ch0 phy rd0, wr0 (0x063f4031): 2 ranks, UDIMMs
  645. dimm 0 1024 Mb offset: 0, bank: 8, rank: 1, row: 0x4000, col: 0x400
  646. dimm 1 1024 Mb offset: 4, bank: 8, rank: 1, row: 0x4000, col: 0x400
  647. Ch1 phy rd1, wr1 (0x063f4031): 2 ranks, UDIMMs
  648. dimm 0 1024 Mb offset: 0, bank: 8, rank: 1, row: 0x4000, col: 0x400
  649. Ch2 phy rd3, wr3 (0x063f4031): 2 ranks, UDIMMs
  650. dimm 0 1024 Mb offset: 0, bank: 8, rank: 1, row: 0x4000, col: 0x400
  651. The driver will map it as::
  652. csrow0: channel 0, dimm0
  653. csrow1: channel 0, dimm1
  654. csrow2: channel 1, dimm0
  655. csrow3: channel 2, dimm0
  656. exports one DIMM per csrow.
  657. Each QPI is exported as a different memory controller.
  658. 2) The MC has the ability to inject errors to test drivers. The drivers
  659. implement this functionality via some error injection nodes:
  660. For injecting a memory error, there are some sysfs nodes, under
  661. ``/sys/devices/system/edac/mc/mc?/``:
  662. - ``inject_addrmatch/*``:
  663. Controls the error injection mask register. It is possible to specify
  664. several characteristics of the address to match an error code::
  665. dimm = the affected dimm. Numbers are relative to a channel;
  666. rank = the memory rank;
  667. channel = the channel that will generate an error;
  668. bank = the affected bank;
  669. page = the page address;
  670. column (or col) = the address column.
  671. each of the above values can be set to "any" to match any valid value.
  672. At driver init, all values are set to any.
  673. For example, to generate an error at rank 1 of dimm 2, for any channel,
  674. any bank, any page, any column::
  675. echo 2 >/sys/devices/system/edac/mc/mc0/inject_addrmatch/dimm
  676. echo 1 >/sys/devices/system/edac/mc/mc0/inject_addrmatch/rank
  677. To return to the default behaviour of matching any, you can do::
  678. echo any >/sys/devices/system/edac/mc/mc0/inject_addrmatch/dimm
  679. echo any >/sys/devices/system/edac/mc/mc0/inject_addrmatch/rank
  680. - ``inject_eccmask``:
  681. specifies what bits will have troubles,
  682. - ``inject_section``:
  683. specifies what ECC cache section will get the error::
  684. 3 for both
  685. 2 for the highest
  686. 1 for the lowest
  687. - ``inject_type``:
  688. specifies the type of error, being a combination of the following bits::
  689. bit 0 - repeat
  690. bit 1 - ecc
  691. bit 2 - parity
  692. - ``inject_enable``:
  693. starts the error generation when something different than 0 is written.
  694. All inject vars can be read. root permission is needed for write.
  695. Datasheet states that the error will only be generated after a write on an
  696. address that matches inject_addrmatch. It seems, however, that reading will
  697. also produce an error.
  698. For example, the following code will generate an error for any write access
  699. at socket 0, on any DIMM/address on channel 2::
  700. echo 2 >/sys/devices/system/edac/mc/mc0/inject_addrmatch/channel
  701. echo 2 >/sys/devices/system/edac/mc/mc0/inject_type
  702. echo 64 >/sys/devices/system/edac/mc/mc0/inject_eccmask
  703. echo 3 >/sys/devices/system/edac/mc/mc0/inject_section
  704. echo 1 >/sys/devices/system/edac/mc/mc0/inject_enable
  705. dd if=/dev/mem of=/dev/null seek=16k bs=4k count=1 >& /dev/null
  706. For socket 1, it is needed to replace "mc0" by "mc1" at the above
  707. commands.
  708. The generated error message will look like::
  709. 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))
  710. 3) Corrected Error memory register counters
  711. Those newer MCs have some registers to count memory errors. The driver
  712. uses those registers to report Corrected Errors on devices with Registered
  713. DIMMs.
  714. However, those counters don't work with Unregistered DIMM. As the chipset
  715. offers some counters that also work with UDIMMs (but with a worse level of
  716. granularity than the default ones), the driver exposes those registers for
  717. UDIMM memories.
  718. They can be read by looking at the contents of ``all_channel_counts/``::
  719. $ for i in /sys/devices/system/edac/mc/mc0/all_channel_counts/*; do echo $i; cat $i; done
  720. /sys/devices/system/edac/mc/mc0/all_channel_counts/udimm0
  721. 0
  722. /sys/devices/system/edac/mc/mc0/all_channel_counts/udimm1
  723. 0
  724. /sys/devices/system/edac/mc/mc0/all_channel_counts/udimm2
  725. 0
  726. What happens here is that errors on different csrows, but at the same
  727. dimm number will increment the same counter.
  728. So, in this memory mapping::
  729. csrow0: channel 0, dimm0
  730. csrow1: channel 0, dimm1
  731. csrow2: channel 1, dimm0
  732. csrow3: channel 2, dimm0
  733. The hardware will increment udimm0 for an error at the first dimm at either
  734. csrow0, csrow2 or csrow3;
  735. The hardware will increment udimm1 for an error at the second dimm at either
  736. csrow0, csrow2 or csrow3;
  737. The hardware will increment udimm2 for an error at the third dimm at either
  738. csrow0, csrow2 or csrow3;
  739. 4) Standard error counters
  740. The standard error counters are generated when an mcelog error is received
  741. by the driver. Since, with UDIMM, this is counted by software, it is
  742. possible that some errors could be lost. With RDIMM's, they display the
  743. contents of the registers
  744. Reference documents used on ``amd64_edac``
  745. ------------------------------------------
  746. ``amd64_edac`` module is based on the following documents
  747. (available from http://support.amd.com/en-us/search/tech-docs):
  748. 1. :Title: BIOS and Kernel Developer's Guide for AMD Athlon 64 and AMD
  749. Opteron Processors
  750. :AMD publication #: 26094
  751. :Revision: 3.26
  752. :Link: http://support.amd.com/TechDocs/26094.PDF
  753. 2. :Title: BIOS and Kernel Developer's Guide for AMD NPT Family 0Fh
  754. Processors
  755. :AMD publication #: 32559
  756. :Revision: 3.00
  757. :Issue Date: May 2006
  758. :Link: http://support.amd.com/TechDocs/32559.pdf
  759. 3. :Title: BIOS and Kernel Developer's Guide (BKDG) For AMD Family 10h
  760. Processors
  761. :AMD publication #: 31116
  762. :Revision: 3.00
  763. :Issue Date: September 07, 2007
  764. :Link: http://support.amd.com/TechDocs/31116.pdf
  765. 4. :Title: BIOS and Kernel Developer's Guide (BKDG) for AMD Family 15h
  766. Models 30h-3Fh Processors
  767. :AMD publication #: 49125
  768. :Revision: 3.06
  769. :Issue Date: 2/12/2015 (latest release)
  770. :Link: http://support.amd.com/TechDocs/49125_15h_Models_30h-3Fh_BKDG.pdf
  771. 5. :Title: BIOS and Kernel Developer's Guide (BKDG) for AMD Family 15h
  772. Models 60h-6Fh Processors
  773. :AMD publication #: 50742
  774. :Revision: 3.01
  775. :Issue Date: 7/23/2015 (latest release)
  776. :Link: http://support.amd.com/TechDocs/50742_15h_Models_60h-6Fh_BKDG.pdf
  777. 6. :Title: BIOS and Kernel Developer's Guide (BKDG) for AMD Family 16h
  778. Models 00h-0Fh Processors
  779. :AMD publication #: 48751
  780. :Revision: 3.03
  781. :Issue Date: 2/23/2015 (latest release)
  782. :Link: http://support.amd.com/TechDocs/48751_16h_bkdg.pdf
  783. Credits
  784. =======
  785. * Written by Doug Thompson <dougthompson@xmission.com>
  786. - 7 Dec 2005
  787. - 17 Jul 2007 Updated
  788. * |copy| Mauro Carvalho Chehab
  789. - 05 Aug 2009 Nehalem interface
  790. - 26 Oct 2016 Converted to ReST and cleanups at the Nehalem section
  791. * EDAC authors/maintainers:
  792. - Doug Thompson, Dave Jiang, Dave Peterson et al,
  793. - Mauro Carvalho Chehab
  794. - Borislav Petkov
  795. - original author: Thayne Harbaugh