Documentation/edac/memory_repair.rst GitHub 원문 ↗

Linux 6.18.37 · EDAC

EDAC Memory Repair Control

PPR과 memory sparing의 공통 EDAC sysfs 제어, CXL 오류 이벤트와 live repair 안전성을 설명하는 한국어 전문 번역입니다.

Source pathDocumentation/edac/memory_repair.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

memory_repair.rst:1-152

EDAC memory repair control은 soft·hard PPR과 cacheline·row·bank·rank sparing을 공통 sysfs instance로 노출합니다. CXL event의 maintenance-needed flag, DPA, uncorrected error 또는 corrected-error threshold를 바탕으로 rasdaemon이 복구를 요청하며 드라이버는 live repair 안전성을 검증해야 합니다.

Memory repair 제어 경로
Observe CXL media or DRAM errorIdentify DPA and repair attributesSelect sPPR, hPPR or sparing granularityValidate live-repair safetyExecute through `mem_repairX` sysfs controls

오류 관측에서 장치별 복구 instance 실행까지의 흐름입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.2-no-invariants-or-later
2
3 ==========================
4 EDAC Memory Repair Control
5 ==========================
6
7 Copyright (c) 2024-2025 HiSilicon Limited.
8
9 :Author: Shiju Jose <[email protected]>
10 :License: The GNU Free Documentation License, Version 1.2 without
11 Invariant Sections, Front-Cover Texts nor Back-Cover Texts.
12 (dual licensed under the GPL v2)
13 :Original Reviewers:
14
15 - Written for: 6.15
16
17 Introduction
18 ------------
19
20 Some memory devices support repair operations to address issues in their
21 memory media. Post Package Repair (PPR) and memory sparing are examples of
22 such features.
23
24 Post Package Repair (PPR)
25 ~~~~~~~~~~~~~~~~~~~~~~~~~
26
27 Post Package Repair is a maintenance operation which requests the memory
28 device to perform repair operation on its media. It is a memory self-healing
29 feature that fixes a failing memory location by replacing it with a spare row
30 in a DRAM device.
31
32 For example, a CXL memory device with DRAM components that support PPR
33 features implements maintenance operations. DRAM components support those
34 types of PPR functions:
35
36 - hard PPR, for a permanent row repair, and
37 - soft PPR, for a temporary row repair.
38
39 Soft PPR is much faster than hard PPR, but the repair is lost after a power
40 cycle.
41
42 The data may not be retained and memory requests may not be correctly
43 processed during a repair operation. In such case, the repair operation should
44 not be executed at runtime.
45
46 For example, for CXL memory devices, see CXL spec rev 3.1 [1]_ sections
47 8.2.9.7.1.1 PPR Maintenance Operations, 8.2.9.7.1.2 sPPR Maintenance Operation
48 and 8.2.9.7.1.3 hPPR Maintenance Operation for more details.
49
50 Memory Sparing
51 ~~~~~~~~~~~~~~
52
53 Memory sparing is a repair function that replaces a portion of memory with
54 a portion of functional memory at a particular granularity. Memory
55 sparing has cacheline/row/bank/rank sparing granularities. For example, in
56 rank memory-sparing mode, one memory rank serves as a spare for other ranks on
57 the same channel in case they fail.
58
59 The spare rank is held in reserve and not used as active memory until
60 a failure is indicated, with reserved capacity subtracted from the total
61 available memory in the system.
62
63 After an error threshold is surpassed in a system protected by memory sparing,
64 the content of a failing rank of DIMMs is copied to the spare rank. The
65 failing rank is then taken offline and the spare rank placed online for use as
66 active memory in place of the failed rank.
67
68 For example, CXL memory devices can support various subclasses for sparing
69 operation vary in terms of the scope of the sparing being performed.
70
71 Cacheline sparing subclass refers to a sparing action that can replace a full
72 cacheline. Row sparing is provided as an alternative to PPR sparing functions
73 and its scope is that of a single DDR row. Bank sparing allows an entire bank
74 to be replaced. Rank sparing is defined as an operation in which an entire DDR
75 rank is replaced.
76
77 See CXL spec 3.1 [1]_ section 8.2.9.7.1.4 Memory Sparing Maintenance
78 Operations for more details.
79
80 .. [1] https://computeexpresslink.org/cxl-specification/
81
82 Use cases of generic memory repair features control
83 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84
85 1. The soft PPR, hard PPR and memory-sparing features share similar control
86 attributes. Therefore, there is a need for a standardized, generic sysfs
87 repair control that is exposed to userspace and used by administrators,
88 scripts and tools.
89
90 2. When a CXL device detects an error in a memory component, it informs the
91 host of the need for a repair maintenance operation by using an event
92 record where the "maintenance needed" flag is set. The event record
93 specifies the device physical address (DPA) and attributes of the memory
94 that requires repair. The kernel reports the corresponding CXL general
95 media or DRAM trace event to userspace, and userspace tools (e.g.
96 rasdaemon) initiate a repair maintenance operation in response to the
97 device request using the sysfs repair control.
98
99 3. Userspace tools, such as rasdaemon, request a repair operation on a memory
100 region when maintenance need flag set or an uncorrected memory error or
101 excess of corrected memory errors above a threshold value is reported or an
102 exceed corrected errors threshold flag set for that memory.
103
104 4. Multiple PPR/sparing instances may be present per memory device.
105
106 5. Drivers should enforce that live repair is safe. In systems where memory
107 mapping functions can change between boots, one approach to this is to log
108 memory errors seen on this boot against which to check live memory repair
109 requests.
110
111 The File System
112 ---------------
113
114 The control attributes of a registered memory repair instance could be
115 accessed in the /sys/bus/edac/devices/<dev-name>/mem_repairX/
116
117 sysfs
118 -----
119
120 Sysfs files are documented in
121 `Documentation/ABI/testing/sysfs-edac-memory-repair`.
122
123 Examples
124 --------
125
126 The memory repair usage takes the form shown in this example:
127
128 1. CXL memory sparing
129
130 Memory sparing is defined as a repair function that replaces a portion of
131 memory with a portion of functional memory at that same DPA. The subclass
132 for this operation, cacheline/row/bank/rank sparing, vary in terms of the
133 scope of the sparing being performed.
134
135 Memory sparing maintenance operations may be supported by CXL devices that
136 implement CXL.mem protocol. A sparing maintenance operation requests the
137 CXL device to perform a repair operation on its media. For example, a CXL
138 device with DRAM components that support memory sparing features may
139 implement sparing maintenance operations.
140
141 2. CXL memory Soft Post Package Repair (sPPR)
142
143 Post Package Repair (PPR) maintenance operations may be supported by CXL
144 devices that implement CXL.mem protocol. A PPR maintenance operation
145 requests the CXL device to perform a repair operation on its media.
146 For example, a CXL device with DRAM components that support PPR features
147 may implement PPR Maintenance operations. Soft PPR (sPPR) is a temporary
148 row repair. Soft PPR may be faster, but the repair is lost with a power
149 cycle.
150
151 Sysfs files for memory repair are documented in
152 `Documentation/ABI/testing/sysfs-edac-memory-repair`
153

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

