← Documents Documentation/devicetree/changesets.rst GitHub 원문 ↗

Linux 6.18.37 · Devicetree

Devicetree Changesets

실행 중인 트리에 변경 집합을 원자적으로 적용하고 오류 시 rollback하거나 적용 후 revert하는 절차를 설명합니다.

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

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

1. 요약·해설

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

요약과 해설

changesets.rst:1-37

실행 중인 트리에 변경 집합을 원자적으로 적용하고 오류 시 rollback하거나 적용 후 revert하는 절차를 설명합니다. 영어 원문 전체와 한국어 전문 번역을 함께 제공하며 함수명, symbol, source path, RST directive와 원문 줄 좌표를 보존합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =====================
4 Devicetree Changesets
5 =====================
6
7 A Devicetree changeset is a method which allows one to apply changes
8 in the live tree in such a way that either the full set of changes
9 will be applied, or none of them will be. If an error occurs partway
10 through applying the changeset, then the tree will be rolled back to the
11 previous state. A changeset can also be removed after it has been
12 applied.
13
14 When a changeset is applied, all of the changes get applied to the tree
15 at once before emitting OF_RECONFIG notifiers. This is so that the
16 receiver sees a complete and consistent state of the tree when it
17 receives the notifier.
18
19 The sequence of a changeset is as follows.
20
21 1. of_changeset_init() - initializes a changeset
22
23 2. A number of DT tree change calls, of_changeset_attach_node(),
24 of_changeset_detach_node(), of_changeset_add_property(),
25 of_changeset_remove_property, of_changeset_update_property() to prepare
26 a set of changes. No changes to the active tree are made at this point.
27 All the change operations are recorded in the of_changeset 'entries'
28 list.
29
30 3. of_changeset_apply() - Apply the changes to the tree. Either the
31 entire changeset will get applied, or if there is an error the tree will
32 be restored to the previous state. The core ensures proper serialization
33 through locking. An unlocked version __of_changeset_apply is available,
34 if needed.
35
36 If a successfully applied changeset needs to be removed, it can be done
37 with of_changeset_revert().
38

3. 한국어 전문 번역

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

Devicetree Changesets

1-6

이 문서는 `GPL-2.0` 라이선스가 적용되는 Devicetree changeset 기능을 설명합니다.

원자적 변경과 일관된 notifier 상태

7-18

Devicetree changeset은 실행 중인 트리에 변경 집합 전체를 적용하거나 하나도 적용하지 않는 방식입니다. changeset을 적용하는 도중 오류가 발생하면 트리를 이전 상태로 rollback합니다. 적용이 끝난 changeset은 나중에 제거할 수도 있습니다.

changeset을 적용할 때는 `OF_RECONFIG` notifier를 내보내기 전에 모든 변경을 트리에 한꺼번에 적용합니다. 따라서 notifier 수신자는 통지를 받을 때 완전하고 일관된 트리 상태를 보게 됩니다.

초기화와 변경 항목 준비

19-28

changeset의 앞부분은 다음 순서로 진행합니다.

  • 1. `of_changeset_init()`으로 changeset을 초기화합니다.
  • 2. `of_changeset_attach_node()`, `of_changeset_detach_node()`, `of_changeset_add_property()`, `of_changeset_remove_property`, `of_changeset_update_property()` 같은 여러 DT 트리 변경 호출로 변경 집합을 준비합니다.
  • 이 준비 단계에서는 활성 트리를 아직 바꾸지 않습니다. 모든 변경 작업은 `of_changeset`의 `entries` 목록에 기록됩니다.

적용, 직렬화와 되돌리기

29-37
  • 3. `of_changeset_apply()`로 변경을 트리에 적용합니다. changeset 전체가 적용되거나, 오류가 발생하면 트리를 이전 상태로 복원합니다.
  • 코어는 locking을 통해 올바른 직렬화를 보장합니다. 필요한 경우 잠금을 수행하지 않는 `__of_changeset_apply` 버전도 사용할 수 있습니다.

성공적으로 적용한 changeset을 제거해야 한다면 `of_changeset_revert()`를 사용합니다.