요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
1
.. SPDX-License-Identifier: GPL-2.0
3
================================
4
Review checklist for kvm patches
5
================================
7
1. The patch must follow Documentation/process/coding-style.rst and
8
Documentation/process/submitting-patches.rst.
10
2. Patches should be against kvm.git master or next branches.
12
3. If the patch introduces or modifies a new userspace API:
13
- the API must be documented in Documentation/virt/kvm/api.rst
14
- the API must be discoverable using KVM_CHECK_EXTENSION
16
4. New state must include support for save/restore.
18
5. New features must default to off (userspace should explicitly request them).
19
Performance improvements can and should default to on.
21
6. New cpu features should be exposed via KVM_GET_SUPPORTED_CPUID2,
22
or its equivalent for non-x86 architectures
24
7. The feature should be testable (see below).
26
8. Changes should be vendor neutral when possible. Changes to common code
27
are better than duplicating changes to vendor code.
29
9. Similarly, prefer changes to arch independent code than to arch dependent
30
code.
32
10. User/kernel interfaces and guest/host interfaces must be 64-bit clean
33
(all variables and sizes naturally aligned on 64-bit; use specific types
34
only - u64 rather than ulong).
36
11. New guest visible features must either be documented in a hardware manual
37
or be accompanied by documentation.
39
Testing of KVM code
40
-------------------
42
All features contributed to KVM, and in many cases bugfixes too, should be
43
accompanied by some kind of tests and/or enablement in open source guests
44
and VMMs. KVM is covered by multiple test suites:
46
*Selftests*
47
These are low level tests that allow granular testing of kernel APIs.
48
This includes API failure scenarios, invoking APIs after specific
49
guest instructions, and testing multiple calls to ``KVM_CREATE_VM``
50
within a single test. They are included in the kernel tree at
51
``tools/testing/selftests/kvm``.
53
``kvm-unit-tests``
54
A collection of small guests that test CPU and emulated device features
55
from a guest's perspective. They run under QEMU or ``kvmtool``, and
56
are generally not KVM-specific: they can be run with any accelerator
57
that QEMU support or even on bare metal, making it possible to compare
58
behavior across hypervisors and processor families.
60
Functional test suites
61
Various sets of functional tests exist, such as QEMU's ``tests/functional``
62
suite and `avocado-vt <https://avocado-vt.readthedocs.io/en/latest/>`__.
63
These typically involve running a full operating system in a virtual
64
machine.
66
The best testing approach depends on the feature's complexity and
67
operation. Here are some examples and guidelines:
69
New instructions (no new registers or APIs)
70
The corresponding CPU features (if applicable) should be made available
71
in QEMU. If the instructions require emulation support or other code in
72
KVM, it is worth adding coverage to ``kvm-unit-tests`` or selftests;
73
the latter can be a better choice if the instructions relate to an API
74
that already has good selftest coverage.
76
New hardware features (new registers, no new APIs)
77
These should be tested via ``kvm-unit-tests``; this more or less implies
78
supporting them in QEMU and/or ``kvmtool``. In some cases selftests
79
can be used instead, similar to the previous case, or specifically to
80
test corner cases in guest state save/restore.
82
Bug fixes and performance improvements
83
These usually do not introduce new APIs, but it's worth sharing
84
any benchmarks and tests that will validate your contribution,
85
ideally in the form of regression tests. Tests and benchmarks
86
can be included in either ``kvm-unit-tests`` or selftests, depending
87
on the specifics of your change. Selftests are especially useful for
88
regression tests because they are included directly in Linux's tree.
90
Large scale internal changes
91
While it's difficult to provide a single policy, you should ensure that
92
the changed code is covered by either ``kvm-unit-tests`` or selftests.
93
In some cases the affected code is run for any guests and functional
94
tests suffice. Explain your testing process in the cover letter,
95
as that can help identify gaps in existing test suites.
97
New APIs
98
It is important to demonstrate your use case. This can be as simple as
99
explaining that the feature is already in use on bare metal, or it can be
100
a proof-of-concept implementation in userspace. The latter need not be
101
open source, though that is of course preferable for easier testing.
102
Selftests should test corner cases of the APIs, and should also cover
103
basic host and guest operation if no open source VMM uses the feature.
105
Bigger features, usually spanning host and guest
106
These should be supported by Linux guests, with limited exceptions for
107
Hyper-V features that are testable on Windows guests. It is strongly
108
suggested that the feature be usable with an open source host VMM, such
109
as at least one of QEMU or crosvm, and guest firmware. Selftests should
110
test at least API error cases. Guest operation can be covered by
111
either selftests of ``kvm-unit-tests`` (this is especially important for
112
paravirtualized and Windows-only features). Strong selftest coverage
113
can also be a replacement for implementation in an open source VMM,
114
but this is generally not recommended.
116
Following the above suggestions for testing in selftests and
117
``kvm-unit-tests`` will make it easier for the maintainers to review
118
and accept your code. In fact, even before you contribute your changes
119
upstream it will make it easier for you to develop for KVM.
121
Of course, the KVM maintainers reserve the right to require more tests,
122
though they may also waive the requirement from time to time.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
패치 기본 요건
1-38항목요건
형식coding-style과 submitting-patches 준수, `kvm.git` master 또는 next 기준
새 userspace API`Documentation/virt/kvm/api.rst` 문서화, `KVM_CHECK_EXTENSION`으로 탐지 가능
새 상태save/restore 지원
새 기능기본 off, userspace가 명시적으로 요청; 성능 개선은 기본 on 가능
새 CPU 기능`KVM_GET_SUPPORTED_CPUID2` 또는 비-x86 동등 인터페이스로 노출
설계테스트 가능, 가능하면 vendor-neutral과 architecture-independent 공통 코드 선호
ABI 정렬user/kernel과 guest/host 인터페이스는 64-bit clean, `ulong` 대신 `u64` 같은 고정 형식
게스트 가시 기능하드웨어 매뉴얼에 있거나 별도 문서 동반
새 ABI와 상태, 기능 노출의 기본 규칙입니다.
.. SPDX-License-Identifier: GPL-2.0
================================
Review checklist for kvm patches
================================
1. The patch must follow Documentation/process/coding-style.rst and
Documentation/process/submitting-patches.rst.
2. Patches should be against kvm.git master or next branches.
3. If the patch introduces or modifies a new userspace API:
- the API must be documented in Documentation/virt/kvm/api.rst
- the API must be discoverable using KVM_CHECK_EXTENSION
4. New state must include support for save/restore.
5. New features must default to off (userspace should explicitly request them).
Performance improvements can and should default to on.
6. New cpu features should be exposed via KVM_GET_SUPPORTED_CPUID2,
or its equivalent for non-x86 architectures
7. The feature should be testable (see below).
8. Changes should be vendor neutral when possible. Changes to common code
are better than duplicating changes to vendor code.
9. Similarly, prefer changes to arch independent code than to arch dependent
code.
10. User/kernel interfaces and guest/host interfaces must be 64-bit clean
(all variables and sizes naturally aligned on 64-bit; use specific types
only - u64 rather than ulong).
11. New guest visible features must either be documented in a hardware manual
or be accompanied by documentation.
KVM 테스트 체계
39-65KVM에 기여하는 모든 기능과 많은 버그 수정은 테스트 또는 오픈 소스 게스트·VMM 활성화와 함께 제출해야 합니다.
모음범위
Selftests`tools/testing/selftests/kvm`; API 실패, 특정 게스트 명령 뒤 API 호출, 여러 `KVM_CREATE_VM` 호출 등 저수준 검증
`kvm-unit-tests`작은 게스트로 CPU와 에뮬레이션 장치를 검증; QEMU, `kvmtool`, 다른 accelerator와 bare metal에서도 실행
기능 테스트QEMU `tests/functional`, avocado-vt 등 전체 운영체제를 VM에서 실행
검증 수준과 실행 환경이 서로 다릅니다.
Testing of KVM code
-------------------
All features contributed to KVM, and in many cases bugfixes too, should be
accompanied by some kind of tests and/or enablement in open source guests
and VMMs. KVM is covered by multiple test suites:
*Selftests*
These are low level tests that allow granular testing of kernel APIs.
This includes API failure scenarios, invoking APIs after specific
guest instructions, and testing multiple calls to ``KVM_CREATE_VM``
within a single test. They are included in the kernel tree at
``tools/testing/selftests/kvm``.
``kvm-unit-tests``
A collection of small guests that test CPU and emulated device features
from a guest's perspective. They run under QEMU or ``kvmtool``, and
are generally not KVM-specific: they can be run with any accelerator
that QEMU support or even on bare metal, making it possible to compare
behavior across hypervisors and processor families.
Functional test suites
Various sets of functional tests exist, such as QEMU's ``tests/functional``
suite and `avocado-vt <https://avocado-vt.readthedocs.io/en/latest/>`__.
These typically involve running a full operating system in a virtual
machine.
변경 유형별 테스트
66-122변경권장 테스트
새 명령QEMU CPU 기능 노출, 에뮬레이션은 `kvm-unit-tests` 또는 관련 API selftest
새 하드웨어 기능`kvm-unit-tests`, QEMU 또는 `kvmtool`; save/restore 경계는 selftest
버그 수정·성능 개선벤치마크와 회귀 테스트를 selftest 또는 `kvm-unit-tests`에 추가
대규모 내부 변경변경 코드의 unit/selftest 범위 확인, 필요한 경우 기능 테스트, cover letter에 과정 설명
새 API사용 사례 또는 userspace POC, API 경계 selftest, 오픈 소스 VMM이 없으면 기본 host·guest 동작도 검증
host·guest 대형 기능Linux guest와 QEMU 또는 crosvm 같은 오픈 소스 VMM, API 오류 selftest, guest 동작 테스트
기능 복잡도와 동작 위치에 맞는 조합을 선택합니다.
반가상화와 Windows 전용 기능은 특히 guest 동작을 selftest 또는 `kvm-unit-tests`로 검증해야 합니다. 강한 selftest가 오픈 소스 VMM 구현을 대신할 수는 있지만 일반적으로 권장되지는 않습니다.
충분한 테스트는 유지관리자의 검토와 수용뿐 아니라 upstream 제출 전 개발 과정도 쉽게 합니다. 유지관리자는 필요에 따라 추가 테스트를 요구하거나 예외적으로 면제할 수 있습니다.
The best testing approach depends on the feature's complexity and
operation. Here are some examples and guidelines:
New instructions (no new registers or APIs)
The corresponding CPU features (if applicable) should be made available
in QEMU. If the instructions require emulation support or other code in
KVM, it is worth adding coverage to ``kvm-unit-tests`` or selftests;
the latter can be a better choice if the instructions relate to an API
that already has good selftest coverage.
New hardware features (new registers, no new APIs)
These should be tested via ``kvm-unit-tests``; this more or less implies
supporting them in QEMU and/or ``kvmtool``. In some cases selftests
can be used instead, similar to the previous case, or specifically to
test corner cases in guest state save/restore.
Bug fixes and performance improvements
These usually do not introduce new APIs, but it's worth sharing
any benchmarks and tests that will validate your contribution,
ideally in the form of regression tests. Tests and benchmarks
can be included in either ``kvm-unit-tests`` or selftests, depending
on the specifics of your change. Selftests are especially useful for
regression tests because they are included directly in Linux's tree.
Large scale internal changes
While it's difficult to provide a single policy, you should ensure that
the changed code is covered by either ``kvm-unit-tests`` or selftests.
In some cases the affected code is run for any guests and functional
tests suffice. Explain your testing process in the cover letter,
as that can help identify gaps in existing test suites.
New APIs
It is important to demonstrate your use case. This can be as simple as
explaining that the feature is already in use on bare metal, or it can be
a proof-of-concept implementation in userspace. The latter need not be
open source, though that is of course preferable for easier testing.
Selftests should test corner cases of the APIs, and should also cover
basic host and guest operation if no open source VMM uses the feature.
Bigger features, usually spanning host and guest
These should be supported by Linux guests, with limited exceptions for
Hyper-V features that are testable on Windows guests. It is strongly
suggested that the feature be usable with an open source host VMM, such
as at least one of QEMU or crosvm, and guest firmware. Selftests should
test at least API error cases. Guest operation can be covered by
either selftests of ``kvm-unit-tests`` (this is especially important for
paravirtualized and Windows-only features). Strong selftest coverage
can also be a replacement for implementation in an open source VMM,
but this is generally not recommended.
Following the above suggestions for testing in selftests and
``kvm-unit-tests`` will make it easier for the maintainers to review
and accept your code. In fact, even before you contribute your changes
upstream it will make it easier for you to develop for KVM.
Of course, the KVM maintainers reserve the right to require more tests,
though they may also waive the requirement from time to time.
요약·해설
review-checklist.rst:1-122KVM 패치의 ABI·상태·기능 노출 요건과 변경 유형별 테스트 전략을 정리합니다.
ABI 필드, 명령·레지스터 이름, 소스 경로와 줄 좌표를 보존하고 보안 경계와 실행 순서를 구조화했습니다.