메모리 미디어 복구 기능

1-23

이 문서는 Shiju Jose가 Linux 6.15용으로 작성한 EDAC Memory Repair Control 설명서입니다. HiSilicon Limited가 2024~2025년 저작권을 보유하며 GPL-2.0 또는 불변 섹션이 없는 GFDL-1.2 이상으로 이중 라이선스됩니다.

일부 메모리 장치는 미디어 결함을 처리하기 위한 자체 복구 동작을 지원합니다. 대표 기능은 Post Package Repair(PPR)와 memory sparing이며, EDAC 공통 제어는 이러한 복구 기능을 표준 sysfs 인터페이스로 노출합니다.

메모리 복구 범주
기능복구 방식
Post Package Repair결함 DRAM 위치를 예비 row로 교체
Memory sparingcacheline·row·bank·rank 단위를 정상 영역으로 대체

.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.2-no-invariants-or-later

==========================
EDAC Memory Repair Control
==========================

Copyright (c) 2024-2025 HiSilicon Limited.

:Author:   Shiju Jose <[email protected]>
:License:  The GNU Free Documentation License, Version 1.2 without
           Invariant Sections, Front-Cover Texts nor Back-Cover Texts.
           (dual licensed under the GPL v2)
:Original Reviewers:

- Written for: 6.15

