mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 22:42:53 +00:00
hv: PAUSE-loop exiting support in hypervisor
As we enabled cpu sharing, PAUSE-loop exiting can help vcpu to release its pcpu proactively. It's good for performance. VMX_PLE_GAP: upper bound on the amount of time between two successive executions of PAUSE in a loop. VMX_PLE_WINDOW: upper bound on the amount of time a guest is allowed to execute in a PAUSE loop Tracked-On: #4329 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
bfecf30f32
commit
4115dd6241
@ -297,7 +297,8 @@ static void init_exec_ctrl(struct acrn_vcpu *vcpu)
|
||||
*/
|
||||
value32 = check_vmx_ctrl(MSR_IA32_VMX_PROCBASED_CTLS2,
|
||||
VMX_PROCBASED_CTLS2_VAPIC | VMX_PROCBASED_CTLS2_EPT |VMX_PROCBASED_CTLS2_VPID |
|
||||
VMX_PROCBASED_CTLS2_RDTSCP | VMX_PROCBASED_CTLS2_UNRESTRICT);
|
||||
VMX_PROCBASED_CTLS2_RDTSCP | VMX_PROCBASED_CTLS2_UNRESTRICT |
|
||||
VMX_PROCBASED_CTLS2_PAUSE_LOOP);
|
||||
|
||||
/* SDM Vol3, 25.3, setting "enable INVPCID" VM-execution to 1 with "INVLPG exiting" disabled,
|
||||
* passes-through INVPCID instruction to guest if the instruction is supported.
|
||||
@ -425,6 +426,10 @@ static void init_exec_ctrl(struct acrn_vcpu *vcpu)
|
||||
exec_vmwrite(VMX_CR3_TARGET_1, 0UL);
|
||||
exec_vmwrite(VMX_CR3_TARGET_2, 0UL);
|
||||
exec_vmwrite(VMX_CR3_TARGET_3, 0UL);
|
||||
|
||||
/* Setup PAUSE-loop exiting - 24.6.13 */
|
||||
exec_vmwrite(VMX_PLE_GAP, 128U);
|
||||
exec_vmwrite(VMX_PLE_WINDOW, 4096U);
|
||||
}
|
||||
|
||||
static void init_entry_ctrl(const struct acrn_vcpu *vcpu)
|
||||
|
@ -30,6 +30,7 @@ static int32_t unhandled_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
static int32_t xsetbv_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
static int32_t wbinvd_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
static int32_t undefined_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
static int32_t pause_vmexit_handler(__unused struct acrn_vcpu *vcpu);
|
||||
|
||||
/* VM Dispatch table for Exit condition handling */
|
||||
static const struct vm_exit_dispatch dispatch_table[NR_VMX_EXIT_REASONS] = {
|
||||
@ -113,7 +114,7 @@ static const struct vm_exit_dispatch dispatch_table[NR_VMX_EXIT_REASONS] = {
|
||||
[VMX_EXIT_REASON_MONITOR] = {
|
||||
.handler = unhandled_vmexit_handler},
|
||||
[VMX_EXIT_REASON_PAUSE] = {
|
||||
.handler = unhandled_vmexit_handler},
|
||||
.handler = pause_vmexit_handler},
|
||||
[VMX_EXIT_REASON_ENTRY_FAILURE_MACHINE_CHECK] = {
|
||||
.handler = unhandled_vmexit_handler},
|
||||
[VMX_EXIT_REASON_TPR_BELOW_THRESHOLD] = {
|
||||
@ -277,6 +278,12 @@ static int32_t triple_fault_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t pause_vmexit_handler(__unused struct acrn_vcpu *vcpu)
|
||||
{
|
||||
yield_current();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t cpuid_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
uint64_t rax, rbx, rcx, rdx;
|
||||
|
Loading…
Reference in New Issue
Block a user