Skip to content

Commit 5d9c07f

Browse files
committed
KVM: VMX: Move PLE grow/shrink helpers above vmx_vcpu_load()
Move VMX's {grow,shrink}_ple_window() above vmx_vcpu_load() in preparation of moving the sched_in logic, which handles shrinking the PLE window, into vmx_vcpu_load(). No functional change intended. Acked-by: Kai Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent d1ae567 commit 5d9c07f

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,38 @@ static void vmx_write_guest_kernel_gs_base(struct vcpu_vmx *vmx, u64 data)
14111411
}
14121412
#endif
14131413

1414+
static void grow_ple_window(struct kvm_vcpu *vcpu)
1415+
{
1416+
struct vcpu_vmx *vmx = to_vmx(vcpu);
1417+
unsigned int old = vmx->ple_window;
1418+
1419+
vmx->ple_window = __grow_ple_window(old, ple_window,
1420+
ple_window_grow,
1421+
ple_window_max);
1422+
1423+
if (vmx->ple_window != old) {
1424+
vmx->ple_window_dirty = true;
1425+
trace_kvm_ple_window_update(vcpu->vcpu_id,
1426+
vmx->ple_window, old);
1427+
}
1428+
}
1429+
1430+
static void shrink_ple_window(struct kvm_vcpu *vcpu)
1431+
{
1432+
struct vcpu_vmx *vmx = to_vmx(vcpu);
1433+
unsigned int old = vmx->ple_window;
1434+
1435+
vmx->ple_window = __shrink_ple_window(old, ple_window,
1436+
ple_window_shrink,
1437+
ple_window);
1438+
1439+
if (vmx->ple_window != old) {
1440+
vmx->ple_window_dirty = true;
1441+
trace_kvm_ple_window_update(vcpu->vcpu_id,
1442+
vmx->ple_window, old);
1443+
}
1444+
}
1445+
14141446
void vmx_vcpu_load_vmcs(struct kvm_vcpu *vcpu, int cpu,
14151447
struct loaded_vmcs *buddy)
14161448
{
@@ -5890,38 +5922,6 @@ int vmx_vcpu_pre_run(struct kvm_vcpu *vcpu)
58905922
return 1;
58915923
}
58925924

5893-
static void grow_ple_window(struct kvm_vcpu *vcpu)
5894-
{
5895-
struct vcpu_vmx *vmx = to_vmx(vcpu);
5896-
unsigned int old = vmx->ple_window;
5897-
5898-
vmx->ple_window = __grow_ple_window(old, ple_window,
5899-
ple_window_grow,
5900-
ple_window_max);
5901-
5902-
if (vmx->ple_window != old) {
5903-
vmx->ple_window_dirty = true;
5904-
trace_kvm_ple_window_update(vcpu->vcpu_id,
5905-
vmx->ple_window, old);
5906-
}
5907-
}
5908-
5909-
static void shrink_ple_window(struct kvm_vcpu *vcpu)
5910-
{
5911-
struct vcpu_vmx *vmx = to_vmx(vcpu);
5912-
unsigned int old = vmx->ple_window;
5913-
5914-
vmx->ple_window = __shrink_ple_window(old, ple_window,
5915-
ple_window_shrink,
5916-
ple_window);
5917-
5918-
if (vmx->ple_window != old) {
5919-
vmx->ple_window_dirty = true;
5920-
trace_kvm_ple_window_update(vcpu->vcpu_id,
5921-
vmx->ple_window, old);
5922-
}
5923-
}
5924-
59255925
/*
59265926
* Indicate a busy-waiting vcpu in spinlock. We do not enable the PAUSE
59275927
* exiting, so only get here on cpu with PAUSE-Loop-Exiting.

0 commit comments

Comments
 (0)