Introduction
------------

Some memory devices support repair operations to address issues in their
memory media. Post Package Repair (PPR) and memory sparing are examples of
such features.

Hard PPR과 Soft PPR

24-49

Post Package Repair는 메모리 장치가 자체 미디어의 결함을 복구하도록 요청하는 maintenance operation입니다. DRAM의 실패한 메모리 위치를 예비 row로 바꾸는 self-healing 기능입니다.

PPR 기능이 있는 DRAM을 포함한 CXL 메모리 장치는 hard PPR과 soft PPR maintenance operation을 구현할 수 있습니다. Hard PPR은 영구적인 row 복구이고 soft PPR은 임시 row 복구입니다.

Soft PPR은 hard PPR보다 훨씬 빠르지만 전원을 껐다 켜면 복구가 사라집니다. 복구 동작 중 데이터가 보존되지 않거나 메모리 요청을 정확히 처리하지 못하는 장치라면 runtime에 복구를 실행해서는 안 됩니다.

CXL 3.1 규격의 8.2.9.7.1.1 PPR Maintenance Operations, 8.2.9.7.1.2 sPPR Maintenance Operation, 8.2.9.7.1.3 hPPR Maintenance Operation에서 세부 절차를 정의합니다.

PPR 방식 비교
방식효력속도Power cycle 이후
Soft PPR (sPPR)임시 row 교체빠름복구 소실
Hard PPR (hPPR)영구 row 교체상대적으로 느림복구 유지

Post Package Repair (PPR)
~~~~~~~~~~~~~~~~~~~~~~~~~

Post Package Repair is a maintenance operation which requests the memory
device to perform repair operation on its media. It is a memory self-healing
feature that fixes a failing memory location by replacing it with a spare row
in a DRAM device.

For example, a CXL memory device with DRAM components that support PPR
features implements maintenance operations. DRAM components support those
types of PPR functions:

 - hard PPR, for a permanent row repair, and
 - soft PPR, for a temporary row repair.

Soft PPR is much faster than hard PPR, but the repair is lost after a power
cycle.

The data may not be retained and memory requests may not be correctly
processed during a repair operation. In such case, the repair operation should
not be executed at runtime.

For example, for CXL memory devices, see CXL spec rev 3.1 [1]_ sections
8.2.9.7.1.1 PPR Maintenance Operations, 8.2.9.7.1.2 sPPR Maintenance Operation
and 8.2.9.7.1.3 hPPR Maintenance Operation for more details.

Cacheline·row·bank·rank sparing

50-81

Memory sparing은 특정 granularity의 메모리 부분을 같은 단위의 정상 메모리로 교체하는 복구 기능입니다. Cacheline, row, bank, rank 단위의 sparing을 지원할 수 있습니다.

Rank sparing 모드에서는 같은 채널의 rank 하나를 다른 rank의 예비 장치로 보관합니다. 예비 rank는 장애가 발생하기 전에는 active memory로 사용하지 않으며 그 용량은 시스템의 총 사용 가능 메모리에서 제외됩니다.

오류 임계값을 넘으면 실패 중인 DIMM rank의 내용을 예비 rank로 복사하고 기존 rank를 offline으로 전환합니다. 예비 rank는 online으로 전환되어 실패한 rank 대신 active memory가 됩니다.

