요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
==============
Devlink Health
==============
Background
==========
The ``devlink`` health mechanism is targeted for Real Time Alerting, in
order to know when something bad happened to a PCI device.
* Provide alert debug information.
* Self healing.
* If problem needs vendor support, provide a way to gather all needed
debugging information.
Overview
========
The main idea is to unify and centralize driver health reports in the
generic ``devlink`` instance and allow the user to set different
attributes of the health reporting and recovery procedures.
The ``devlink`` health reporter:
Device driver creates a "health reporter" per each error/health type.
Error/Health type can be a known/generic (e.g. PCI error, fw error, rx/tx error)
or unknown (driver specific).
For each registered health reporter a driver can issue error/health reports
asynchronously. All health reports handling is done by ``devlink``.
Device driver can provide specific callbacks for each "health reporter", e.g.:
* Recovery procedures
* Diagnostics procedures
* Object dump procedures
* Out Of Box initial parameters
Different parts of the driver can register different types of health reporters
with different handlers.
Actions
=======
Once an error is reported, devlink health will perform the following actions:
* A log is being send to the kernel trace events buffer
* Health status and statistics are being updated for the reporter instance
* Object dump is being taken and saved at the reporter instance (as long as
auto-dump is set and there is no other dump which is already stored)
* Auto recovery attempt is being done. Depends on:
- Auto-recovery configuration
- Grace period (and burst period) vs. time passed since last recover
Devlink formatted message
=========================
To handle devlink health diagnose and health dump requests, devlink creates a
formatted message structure ``devlink_fmsg`` and send it to the driver's callback
to fill the data in using the devlink fmsg API.
Devlink fmsg is a mechanism to pass descriptors between drivers and devlink, in
json-like format. The API allows the driver to add nested attributes such as
object, object pair and value array, in addition to attributes such as name and
value.
Driver should use this API to fill the fmsg context in a format which will be
translated by the devlink to the netlink message later. When it needs to send
the data using SKBs to the netlink layer, it fragments the data between
different SKBs. In order to do this fragmentation, it uses virtual nests
attributes, to avoid actual nesting use which cannot be divided between
different SKBs.
User Interface
==============
User can access/change each reporter's parameters and driver specific callbacks
via ``devlink``, e.g per error type (per health reporter):
* Configure reporter's generic parameters (like: disable/enable auto recovery)
* Invoke recovery procedure
* Run diagnostics
* Object dump
.. list-table:: List of devlink health interfaces
:widths: 10 90
* - Name
- Description
* - ``DEVLINK_CMD_HEALTH_REPORTER_GET``
- Retrieves status and configuration info per DEV and reporter.
* - ``DEVLINK_CMD_HEALTH_REPORTER_SET``
- Allows reporter-related configuration setting.
* - ``DEVLINK_CMD_HEALTH_REPORTER_RECOVER``
- Triggers reporter's recovery procedure.
* - ``DEVLINK_CMD_HEALTH_REPORTER_TEST``
- Triggers a fake health event on the reporter. The effects of the test
event in terms of recovery flow should follow closely that of a real
event.
* - ``DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE``
- Retrieves current device state related to the reporter.
* - ``DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET``
- Retrieves the last stored dump. Devlink health
saves a single dump. If an dump is not already stored by devlink
for this reporter, devlink generates a new dump.
Dump output is defined by the reporter.
* - ``DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR``
- Clears the last saved dump file for the specified reporter.
The following diagram provides a general overview of ``devlink-health``::
netlink
+--------------------------+
| |
| + |
| | |
+--------------------------+
|request for ops
|(diagnose,
driver devlink |recover,
|dump)
+--------+ +--------------------------+
| | | reporter| |
| | | +---------v----------+ |
| | ops execution | | | |
| <----------------------------------+ | |
| | | | | |
| | | + ^------------------+ |
| | | | request for ops |
| | | | (recover, dump) |
| | | | |
| | | +-+------------------+ |
| | health report | | health handler | |
| +-------------------------------> | |
| | | +--------------------+ |
| | health reporter create | |
| +----------------------------> |
+--------+ +--------------------------+
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Devlink Health 배경
1-17이 문서는 `GPL-2.0` 라이선스를 따릅니다.
Devlink Health
배경
`devlink` health mechanism은 PCI 장치에서 문제가 발생했을 때 바로 알 수 있도록 real-time alerting을 제공하는 것이 목표입니다.
- alert와 함께 debugging 정보를 제공합니다.
- self-healing을 수행합니다.
- vendor 지원이 필요한 문제라면 필요한 debugging 정보를 모두 수집할 방법을 제공합니다.
.. SPDX-License-Identifier: GPL-2.0
==============
Devlink Health
==============
Background
==========
The ``devlink`` health mechanism is targeted for Real Time Alerting, in
order to know when something bad happened to a PCI device.
* Provide alert debug information.
* Self healing.
* If problem needs vendor support, provide a way to gather all needed
debugging information.
Health reporter 개요
18-40개요
핵심 목적은 driver health report를 공통 `devlink` instance에 통합·집중하고, 사용자가 health reporting과 recovery procedure의 여러 attribute를 설정할 수 있게 하는 것입니다.
장치 driver는 error/health type마다 `health reporter`를 만듭니다. type은 PCI error, firmware error, RX/TX error처럼 알려진 공통 type일 수도 있고 driver 전용의 알려지지 않은 type일 수도 있습니다.
driver는 등록된 reporter마다 error/health report를 비동기로 발행할 수 있으며, 모든 report 처리는 `devlink`가 담당합니다.
driver는 각 health reporter에 다음 callback을 제공할 수 있습니다.
- recovery procedure
- diagnostics procedure
- object dump procedure
- out-of-box initial parameter
driver의 서로 다른 부분은 handler가 서로 다른 여러 health reporter type을 등록할 수 있습니다.
Overview
========
The main idea is to unify and centralize driver health reports in the
generic ``devlink`` instance and allow the user to set different
attributes of the health reporting and recovery procedures.
The ``devlink`` health reporter:
Device driver creates a "health reporter" per each error/health type.
Error/Health type can be a known/generic (e.g. PCI error, fw error, rx/tx error)
or unknown (driver specific).
For each registered health reporter a driver can issue error/health reports
asynchronously. All health reports handling is done by ``devlink``.
Device driver can provide specific callbacks for each "health reporter", e.g.:
* Recovery procedures
* Diagnostics procedures
* Object dump procedures
* Out Of Box initial parameters
Different parts of the driver can register different types of health reporters
with different handlers.
Error report 후 action
41-54Action
error가 보고되면 devlink health는 다음 action을 수행합니다.
- kernel trace event buffer로 log를 보냅니다.
- reporter instance의 health status와 statistic을 갱신합니다.
- auto-dump가 설정되어 있고 이미 저장된 dump가 없으면 object dump를 만들어 reporter instance에 저장합니다.
- auto-recovery 설정, grace period와 burst period, 마지막 recovery 이후 경과 시간에 따라 자동 recovery를 시도합니다.
report가 들어오면 기록과 상태 갱신, dump, recovery를 순서대로 처리합니다.
Actions
=======
Once an error is reported, devlink health will perform the following actions:
* A log is being send to the kernel trace events buffer
* Health status and statistics are being updated for the reporter instance
* Object dump is being taken and saved at the reporter instance (as long as
auto-dump is set and there is no other dump which is already stored)
* Auto recovery attempt is being done. Depends on:
- Auto-recovery configuration
- Grace period (and burst period) vs. time passed since last recover
Devlink formatted message
55-73Devlink formatted message
devlink health diagnose와 dump 요청을 처리할 때 devlink는 formatted message 구조체 `devlink_fmsg`를 만들고 driver callback으로 보내 devlink fmsg API를 사용해 데이터를 채우게 합니다.
devlink fmsg는 driver와 devlink 사이에서 descriptor를 JSON과 비슷한 형식으로 전달하는 mechanism입니다. API는 name과 value뿐 아니라 object, object pair, value array 같은 중첩 attribute도 추가할 수 있습니다.
driver는 나중에 devlink가 netlink message로 변환할 수 있는 형식으로 fmsg context를 채워야 합니다. 데이터를 SKB로 netlink layer에 보낼 때는 여러 SKB로 분할합니다.
분할할 수 없는 실제 nesting을 피하면서 fragmentation을 수행하기 위해 virtual nest attribute를 사용합니다.
Devlink formatted message
=========================
To handle devlink health diagnose and health dump requests, devlink creates a
formatted message structure ``devlink_fmsg`` and send it to the driver's callback
to fill the data in using the devlink fmsg API.
Devlink fmsg is a mechanism to pass descriptors between drivers and devlink, in
json-like format. The API allows the driver to add nested attributes such as
object, object pair and value array, in addition to attributes such as name and
value.
Driver should use this API to fill the fmsg context in a format which will be
translated by the devlink to the netlink message later. When it needs to send
the data using SKBs to the netlink layer, it fragments the data between
different SKBs. In order to do this fragmentation, it uses virtual nests
attributes, to avoid actual nesting use which cannot be divided between
different SKBs.
Health reporter userspace interface
74-109Userspace interface
사용자는 `devlink`를 통해 error type별 health reporter의 parameter와 driver 전용 callback에 접근하거나 변경할 수 있습니다.
- auto-recovery 활성화·비활성화 같은 reporter 공통 parameter 구성
- recovery procedure 호출
- diagnostics 실행
- object dump
reporter 상태 조회부터 test, diagnose, dump 관리까지의 netlink command입니다.
User Interface
==============
User can access/change each reporter's parameters and driver specific callbacks
via ``devlink``, e.g per error type (per health reporter):
* Configure reporter's generic parameters (like: disable/enable auto recovery)
* Invoke recovery procedure
* Run diagnostics
* Object dump
.. list-table:: List of devlink health interfaces
:widths: 10 90
* - Name
- Description
* - ``DEVLINK_CMD_HEALTH_REPORTER_GET``
- Retrieves status and configuration info per DEV and reporter.
* - ``DEVLINK_CMD_HEALTH_REPORTER_SET``
- Allows reporter-related configuration setting.
* - ``DEVLINK_CMD_HEALTH_REPORTER_RECOVER``
- Triggers reporter's recovery procedure.
* - ``DEVLINK_CMD_HEALTH_REPORTER_TEST``
- Triggers a fake health event on the reporter. The effects of the test
event in terms of recovery flow should follow closely that of a real
event.
* - ``DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE``
- Retrieves current device state related to the reporter.
* - ``DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET``
- Retrieves the last stored dump. Devlink health
saves a single dump. If an dump is not already stored by devlink
for this reporter, devlink generates a new dump.
Dump output is defined by the reporter.
* - ``DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR``
- Clears the last saved dump file for the specified reporter.
Devlink health 구조
110-138다음 구조는 `devlink-health`의 전체 흐름을 보여 줍니다. driver가 reporter를 만들고 health report를 devlink health handler에 전달합니다. userspace의 netlink 요청은 reporter를 통해 diagnose, recover, dump operation을 호출하며, reporter는 해당 operation을 driver에서 실행합니다.
driver가 report를 발행하면 devlink handler가 저장·복구 정책을 적용합니다.
netlink에서 들어온 diagnose·recover·dump 요청이 reporter를 거쳐 driver callback으로 전달됩니다.
The following diagram provides a general overview of ``devlink-health``::
netlink
+--------------------------+
| |
| + |
| | |
+--------------------------+
|request for ops
|(diagnose,
driver devlink |recover,
|dump)
+--------+ +--------------------------+
| | | reporter| |
| | | +---------v----------+ |
| | ops execution | | | |
| <----------------------------------+ | |
| | | | | |
| | | + ^------------------+ |
| | | | request for ops |
| | | | (recover, dump) |
| | | | |
| | | +-+------------------+ |
| | health report | | health handler | |
| +-------------------------------> | |
| | | +--------------------+ |
| | health reporter create | |
| +----------------------------> |
+--------+ +--------------------------+
요약·해설
devlink-health.rst:1-138health reporter는 error type별 driver callback과 공통 devlink 정책을 연결합니다. report가 발생하면 trace와 statistic을 갱신하고 조건에 따라 dump와 recovery를 실행하며, userspace는 같은 reporter를 대상으로 상태 조회, test, diagnose, recover, dump 관리를 수행합니다.
등록부터 report 처리와 userspace 제어까지의 흐름입니다.