← Documents Documentation/process/maintainer-kvm-x86.rst GitHub 원문 ↗

Linux 6.18.37 · Maintainer

KVM x86 maintainer workflow

KVM x86 tree와 branch lifecycle, SDM·APM reference, changelog, test, feature·bug-fix posting과 vulnerability 처리를 설명합니다.

Source pathDocumentation/process/maintainer-kvm-x86.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

Tree, branch와 lifecycle

maintainer-kvm-x86.rst:3-81

KVM x86 변경은 kvm-x86 maintainer tree의 목적별 branch에서 review·queue되고 linux-next integration 뒤 KVM 또는 upstream pull request로 이동한다. Branch 이름과 target은 개발 기능, fix와 next cycle을 구분하므로 posting 전 current tree 상태를 확인한다.

Merge window와 -rc timeline을 역산해 feature는 충분한 review·testing 시간을 두고 보내며 urgent fix는 영향 release와 stable 필요성을 명시한다.

Base, style와 architecture manual 인용

maintainer-kvm-x86.rst:82-147

Patch는 maintainer가 지정한 KVM x86 base에 만들고 generic kernel coding style에 더해 주변 virtualization code convention을 따른다. Comment는 instruction behavior를 반복하지 말고 virtualization invariant와 guest·host interaction 이유를 설명한다.

Intel SDM과 AMD APM을 인용할 때 document volume, section과 가능하면 stable title을 적어 reviewer가 architectural rule을 확인할 수 있게 한다. Vendor 문구만으로 Linux behavior를 정당화하지 말고 KVM state model에 연결한다.

Shortlog, changelog와 Fixes

maintainer-kvm-x86.rst:148-242

Subject는 KVM: x86 또는 더 구체적인 vendor·component prefix를 사용하고 무엇을 왜 바꾸는지 표시한다. Changelog는 guest-visible symptom, root cause, affected mode, concurrency와 migration·nested virtualization 영향을 설명한다.

Bug를 도입한 commit에는 정확한 Fixes tag를 붙이고 stable backport 가능성을 평가한다. Function을 언급할 때 parenthesis를 붙여 symbol임을 명확히 하고 code quote보다 invariant를 중심으로 쓴다.

KVM selftest와 feature 검증

maintainer-kvm-x86.rst:243-311

관련 KVM selftest, kvm-unit-tests와 guest workload를 실행하고 Intel·AMD, hardware feature on·off, nested guest와 migration처럼 영향 matrix를 확인한다. New feature는 userspace API와 capability discovery, backward compatibility, documentation과 test를 같은 series에 포함한다.

Bug fix는 재현 test를 먼저 또는 함께 제공하고 test가 old code에서 실패하고 fix 뒤 성공하는지 보여 준다. Hardware가 없어 실행하지 못한 조합은 명시한다.

Posting, base와 notification

maintainer-kvm-x86.rst:312-390

관련 lore discussion과 dependency를 Link로 연결하고 git format-patch base-commit 정보를 제공한다. Selftest와 code를 다른 tree가 받는 경우에도 같은 thread에 co-post해 review context를 유지한다.