CXL sparing subclass는 복구 범위가 다릅니다. Cacheline sparing은 전체 cacheline 하나, row sparing은 PPR의 대안으로 DDR row 하나, bank sparing은 bank 전체, rank sparing은 DDR rank 전체를 교체합니다. 자세한 내용은 CXL 3.1 8.2.9.7.1.4 Memory Sparing Maintenance Operations에 있습니다.

Memory sparing granularity
Subclass교체 범위
Cacheline sparing전체 cacheline 하나
Row sparingDDR row 하나
Bank sparing메모리 bank 전체
Rank sparingDDR rank 전체

Memory Sparing
~~~~~~~~~~~~~~

Memory sparing is a repair function that replaces a portion of memory with
a portion of functional memory at a particular granularity. Memory
sparing has cacheline/row/bank/rank sparing granularities. For example, in
rank memory-sparing mode, one memory rank serves as a spare for other ranks on
the same channel in case they fail.

The spare rank is held in reserve and not used as active memory until
a failure is indicated, with reserved capacity subtracted from the total
available memory in the system.

After an error threshold is surpassed in a system protected by memory sparing,
the content of a failing rank of DIMMs is copied to the spare rank. The
failing rank is then taken offline and the spare rank placed online for use as
active memory in place of the failed rank.

For example, CXL memory devices can support various subclasses for sparing
operation vary in terms of the scope of the sparing being performed.

Cacheline sparing subclass refers to a sparing action that can replace a full
cacheline. Row sparing is provided as an alternative to PPR sparing functions
and its scope is that of a single DDR row. Bank sparing allows an entire bank
to be replaced. Rank sparing is defined as an operation in which an entire DDR
rank is replaced.

See CXL spec 3.1 [1]_ section 8.2.9.7.1.4 Memory Sparing Maintenance
Operations for more details.

.. [1] https://computeexpresslink.org/cxl-specification/

공통 sysfs 제어와 안전한 live repair

82-110

Soft PPR, hard PPR, memory sparing은 비슷한 control attribute를 공유하므로 관리자·script·tool이 사용할 표준화된 공통 sysfs repair control이 필요합니다.

CXL 장치가 메모리 구성 요소의 오류를 발견하고 repair maintenance가 필요하면 `maintenance needed` flag가 설정된 event record를 호스트에 보냅니다. Record에는 복구할 메모리의 device physical address(DPA)와 속성이 포함됩니다.

커널은 대응하는 CXL general media 또는 DRAM trace event를 userspace에 보고합니다. rasdaemon 같은 도구는 장치 요청에 반응해 sysfs repair control로 maintenance operation을 시작합니다.

Userspace는 maintenance-needed flag, uncorrected memory error, corrected error가 임계값을 초과한 경우 또는 corrected-errors-threshold flag가 설정된 경우에도 메모리 영역의 복구를 요청할 수 있습니다. 장치 하나에는 PPR 또는 sparing instance가 여러 개 있을 수 있습니다.

드라이버는 live repair가 안전한지 강제해야 합니다. 부팅할 때마다 memory mapping이 바뀔 수 있는 시스템에서는 이번 부팅에서 관측한 오류를 기록하고 live repair 요청과 대조하는 방법을 사용할 수 있습니다.

CXL 오류에서 복구 요청까지
CXL device detects a media or DRAM problemEmit event record with `maintenance needed` and DPAKernel reports CXL trace eventrasdaemon evaluates flags and error thresholdsRequest a safe PPR or sparing instance through sysfs

장치가 DPA를 포함한 필요 신호를 보내고 userspace 정책이 공통 sysfs 제어를 호출합니다.

Use cases of generic memory repair features control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. The soft PPR, hard PPR and memory-sparing features share similar control
   attributes. Therefore, there is a need for a standardized, generic sysfs
   repair control that is exposed to userspace and used by administrators,
   scripts and tools.

