acrn-hypervisor/hypervisor/arch/x86
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
..
boot Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
configs HV: emulate dummy multi-function dev in Service VM 2023-09-11 16:13:16 +08:00
guest hv: support halt in hv idle 2023-09-15 11:52:40 +08:00
lib hv: shell: improve console to modify input easier 2022-07-28 23:31:43 +08:00
seed Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
cpu_caps.c hv: cve hotfix: Disable RRSBA on platform using retpoline 2022-07-22 09:38:41 +08:00
cpu_state_tbl.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
cpu.c hv: support halt in hv idle 2023-09-15 11:52:40 +08:00
e820.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
exception.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
gdt.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
idt.S Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
init.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
ioapic.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
irq.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
lapic.c doc: remove '@return None' for void functions 2023-08-03 14:56:29 -07:00
mmu.c hv: refine the sworld memory allocate 2022-10-19 15:58:25 +08:00
nmi.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
notify.c hv: improve smp call to support debugging RTVM 2022-09-26 13:28:02 +08:00
page.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
pagetable.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
platform_caps.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
pm.c hv: add ACRN CPU frequency initializer 2022-10-08 11:13:21 +08:00
rdt.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
rtcm.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
sched.S Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
security.c hv: change 'DISABLED' settings to 'ENABLED' 2022-08-17 09:23:33 +08:00
sgx.c hv: sgx: refactor partition_epc() 2023-06-06 15:22:19 +08:00
trampoline.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
tsc_deadline_timer.c HV: arch: fix a violation of coding guideline C-TY-24 2021-11-04 18:15:47 +08:00
tsc.c hv: tsc: start HPET counter before calibration 2022-09-15 03:14:01 +08:00
vmx.c Update copyright year range in code headers 2022-07-15 11:48:35 +08:00
vtd.c doc: Fix spelling and typo mistakes. 2023-09-05 09:34:21 +08:00
wakeup.S Update copyright year range in code headers 2022-07-15 11:48:35 +08:00