Maintainer tree에서 commit SHA가 안정되기 전에는 외부 dependency가 hash에 기대지 않게 한다. Vulnerability는 public posting 전에 kernel security process를 따르고 disclosure 뒤 fix·stable 흐름을 연결한다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 KVM x86
4 =======
5
6 Foreword
7 --------
8 KVM strives to be a welcoming community; contributions from newcomers are
9 valued and encouraged. Please do not be discouraged or intimidated by the
10 length of this document and the many rules/guidelines it contains. Everyone
11 makes mistakes, and everyone was a newbie at some point. So long as you make
12 an honest effort to follow KVM x86's guidelines, are receptive to feedback,
13 and learn from any mistakes you make, you will be welcomed with open arms, not
14 torches and pitchforks.
15
16 TL;DR
17 -----
18 Testing is mandatory. Be consistent with established styles and patterns.
19
20 Trees
21 -----
22 KVM x86 is currently in a transition period from being part of the main KVM
23 tree, to being "just another KVM arch". As such, KVM x86 is split across the
24 main KVM tree, ``git.kernel.org/pub/scm/virt/kvm/kvm.git``, and a KVM x86
25 specific tree, ``github.com/kvm-x86/linux.git``.
26
27 Generally speaking, fixes for the current cycle are applied directly to the
28 main KVM tree, while all development for the next cycle is routed through the
29 KVM x86 tree. In the unlikely event that a fix for the current cycle is routed
30 through the KVM x86 tree, it will be applied to the ``fixes`` branch before
31 making its way to the main KVM tree.
32
33 Note, this transition period is expected to last quite some time, i.e. will be
34 the status quo for the foreseeable future.
35
36 Branches
37 ~~~~~~~~
38 The KVM x86 tree is organized into multiple topic branches. The purpose of
39 using finer-grained topic branches is to make it easier to keep tabs on an area
40 of development, and to limit the collateral damage of human errors and/or buggy
41 commits, e.g. dropping the HEAD commit of a topic branch has no impact on other
42 in-flight commits' SHA1 hashes, and having to reject a pull request due to bugs
43 delays only that topic branch.
44
45 All topic branches, except for ``next`` and ``fixes``, are rolled into ``next``
46 via a Cthulhu merge on an as-needed basis, i.e. when a topic branch is updated.
47 As a result, force pushes to ``next`` are common.
48
49 Lifecycle
50 ~~~~~~~~~
51 Fixes that target the current release, a.k.a. mainline, are typically applied
52 directly to the main KVM tree, i.e. do not route through the KVM x86 tree.
53
54 Changes that target the next release are routed through the KVM x86 tree. Pull
55 requests (from KVM x86 to main KVM) are sent for each KVM x86 topic branch,
56 typically the week before Linus' opening of the merge window, e.g. the week
57 following rc7 for "normal" releases. If all goes well, the topic branches are
58 rolled into the main KVM pull request sent during Linus' merge window.
59
60 The KVM x86 tree doesn't have its own official merge window, but there's a soft
61 close around rc5 for new features, and a soft close around rc6 for fixes (for
62 the next release; see above for fixes that target the current release).
63
64 Timeline
65 ~~~~~~~~
66 Submissions are typically reviewed and applied in FIFO order, with some wiggle
67 room for the size of a series, patches that are "cache hot", etc. Fixes,
68 especially for the current release and or stable trees, get to jump the queue.
69 Patches that will be taken through a non-KVM tree (most often through the tip
70 tree) and/or have other acks/reviews also jump the queue to some extent.
71
72 Note, the vast majority of review is done between rc1 and rc6, give or take.
73 The period between rc6 and the next rc1 is used to catch up on other tasks,
74 i.e. radio silence during this period isn't unusual.
75
76 Pings to get a status update are welcome, but keep in mind the timing of the
77 current release cycle and have realistic expectations. If you are pinging for
78 acceptance, i.e. not just for feedback or an update, please do everything you
79 can, within reason, to ensure that your patches are ready to be merged! Pings
80 on series that break the build or fail tests lead to unhappy maintainers!
81
82 Development
83 -----------
84
85 Base Tree/Branch
86 ~~~~~~~~~~~~~~~~
87 Fixes that target the current release, a.k.a. mainline, should be based on
88 ``git://git.kernel.org/pub/scm/virt/kvm/kvm.git master``. Note, fixes do not
89 automatically warrant inclusion in the current release. There is no singular
90 rule, but typically only fixes for bugs that are urgent, critical, and/or were
91 introduced in the current release should target the current release.
92
93 Everything else should be based on ``kvm-x86/next``, i.e. there is no need to
94 select a specific topic branch as the base. If there are conflicts and/or
95 dependencies across topic branches, it is the maintainer's job to sort them
96 out.
97
98 The only exception to using ``kvm-x86/next`` as the base is if a patch/series
99 is a multi-arch series, i.e. has non-trivial modifications to common KVM code
100 and/or has more than superficial changes to other architectures' code. Multi-
101 arch patch/series should instead be based on a common, stable point in KVM's
102 history, e.g. the release candidate upon which ``kvm-x86 next`` is based. If
103 you're unsure whether a patch/series is truly multi-arch, err on the side of
104 caution and treat it as multi-arch, i.e. use a common base.
105
106 Coding Style
107 ~~~~~~~~~~~~
108 When it comes to style, naming, patterns, etc., consistency is the number one
109 priority in KVM x86. If all else fails, match what already exists.
110
111 With a few caveats listed below, follow the tip tree maintainers' preferred
112 :ref:`maintainer-tip-coding-style`, as patches/series often touch both KVM and
113 non-KVM x86 files, i.e. draw the attention of KVM *and* tip tree maintainers.
114
115 Using reverse fir tree, a.k.a. reverse Christmas tree or reverse XMAS tree, for
116 variable declarations isn't strictly required, though it is still preferred.
117
118 Except for a handful of special snowflakes, do not use kernel-doc comments for
119 functions. The vast majority of "public" KVM functions aren't truly public as
120 they are intended only for KVM-internal consumption (there are plans to
121 privatize KVM's headers and exports to enforce this).
122
123 Comments
124 ~~~~~~~~
125 Write comments using imperative mood and avoid pronouns. Use comments to
126 provide a high level overview of the code, and/or to explain why the code does
127 what it does. Do not reiterate what the code literally does; let the code
128 speak for itself. If the code itself is inscrutable, comments will not help.
129
130 SDM and APM References
131 ~~~~~~~~~~~~~~~~~~~~~~
132 Much of KVM's code base is directly tied to architectural behavior defined in
133 Intel's Software Development Manual (SDM) and AMD's Architecture Programmer’s
134 Manual (APM). Use of "Intel's SDM" and "AMD's APM", or even just "SDM" or
135 "APM", without additional context is a-ok.
136
137 Do not reference specific sections, tables, figures, etc. by number, especially
138 not in comments. Instead, if necessary (see below), copy-paste the relevant
139 snippet and reference sections/tables/figures by name. The layouts of the SDM
140 and APM are constantly changing, and so the numbers/labels aren't stable.
141
142 Generally speaking, do not explicitly reference or copy-paste from the SDM or
143 APM in comments. With few exceptions, KVM *must* honor architectural behavior,
144 therefore it's implied that KVM behavior is emulating SDM and/or APM behavior.
145 Note, referencing the SDM/APM in changelogs to justify the change and provide
146 context is perfectly ok and encouraged.
147
148 Shortlog
149 ~~~~~~~~
150 The preferred prefix format is ``KVM: <topic>:``, where ``<topic>`` is one of::
151
152 - x86
153 - x86/mmu
154 - x86/pmu
155 - x86/xen
156 - selftests
157 - SVM
158 - nSVM
159 - VMX
160 - nVMX
161
162 **DO NOT use x86/kvm!** ``x86/kvm`` is used exclusively for Linux-as-a-KVM-guest
163 changes, i.e. for arch/x86/kernel/kvm.c. Do not use file names or complete file
164 paths as the subject/shortlog prefix.
165
166 Note, these don't align with the topics branches (the topic branches care much
167 more about code conflicts).
168
169 All names are case sensitive! ``KVM: x86:`` is good, ``kvm: vmx:`` is not.
170
171 Capitalize the first word of the condensed patch description, but omit ending
172 punctionation. E.g.::
173
174 KVM: x86: Fix a null pointer dereference in function_xyz()
175
176 not::
177
178 kvm: x86: fix a null pointer dereference in function_xyz.
179
180 If a patch touches multiple topics, traverse up the conceptual tree to find the
181 first common parent (which is often simply ``x86``). When in doubt,
182 ``git log path/to/file`` should provide a reasonable hint.
183
184 New topics do occasionally pop up, but please start an on-list discussion if
185 you want to propose introducing a new topic, i.e. don't go rogue.
186
187 See :ref:`the_canonical_patch_format` for more information, with one amendment:
188 do not treat the 70-75 character limit as an absolute, hard limit. Instead,
189 use 75 characters as a firm-but-not-hard limit, and use 80 characters as a hard
190 limit. I.e. let the shortlog run a few characters over the standard limit if
191 you have good reason to do so.
192
193 Changelog
194 ~~~~~~~~~
195 Most importantly, write changelogs using imperative mood and avoid pronouns.
196
197 See :ref:`describe_changes` for more information, with one amendment: lead with
198 a short blurb on the actual changes, and then follow up with the context and
199 background. Note! This order directly conflicts with the tip tree's preferred
200 approach! Please follow the tip tree's preferred style when sending patches
201 that primarily target arch/x86 code that is _NOT_ KVM code.
202
203 Stating what a patch does before diving into details is preferred by KVM x86
204 for several reasons. First and foremost, what code is actually being changed
205 is arguably the most important information, and so that info should be easy to
206 find. Changelogs that bury the "what's actually changing" in a one-liner after
207 3+ paragraphs of background make it very hard to find that information.
208
209 For initial review, one could argue the "what's broken" is more important, but
210 for skimming logs and git archaeology, the gory details matter less and less.
211 E.g. when doing a series of "git blame", the details of each change along the
212 way are useless, the details only matter for the culprit. Providing the "what
213 changed" makes it easy to quickly determine whether or not a commit might be of
214 interest.
215
216 Another benefit of stating "what's changing" first is that it's almost always
217 possible to state "what's changing" in a single sentence. Conversely, all but
218 the most simple bugs require multiple sentences or paragraphs to fully describe
219 the problem. If both the "what's changing" and "what's the bug" are super
220 short then the order doesn't matter. But if one is shorter (almost always the
221 "what's changing), then covering the shorter one first is advantageous because
222 it's less of an inconvenience for readers/reviewers that have a strict ordering
223 preference. E.g. having to skip one sentence to get to the context is less
224 painful than having to skip three paragraphs to get to "what's changing".
225
226 Fixes
227 ~~~~~
228 If a change fixes a KVM/kernel bug, add a Fixes: tag even if the change doesn't
229 need to be backported to stable kernels, and even if the change fixes a bug in
230 an older release.
231
232 Conversely, if a fix does need to be backported, explicitly tag the patch with
233 "Cc: stable@vger.kernel" (though the email itself doesn't need to Cc: stable);
234 KVM x86 opts out of backporting Fixes: by default. Some auto-selected patches
235 do get backported, but require explicit maintainer approval (search MANUALSEL).
236
237 Function References
238 ~~~~~~~~~~~~~~~~~~~
239 When a function is mentioned in a comment, changelog, or shortlog (or anywhere
240 for that matter), use the format ``function_name()``. The parentheses provide
241 context and disambiguate the reference.
242
243 Testing
244 -------
245 At a bare minimum, *all* patches in a series must build cleanly for KVM_INTEL=m
246 KVM_AMD=m, and KVM_WERROR=y. Building every possible combination of Kconfigs
247 isn't feasible, but the more the merrier. KVM_SMM, KVM_XEN, PROVE_LOCKING, and
248 X86_64 are particularly interesting knobs to turn.
249
250 Running KVM selftests and KVM-unit-tests is also mandatory (and stating the
251 obvious, the tests need to pass). The only exception is for changes that have
252 negligible probability of affecting runtime behavior, e.g. patches that only
253 modify comments. When possible and relevant, testing on both Intel and AMD is
254 strongly preferred. Booting an actual VM is encouraged, but not mandatory.
255
256 For changes that touch KVM's shadow paging code, running with TDP (EPT/NPT)
257 disabled is mandatory. For changes that affect common KVM MMU code, running
258 with TDP disabled is strongly encouraged. For all other changes, if the code
259 being modified depends on and/or interacts with a module param, testing with
260 the relevant settings is mandatory.
261
262 Note, KVM selftests and KVM-unit-tests do have known failures. If you suspect
263 a failure is not due to your changes, verify that the *exact same* failure
264 occurs with and without your changes.
265
266 Changes that touch reStructured Text documentation, i.e. .rst files, must build
267 htmldocs cleanly, i.e. with no new warnings or errors.
268
269 If you can't fully test a change, e.g. due to lack of hardware, clearly state
270 what level of testing you were able to do, e.g. in the cover letter.
271
272 New Features
273 ~~~~~~~~~~~~
274 With one exception, new features *must* come with test coverage. KVM specific
275 tests aren't strictly required, e.g. if coverage is provided by running a
276 sufficiently enabled guest VM, or by running a related kernel selftest in a VM,
277 but dedicated KVM tests are preferred in all cases. Negative testcases in
278 particular are mandatory for enabling of new hardware features as error and
279 exception flows are rarely exercised simply by running a VM.
280
281 The only exception to this rule is if KVM is simply advertising support for a
282 feature via KVM_GET_SUPPORTED_CPUID, i.e. for instructions/features that KVM
283 can't prevent a guest from using and for which there is no true enabling.
284
285 Note, "new features" does not just mean "new hardware features"! New features
286 that can't be well validated using existing KVM selftests and/or KVM-unit-tests
287 must come with tests.
288
289 Posting new feature development without tests to get early feedback is more
290 than welcome, but such submissions should be tagged RFC, and the cover letter
291 should clearly state what type of feedback is requested/expected. Do not abuse
292 the RFC process; RFCs will typically not receive in-depth review.
293
294 Bug Fixes
295 ~~~~~~~~~
296 Except for "obvious" found-by-inspection bugs, fixes must be accompanied by a
297 reproducer for the bug being fixed. In many cases the reproducer is implicit,
298 e.g. for build errors and test failures, but it should still be clear to
299 readers what is broken and how to verify the fix. Some leeway is given for
300 bugs that are found via non-public workloads/tests, but providing regression
301 tests for such bugs is strongly preferred.
302
303 In general, regression tests are preferred for any bug that is not trivial to
304 hit. E.g. even if the bug was originally found by a fuzzer such as syzkaller,
305 a targeted regression test may be warranted if the bug requires hitting a
306 one-in-a-million type race condition.
307
308 Note, KVM bugs are rarely urgent *and* non-trivial to reproduce. Ask yourself
309 if a bug is really truly the end of the world before posting a fix without a
310 reproducer.
311
312 Posting
313 -------
314
315 Links
316 ~~~~~
317 Do not explicitly reference bug reports, prior versions of a patch/series, etc.
318 via ``In-Reply-To:`` headers. Using ``In-Reply-To:`` becomes an unholy mess
319 for large series and/or when the version count gets high, and ``In-Reply-To:``
320 is useless for anyone that doesn't have the original message, e.g. if someone
321 wasn't Cc'd on the bug report or if the list of recipients changes between
322 versions.
323
324 To link to a bug report, previous version, or anything of interest, use lore
325 links. For referencing previous version(s), generally speaking do not include
326 a Link: in the changelog as there is no need to record the history in git, i.e.
327 put the link in the cover letter or in the section git ignores. Do provide a
328 formal Link: for bug reports and/or discussions that led to the patch. The
329 context of why a change was made is highly valuable for future readers.
330
331 Git Base
332 ~~~~~~~~
333 If you are using git version 2.9.0 or later (Googlers, this is all of you!),
334 use ``git format-patch`` with the ``--base`` flag to automatically include the
335 base tree information in the generated patches.
336
337 Note, ``--base=auto`` works as expected if and only if a branch's upstream is
338 set to the base topic branch, e.g. it will do the wrong thing if your upstream
339 is set to your personal repository for backup purposes. An alternative "auto"
340 solution is to derive the names of your development branches based on their
341 KVM x86 topic, and feed that into ``--base``. E.g. ``x86/pmu/my_branch_name``,
342 and then write a small wrapper to extract ``pmu`` from the current branch name
343 to yield ``--base=x/pmu``, where ``x`` is whatever name your repository uses to
344 track the KVM x86 remote.
345
346 Co-Posting Tests
347 ~~~~~~~~~~~~~~~~
348 KVM selftests that are associated with KVM changes, e.g. regression tests for
349 bug fixes, should be posted along with the KVM changes as a single series. The
350 standard kernel rules for bisection apply, i.e. KVM changes that result in test
351 failures should be ordered after the selftests updates, and vice versa, new
352 tests that fail due to KVM bugs should be ordered after the KVM fixes.
353
354 KVM-unit-tests should *always* be posted separately. Tools, e.g. b4 am, don't
355 know that KVM-unit-tests is a separate repository and get confused when patches
356 in a series apply on different trees. To tie KVM-unit-tests patches back to
357 KVM patches, first post the KVM changes and then provide a lore Link: to the
358 KVM patch/series in the KVM-unit-tests patch(es).
359
360 Notifications
361 -------------
362 When a patch/series is officially accepted, a notification email will be sent
363 in reply to the original posting (cover letter for multi-patch series). The
364 notification will include the tree and topic branch, along with the SHA1s of
365 the commits of applied patches.
366
367 If a subset of patches is applied, this will be clearly stated in the
368 notification. Unless stated otherwise, it's implied that any patches in the
369 series that were not accepted need more work and should be submitted in a new
370 version.
371
372 If for some reason a patch is dropped after officially being accepted, a reply
373 will be sent to the notification email explaining why the patch was dropped, as
374 well as the next steps.
375
376 SHA1 Stability
377 ~~~~~~~~~~~~~~
378 SHA1s are not 100% guaranteed to be stable until they land in Linus' tree! A
379 SHA1 is *usually* stable once a notification has been sent, but things happen.
380 In most cases, an update to the notification email be provided if an applied
381 patch's SHA1 changes. However, in some scenarios, e.g. if all KVM x86 branches
382 need to be rebased, individual notifications will not be given.
383
384 Vulnerabilities
385 ---------------
386 Bugs that can be exploited by the guest to attack the host (kernel or
387 userspace), or that can be exploited by a nested VM to *its* host (L2 attacking
388 L1), are of particular interest to KVM. Please follow the protocol for
389 :ref:`securitybugs` if you suspect a bug can lead to an escape, data leak, etc.
390
391

3. 한국어 전문 번역

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

KVM x86 contribution의 기본 태도

1-19

KVM은 newcomer의 기여를 소중히 여기고 장려하는 열린 community를 지향한다. 이 문서의 길이와 많은 규칙에 위축될 필요는 없다. 누구나 실수하며 모두 한때 beginner였다. KVM x86 guideline을 따르려고 성실히 노력하고 feedback을 받아들이며 실수에서 배운다면 환영받는다.

요약하면 testing은 필수이며 기존 style과 pattern에 일관되게 맞춰야 한다.

KVM tree와 KVM x86 tree

20-47

KVM x86은 main KVM tree의 일부에서 “또 하나의 KVM architecture”로 전환하는 중이다. 따라서 main KVM tree와 KVM x86 전용 tree에 나뉜다.

git.kernel.org/pub/scm/virt/kvm/kvm.git
github.com/kvm-x86/linux.git

일반적으로 현재 cycle의 fix는 main KVM tree에 직접 적용하고 다음 cycle 개발은 모두 KVM x86 tree를 거친다. 드물게 현재 cycle fix가 KVM x86 tree를 거치면 fixes branch에 적용한 뒤 main KVM tree로 보낸다. 이 전환 상태는 예측 가능한 미래 동안 계속될 것으로 본다.

KVM x86 tree는 여러 topic branch로 구성한다. 세분화된 branch는 개발 영역을 추적하기 쉽고 사람의 실수나 buggy commit의 부수 피해를 제한한다. Topic branch HEAD를 drop해도 다른 in-flight commit SHA1은 바뀌지 않으며 bug 때문에 pull request를 거절해도 해당 topic branch만 지연된다.

next와 fixes를 제외한 topic branch는 갱신될 때 필요에 따라 Cthulhu merge로 next에 합친다. 따라서 next에 대한 force push는 흔하다.

Release cycle과 review timeline

49-80

현재 mainline release용 fix는 보통 KVM x86 tree를 거치지 않고 main KVM tree에 직접 적용한다. 다음 release용 change는 KVM x86 tree를 거친다. KVM x86의 각 topic branch는 보통 Linus가 merge window를 열기 전 주, 일반 release라면 rc7 다음 주에 main KVM으로 pull request를 보낸다. 문제가 없으면 Linus의 merge window 동안 main KVM pull request에 topic branch가 합쳐진다.

KVM x86 tree에 공식 merge window는 없지만 새 feature는 rc5 무렵, 다음 release용 fix는 rc6 무렵 soft close된다.

Submission은 대체로 FIFO로 review하고 적용하지만 series 크기, reviewer cache에 아직 내용이 남은 patch 등은 조정할 수 있다. 현재 release 또는 stable tree용 fix는 우선 처리한다. Non-KVM tree, 흔히 tip tree를 통해 들어가거나 다른 ack/review가 있는 patch도 어느 정도 우선한다.

Review 대부분은 대략 rc1부터 rc6 사이에 수행한다. rc6부터 다음 rc1까지는 다른 작업을 따라잡는 기간이어서 응답이 없는 일이 드물지 않다. Status ping은 가능하지만 현재 release cycle을 고려해 현실적인 기대를 가져야 한다. 단순 feedback이 아니라 acceptance를 요청한다면 merge 준비를 최대한 마쳐야 한다. Build나 test를 깨뜨리는 series에 대한 ping은 maintainer를 불쾌하게 한다.

Patch base tree와 multi-arch 예외

82-104

현재 mainline release를 대상으로 하는 fix는 다음 master를 기준으로 한다.

git://git.kernel.org/pub/scm/virt/kvm/kvm.git master

Fix라고 해서 현재 release에 자동으로 포함되는 것은 아니다. 단일 규칙은 없지만 대개 urgent, critical하거나 현재 release에서 도입된 bug의 fix만 현재 release를 대상으로 한다.

그 밖의 모든 change는 kvm-x86/next를 기준으로 한다. 특정 topic branch를 base로 고를 필요가 없으며 topic branch 사이 conflict와 dependency는 maintainer가 해결한다.

예외는 common KVM code를 사소하지 않게 수정하거나 다른 architecture code에 표면적 수준을 넘는 change가 있는 multi-arch series다. 이런 series는 kvm-x86/next가 기반으로 삼은 release candidate처럼 KVM history의 공통 stable point를 base로 한다. Multi-arch인지 확신이 없다면 보수적으로 common base를 사용한다.

Coding style, comment, SDM/APM reference

106-146

KVM x86에서 style, naming, pattern의 최우선 기준은 일관성이다. 다른 판단 기준이 없으면 이미 존재하는 code에 맞춘다. 몇 가지 예외를 제외하면 patch가 KVM과 non-KVM x86 file을 함께 수정하는 경우가 많으므로 tip tree maintainer의 coding style을 따른다.

Variable declaration의 reverse fir tree, reverse Christmas tree 또는 reverse XMAS tree style은 엄격한 필수는 아니지만 선호한다. 일부 특별한 경우를 제외하고 function에 kernel-doc comment를 쓰지 않는다. Public처럼 보이는 KVM function 대부분은 KVM 내부에서만 사용하며 header와 export를 private로 바꿀 계획이 있기 때문이다.

Comment는 imperative mood로 쓰고 pronoun을 피한다. Code의 high-level overview 또는 왜 그렇게 동작하는지를 설명한다. Code가 문자 그대로 무엇을 하는지는 반복하지 않는다. Code 자체가 이해 불가능하다면 comment로 해결할 수 없다.

KVM code 상당 부분은 Intel Software Development Manual(SDM)과 AMD Architecture Programmer's Manual(APM)의 architecture behavior에 직접 연결된다. 추가 맥락 없이 Intel's SDM, AMD's APM 또는 SDM/APM이라고 써도 된다.

특정 section, table, figure 번호를 reference하지 않는다. SDM과 APM layout이 계속 바뀌어 번호와 label이 안정적이지 않다. 꼭 필요하면 관련 snippet을 인용하고 이름으로 reference한다. 일반적으로 comment에서 SDM/APM을 명시하거나 copy-paste하지 않는다. KVM은 당연히 architecture behavior를 따라야 하기 때문이다. 다만 changelog에서 change 근거와 context로 SDM/APM을 reference하는 것은 권장한다.

Shortlog prefix와 길이

148-191

권장 prefix는 KVM: <topic>: 형식이다.

  • x86
  • x86/mmu
  • x86/pmu
  • x86/xen
  • selftests
  • SVM
  • nSVM
  • VMX
  • nVMX

x86/kvm은 사용하면 안 된다. 이 prefix는 arch/x86/kernel/kvm.c처럼 Linux가 KVM guest로 동작하는 change에만 사용한다. File name이나 전체 path도 subject/shortlog prefix로 쓰지 않는다. Shortlog topic은 code conflict 중심의 topic branch 이름과 일치하지 않을 수 있다.

모든 이름은 case-sensitive다. KVM: x86:은 맞고 kvm: vmx:은 틀리다. 압축된 patch description의 첫 단어는 대문자로 시작하고 끝 punctuation은 생략한다.

KVM: x86: Fix a null pointer dereference in function_xyz()

# 잘못된 예
kvm: x86: fix a null pointer dereference in function_xyz.

여러 topic을 수정하면 conceptual tree에서 첫 common parent까지 올라가며 흔히 x86이 된다. 확신이 없으면 git log path/to/file이 단서를 준다. 새 topic을 제안하려면 독단적으로 사용하지 말고 list에서 먼저 논의한다.

Canonical patch format을 따르되 70~75 character를 절대 제한으로 보지 않는다. 75는 강하지만 넘을 수 있는 제한, 80은 hard limit다. 좋은 이유가 있으면 standard보다 몇 character 길어도 된다.

Changelog, Fixes, function reference

193-241

Changelog도 imperative mood로 쓰고 pronoun을 피한다. 먼저 실제 change를 짧게 설명한 뒤 context와 background를 적는다. 이 순서는 tip tree의 선호와 반대다. 주 대상이 KVM이 아닌 arch/x86 code라면 tip tree style을 따른다.

무엇을 바꾸는지가 가장 중요한 정보이므로 쉽게 찾을 수 있어야 한다. Background 세 문단 뒤 한 줄에 change를 숨기면 찾기 어렵다. Initial review에서는 무엇이 깨졌는지가 더 중요할 수 있지만 log 훑기와 git archaeology에서는 자세한 background의 중요성이 줄어든다. 연속 git blame에서는 culprit commit을 제외한 각 change의 상세한 문제 설명보다 실제 change를 빨리 판별하는 정보가 유용하다.

무엇을 바꾸는지는 거의 항상 한 문장으로 쓸 수 있지만 단순하지 않은 bug는 여러 문장이나 문단이 필요하다. 짧은 내용을 먼저 쓰면 특정 순서를 선호하는 reader도 한 문장만 건너뛰면 되어 부담이 적다.

KVM/kernel bug를 고치면 stable backport가 필요 없거나 오래된 release의 bug라도 Fixes tag를 추가한다. 반대로 backport가 필요하면 patch에 Cc: stable@vger.kernel을 명시한다. Email 자체에 stable을 Cc할 필요는 없다. KVM x86은 Fixes tag만으로 자동 backport하는 동작을 기본 거부한다. 일부 auto-selected patch도 maintainer의 명시적 승인, 즉 MANUALSEL이 필요하다.

Comment, changelog, shortlog 등 어디서든 function을 언급할 때 function_name() 형식을 사용한다. Parenthesis가 context를 제공하고 다른 reference와 구분한다.

필수 build와 runtime test

243-270

최소한 series의 모든 patch는 다음 설정에서 warning/error 없이 build되어야 한다.

KVM_INTEL=m
KVM_AMD=m
KVM_WERROR=y

모든 Kconfig 조합 build는 불가능하지만 많을수록 좋다. KVM_SMM, KVM_XEN, PROVE_LOCKING, X86_64는 특히 유용한 option이다.

KVM selftests와 KVM-unit-tests 실행 및 통과도 필수다. Runtime behavior에 영향을 줄 가능성이 무시할 만큼 작은 comment-only patch 정도만 예외다. 가능하고 관련이 있다면 Intel과 AMD 양쪽에서 test하는 것을 강하게 선호한다. 실제 VM boot는 권장하지만 필수는 아니다.

KVM shadow paging code를 수정하면 TDP(EPT/NPT)를 끈 상태의 test가 필수다. Common KVM MMU code를 수정하면 TDP disabled test를 강하게 권장한다. 다른 change도 수정 code가 module parameter에 의존하거나 상호 작용하면 관련 설정의 test가 필수다.

KVM selftests와 KVM-unit-tests에는 알려진 failure가 있다. 자신의 change 때문이 아니라고 생각한다면 change 전후에 정확히 같은 failure가 발생하는지 확인한다. reStructuredText .rst를 수정하면 새 warning이나 error 없이 htmldocs가 build되어야 한다. Hardware 부족 등으로 완전히 test할 수 없다면 cover letter에 수행한 test 수준을 명확히 적는다.

새 feature의 test coverage

272-292

한 가지 예외를 제외하면 새 feature에는 반드시 test coverage가 있어야 한다. 충분히 enable된 guest VM 실행이나 VM 안의 관련 kernel selftest로 coverage를 제공할 수 있어 KVM 전용 test가 절대 필수는 아니지만 언제나 dedicated KVM test를 선호한다.

새 hardware feature enable에는 negative testcase가 필수다. 단순 VM 실행으로 error와 exception flow가 거의 실행되지 않기 때문이다.

유일한 예외는 KVM_GET_SUPPORTED_CPUID를 통해 support를 알리기만 하는 feature다. KVM이 guest 사용을 막을 수 없고 실제 enable 동작도 없는 instruction/feature가 이에 해당한다.

새 feature는 새 hardware feature만 뜻하지 않는다. 기존 KVM selftests 또는 KVM-unit-tests로 충분히 검증할 수 없는 모든 새 기능에 test가 필요하다.

Early feedback을 위해 test 없이 새 feature 개발을 게시하는 것은 환영하지만 RFC tag를 붙이고 cover letter에 원하는 feedback 종류를 명확히 적어야 한다. RFC 절차를 남용해서는 안 되며 RFC는 보통 깊은 review를 받지 않는다.

Bug fix reproducer와 regression test

294-310

Code inspection만으로 명백한 bug를 제외하면 fix에는 reproducer가 있어야 한다. Build error와 test failure처럼 reproducer가 암묵적인 경우도 있지만 무엇이 깨졌고 fix를 어떻게 검증하는지 reader가 명확히 알아야 한다.

Non-public workload/test에서 찾은 bug에는 어느 정도 예외를 허용하지만 regression test 제공을 강하게 선호한다. 일반적으로 쉽게 재현되지 않는 모든 bug에는 regression test가 좋다. Syzkaller 같은 fuzzer가 처음 찾았더라도 백만 번에 한 번 생기는 race라면 targeted regression test가 필요할 수 있다.

KVM bug가 긴급하면서 동시에 재현하기 어려운 경우는 드물다. Reproducer 없이 fix를 게시하기 전에 정말 세상이 끝날 만큼 긴급한지 자문한다.

KVM selftests와 KVM-unit-tests 게시 순서

346-358

KVM bug fix의 regression test처럼 KVM change와 연결된 KVM selftest는 KVM change와 하나의 series로 함께 게시한다. Standard kernel bisection rule을 지켜 KVM change가 test failure를 일으킨다면 selftest update를 먼저 배치한다. 반대로 새 test가 기존 KVM bug 때문에 실패한다면 KVM fix를 먼저 배치한다.

KVM-unit-tests는 항상 별도 series로 게시한다. b4 am 같은 tool은 KVM-unit-tests가 별도 repository임을 몰라 한 series의 patch가 서로 다른 tree에 적용되면 혼란을 겪는다. 먼저 KVM change를 게시한 뒤 KVM-unit-tests patch에서 해당 KVM patch/series의 lore Link를 제공한다.

Acceptance notification과 SHA1 stability

360-382

Patch/series가 공식 accept되면 original posting, multi-patch series라면 cover letter에 reply로 notification email을 보낸다. 적용된 tree와 topic branch, patch commit SHA1을 포함한다.

일부 patch만 적용했다면 notification에서 명확히 말한다. 별도 설명이 없다면 accept되지 않은 patch는 추가 작업이 필요하며 새 version으로 다시 제출해야 한다.

공식 accept 뒤 patch를 drop하면 notification email에 reply하여 이유와 다음 단계를 설명한다.

SHA1은 Linus tree에 들어갈 때까지 100% 안정적이지 않다. Notification 뒤에는 보통 안정적이지만 예외가 있다. 적용 patch SHA1이 바뀌면 대부분 notification update를 보내지만 모든 KVM x86 branch를 rebase해야 하는 상황처럼 individual notification을 보내지 않을 때도 있다.

Guest에서 host를 공격할 수 있는 취약점

384-390

Guest가 host kernel 또는 userspace를 공격할 수 있거나 nested VM이 자신의 host, 즉 L2가 L1을 공격할 수 있는 bug는 KVM에서 특히 중요하다. Escape, data leak 등으로 이어질 수 있다고 의심하면 Documentation/admin-guide/security-bugs.rst의 security bug protocol을 따른다.