2. When a CXL device detects an error in a memory component, it informs the
   host of the need for a repair maintenance operation by using an event
   record where the "maintenance needed" flag is set. The event record
   specifies the device physical address (DPA) and attributes of the memory
   that requires repair. The kernel reports the corresponding CXL general
   media or DRAM trace event to userspace, and userspace tools (e.g.
   rasdaemon) initiate a repair maintenance operation in response to the
   device request using the sysfs repair control.

3. Userspace tools, such as rasdaemon, request a repair operation on a memory
   region when maintenance need flag set or an uncorrected memory error or
   excess of corrected memory errors above a threshold value is reported or an
   exceed corrected errors threshold flag set for that memory.

4. Multiple PPR/sparing instances may be present per memory device.

5. Drivers should enforce that live repair is safe. In systems where memory
   mapping functions can change between boots, one approach to this is to log
   memory errors seen on this boot against which to check live memory repair
   requests.

Memory repair sysfs 위치

111-122

등록된 memory repair instance의 제어 속성은 `/sys/bus/edac/devices/<dev-name>/mem_repairX/`에서 접근합니다.

각 sysfs 파일의 ABI와 값은 `Documentation/ABI/testing/sysfs-edac-memory-repair`에 정의되어 있습니다.

Memory repair 파일 시스템
항목위치
Instance control`/sys/bus/edac/devices/<dev-name>/mem_repairX/`
ABI 문서`Documentation/ABI/testing/sysfs-edac-memory-repair`

The File System
---------------

The control attributes of a registered memory repair instance could be
accessed in the /sys/bus/edac/devices/<dev-name>/mem_repairX/

sysfs
-----

Sysfs files are documented in
`Documentation/ABI/testing/sysfs-edac-memory-repair`.

CXL memory sparing과 sPPR 예제

123-152

CXL memory sparing은 특정 DPA의 결함 영역을 같은 DPA에 대응하는 정상 메모리 영역으로 교체합니다. Cacheline·row·bank·rank subclass에 따라 복구 범위가 달라집니다.

`CXL.mem` protocol을 구현한 CXL 장치는 sparing maintenance operation을 제공할 수 있습니다. 이 operation은 장치의 메모리 미디어 복구를 요청하며, DRAM이 memory sparing을 지원하는 장치가 해당 기능을 구현합니다.

`CXL.mem` 장치는 PPR maintenance operation도 지원할 수 있습니다. Soft PPR(sPPR)은 임시 row 복구로 더 빠를 수 있지만 power cycle 뒤에는 복구가 사라집니다.

두 기능의 실제 sysfs 사용법은 `Documentation/ABI/testing/sysfs-edac-memory-repair`에 문서화되어 있습니다.

CXL repair 예제
Operation대상지속성
Memory sparing같은 DPA의 cacheline·row·bank·rank장치 구현에 따름
Soft PPR결함 DRAM rowPower cycle까지

Examples
--------

The memory repair usage takes the form shown in this example:

1. CXL memory sparing

Memory sparing is defined as a repair function that replaces a portion of
memory with a portion of functional memory at that same DPA. The subclass
for this operation, cacheline/row/bank/rank sparing, vary in terms of the
scope of the sparing being performed.

Memory sparing maintenance operations may be supported by CXL devices that
implement CXL.mem protocol. A sparing maintenance operation requests the
CXL device to perform a repair operation on its media. For example, a CXL
device with DRAM components that support memory sparing features may
implement sparing maintenance operations.

2. CXL memory Soft Post Package Repair (sPPR)

Post Package Repair (PPR) maintenance operations may be supported by CXL
devices that implement CXL.mem protocol. A PPR maintenance operation
requests the CXL device to perform a repair operation on its media.
For example, a CXL device with DRAM components that support PPR features
may implement PPR Maintenance operations. Soft PPR (sPPR) is a temporary
row repair. Soft PPR may be faster, but the repair is lost with a power
cycle.

Sysfs files for memory repair are documented in
`Documentation/ABI/testing/sysfs-edac-memory-repair`