요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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.
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.
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/
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.
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`.
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`
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 인터페이스로 노출합니다.
.. 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-49Post 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에서 세부 절차를 정의합니다.
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-81Memory 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
~~~~~~~~~~~~~~
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-110Soft 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 요청과 대조하는 방법을 사용할 수 있습니다.
장치가 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`에 정의되어 있습니다.
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-152CXL 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`에 문서화되어 있습니다.
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`
요약·해설
memory_repair.rst:1-152EDAC 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 안전성을 검증해야 합니다.
오류 관측에서 장치별 복구 instance 실행까지의 흐름입니다.