요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==================
Guest halt polling
==================
The cpuidle_haltpoll driver, with the haltpoll governor, allows
the guest vcpus to poll for a specified amount of time before
halting.
This provides the following benefits to host side polling:
1) The POLL flag is set while polling is performed, which allows
a remote vCPU to avoid sending an IPI (and the associated
cost of handling the IPI) when performing a wakeup.
2) The VM-exit cost can be avoided.
The downside of guest side polling is that polling is performed
even with other runnable tasks in the host.
The basic logic as follows: A global value, guest_halt_poll_ns,
is configured by the user, indicating the maximum amount of
time polling is allowed. This value is fixed.
Each vcpu has an adjustable guest_halt_poll_ns
("per-cpu guest_halt_poll_ns"), which is adjusted by the algorithm
in response to events (explained below).
Module Parameters
=================
The haltpoll governor has 5 tunable module parameters:
1) guest_halt_poll_ns:
Maximum amount of time, in nanoseconds, that polling is
performed before halting.
Default: 200000
2) guest_halt_poll_shrink:
Division factor used to shrink per-cpu guest_halt_poll_ns when
wakeup event occurs after the global guest_halt_poll_ns.
Default: 2
3) guest_halt_poll_grow:
Multiplication factor used to grow per-cpu guest_halt_poll_ns
when event occurs after per-cpu guest_halt_poll_ns
but before global guest_halt_poll_ns.
Default: 2
4) guest_halt_poll_grow_start:
The per-cpu guest_halt_poll_ns eventually reaches zero
in case of an idle system. This value sets the initial
per-cpu guest_halt_poll_ns when growing. This can
be increased from 10000, to avoid misses during the initial
growth stage:
10k, 20k, 40k, ... (example assumes guest_halt_poll_grow=2).
Default: 50000
5) guest_halt_poll_allow_shrink:
Bool parameter which allows shrinking. Set to N
to avoid it (per-cpu guest_halt_poll_ns will remain
high once achieves global guest_halt_poll_ns value).
Default: Y
The module parameters can be set from the sysfs files in::
/sys/module/haltpoll/parameters/
Further Notes
=============
- Care should be taken when setting the guest_halt_poll_ns parameter as a
large value has the potential to drive the cpu usage to 100% on a machine
which would be almost entirely idle otherwise.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
게스트 halt polling의 목적과 절충
1-18`cpuidle_haltpoll` driver와 `haltpoll` governor를 함께 사용하면 guest vCPU가 halt하기 전에 지정된 시간 동안 event를 polling할 수 있습니다.
Host-side polling과 비교하면 두 가지 이점이 있습니다. Polling 중 `POLL` flag가 설정되므로 remote vCPU가 wakeup할 때 IPI를 보내는 비용과 IPI 처리 비용을 피할 수 있고, halt에 따른 VM-exit 비용도 피할 수 있습니다.
반면 guest-side polling은 host에 실행 가능한 다른 task가 있어도 polling을 수행하므로 CPU 시간을 불필요하게 소비할 수 있습니다.
지연 감소와 host CPU 소비를 함께 고려해야 합니다.
==================
Guest halt polling
==================
The cpuidle_haltpoll driver, with the haltpoll governor, allows
the guest vcpus to poll for a specified amount of time before
halting.
This provides the following benefits to host side polling:
1) The POLL flag is set while polling is performed, which allows
a remote vCPU to avoid sending an IPI (and the associated
cost of handling the IPI) when performing a wakeup.
2) The VM-exit cost can be avoided.
The downside of guest side polling is that polling is performed
even with other runnable tasks in the host.
전역 상한과 vCPU별 적응값
19-27사용자가 고정 전역값 `guest_halt_poll_ns`를 설정하며, 이 값은 polling을 허용하는 최대 시간입니다.
각 vCPU에는 별도로 조절되는 per-CPU `guest_halt_poll_ns`가 있습니다. 알고리즘은 wakeup event가 발생한 시점에 따라 이 값을 증가시키거나 감소시키되 전역 상한을 넘지 않습니다.
Event 시점을 per-CPU window와 global limit에 비교합니다.
The basic logic as follows: A global value, guest_halt_poll_ns,
is configured by the user, indicating the maximum amount of
time polling is allowed. This value is fixed.
Each vcpu has an adjustable guest_halt_poll_ns
("per-cpu guest_halt_poll_ns"), which is adjusted by the algorithm
in response to events (explained below).
1. guest_halt_poll_ns
28-39`haltpoll` governor에는 다섯 개의 조정 가능한 module parameter가 있습니다. 첫 번째 `guest_halt_poll_ns`는 halt하기 전에 polling할 최대 시간을 nanosecond 단위로 지정합니다.
기본값은 `200000`ns입니다. 이 전역값은 모든 per-CPU 적응값의 상한으로 사용됩니다.
Module Parameters
=================
The haltpoll governor has 5 tunable module parameters:
1) guest_halt_poll_ns:
Maximum amount of time, in nanoseconds, that polling is
performed before halting.
Default: 200000
2. guest_halt_poll_shrink
40-46`guest_halt_poll_shrink`는 wakeup event가 전역 `guest_halt_poll_ns` 이후에 발생했을 때 per-CPU `guest_halt_poll_ns`를 줄이는 나눗셈 계수입니다.
기본값은 `2`이므로 shrink가 허용된 상태에서는 늦은 wakeup이 관찰될 때 per-CPU polling window가 절반으로 줄어듭니다.
2) guest_halt_poll_shrink:
Division factor used to shrink per-cpu guest_halt_poll_ns when
wakeup event occurs after the global guest_halt_poll_ns.
Default: 2
3. guest_halt_poll_grow
47-54`guest_halt_poll_grow`는 event가 per-CPU `guest_halt_poll_ns`보다 늦지만 전역 `guest_halt_poll_ns`보다 이르게 발생할 때 per-CPU 값을 키우는 곱셈 계수입니다.
기본값은 `2`이므로 이 구간의 wakeup을 관찰할 때 polling window가 두 배씩 증가합니다.
3) guest_halt_poll_grow:
Multiplication factor used to grow per-cpu guest_halt_poll_ns
when event occurs after per-cpu guest_halt_poll_ns
but before global guest_halt_poll_ns.
Default: 2
4. guest_halt_poll_grow_start
55-66Idle system에서는 per-CPU `guest_halt_poll_ns`가 결국 0에 도달할 수 있습니다. `guest_halt_poll_grow_start`는 0에서 다시 성장할 때 사용할 초기 per-CPU 값을 지정합니다.
초기 성장 단계의 event miss를 줄이기 위해 이 값을 10000보다 크게 설정할 수 있습니다. `guest_halt_poll_grow=2`라면 예시 성장 수열은 `10k, 20k, 40k, ...`입니다. 문서의 기본값은 `50000`입니다.
grow_start가 첫 단계의 크기를 결정합니다.
4) guest_halt_poll_grow_start:
The per-cpu guest_halt_poll_ns eventually reaches zero
in case of an idle system. This value sets the initial
per-cpu guest_halt_poll_ns when growing. This can
be increased from 10000, to avoid misses during the initial
growth stage:
10k, 20k, 40k, ... (example assumes guest_halt_poll_grow=2).
Default: 50000
5. guest_halt_poll_allow_shrink와 sysfs
67-78Boolean parameter `guest_halt_poll_allow_shrink`는 per-CPU window 축소 허용 여부를 제어합니다. 기본값은 `Y`이며 `N`으로 설정하면 shrink를 막습니다.
Shrink를 막은 경우 per-CPU `guest_halt_poll_ns`가 전역 상한에 도달한 뒤 높은 값으로 유지됩니다. 모든 module parameter는 `/sys/module/haltpoll/parameters/` 아래의 sysfs 파일에서 설정할 수 있습니다.
다섯 parameter의 역할과 기본값입니다.
5) guest_halt_poll_allow_shrink:
Bool parameter which allows shrinking. Set to N
to avoid it (per-cpu guest_halt_poll_ns will remain
high once achieves global guest_halt_poll_ns value).
Default: Y
The module parameters can be set from the sysfs files in::
/sys/module/haltpoll/parameters/
추가 주의 사항
79-84`guest_halt_poll_ns`를 설정할 때는 주의해야 합니다. 큰 값을 사용하면 원래는 거의 완전히 idle했을 시스템에서 polling이 CPU 사용률을 100%까지 끌어올릴 수 있습니다.
따라서 latency 이득만 보지 말고 host의 runnable task, 전력 소비와 idle 비율을 함께 측정해 상한을 정해야 합니다.
Further Notes
=============
- Care should be taken when setting the guest_halt_poll_ns parameter as a
large value has the potential to drive the cpu usage to 100% on a machine
which would be almost entirely idle otherwise.
요약·해설
guest-halt-polling.rst:1-84Halt polling은 짧은 idle 구간의 IPI와 VM-exit 지연을 줄이는 대신 host CPU 시간을 소비합니다. Per-CPU window를 event 시점에 맞춰 조절하되 global limit과 shrink 허용 정책을 함께 설정해야 latency와 전력·스케줄링 비용의 균형을 잡을 수 있습니다.