acrn-hypervisor/hypervisor/common
Wu Zhou 064be1e3e6 hv: support halt in hv idle
When all vCPU threads on one pCPU are put to sleep (e.g., when all
guests execute HLT), hv would schedule to idle thread. Currently the
idle thread executes PAUSE which does not enter any c-state and consumes
a lot of power. This patch is to support HLT in the idle thread.

When we switch to HLT, we have to make sure events that would wake a
vCPU must also be able to wake the pCPU. Those events are either
generated by local interrupt or issued by other pCPUs followed by an
ipi kick.

Each of them have an interrupt involved, so they are also able to wake
the halted pCPU. Except when the pCPU has just scheduled to idle thread
but not yet halted, interrupts could be missed.

sleep-------schedule to idle------IRQ ON---HLT--(kick missed)
                                         ^
                              wake---kick|

This areas should be protected. This is done by a safe halt
mechanism leveraging STI instruction’s delay effect (same as Linux).

vCPUs with lapic_pt or hv with CONFIG_KEEP_IRQ_DISABLED=y does not allow
interrupts in root mode, so they could never wake from HLT (INIT kick
does not wake HLT in root mode either). They should continue using PAUSE
in idle.

Tracked-On: #8507
Signed-off-by: Wu Zhou <wu.zhou@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2023-09-15 11:52:40 +08:00
..
delay.c hv/mod_timer: separate delay functions from the timer module 2021-05-18 16:43:28 +08:00
efi_mmap.c HV: fix build issue on RELEASE version 2021-11-16 19:01:44 +08:00
event.c hv: support halt in hv idle 2023-09-15 11:52:40 +08:00
hv_main.c hv: support halt in hv idle 2023-09-15 11:52:40 +08:00
hypercall.c hv: Write _CPC to guests' ACPI when VHWP is enabled 2023-06-09 10:06:42 +08:00
irq.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
ptdev.c ptirq: Fix ptirq hash tables 2023-04-13 12:24:57 +08:00
sbuf.c hv: dispatch asyncio request 2022-09-27 10:26:42 +08:00
sched_bvt.c hv: switch to dynamic timer in bvt scheduler 2023-09-13 08:30:27 +08:00
sched_iorr.c hv: use kick-mode in per-cpu to control kick pCPU 2022-09-26 13:28:02 +08:00
sched_noop.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
sched_prio.c hv: add priority based scheduler 2021-09-24 09:32:18 +08:00
schedule.c hv: support halt in hv idle 2023-09-15 11:52:40 +08:00
softirq.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
ticks.c hv/mod_timer: split tsc handling code from timer. 2021-05-18 16:43:28 +08:00
timer.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
trusty_hypercall.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vm_load.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00