acrn-hypervisor/hypervisor/arch/x86/guest
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
..
assign.c hv: bugfix: skip invalid ffs64 return value 2023-07-14 17:38:16 +08:00
ept.c hv: define a MACRO to indicate maximum memory size 2023-09-12 13:52:48 +08:00
guest_memory.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
hyperv.c hv: tlfs: fix the incorrect vLAPIC freq MSR 2022-07-26 05:53:19 +08:00
instr_emul.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
lock_instr_emul.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
nested.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
optee.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
pm.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
trusty.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
ucode.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vcat.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vcpu.c hv: support halt in hv idle 2023-09-15 11:52:40 +08:00
vcpuid.c hv: disable HFI and ITD for guests 2023-08-01 14:57:23 +08:00
ve820.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vept.c hv: define a MACRO to indicate maximum memory size 2023-09-12 13:52:48 +08:00
virq.c hv: improve smp call to support debugging RTVM 2022-09-26 13:28:02 +08:00
virtual_cr.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vlapic_priv.h Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vlapic.c doc: remove '@return None' for void functions 2023-08-03 14:56:29 -07:00
vm_reset.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vm.c hv: fix Service VM EPT mapping upper bound 2023-09-05 11:09:46 +08:00
vmcall.c hv: add hypercall to register asyncio 2022-09-27 10:26:42 +08:00
vmcs.c hv: hide mwait from guest. 2022-11-04 18:55:52 +08:00
vmexit.c hv: hide mwait from guest. 2022-11-04 18:55:52 +08:00
vmsr.c hv: disable HFI and ITD for guests 2023-08-01 14:57:23 +08:00
vmtrr.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vmx_asm.S Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vmx_io.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00