* [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller
@ 2019-06-07 18:05 Krish Sadhukhan
2019-06-07 18:52 ` Sean Christopherson
0 siblings, 1 reply; 3+ messages in thread
From: Krish Sadhukhan @ 2019-06-07 18:05 UTC (permalink / raw)
To: kvm; +Cc: pbonzini, rkrcmar
..as there is no need for a separate function
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
---
arch/x86/kvm/vmx/nested.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index f1a69117ac0f..4643eb3a97f7 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -1963,28 +1963,24 @@ static void prepare_vmcs02_constant_state(struct vcpu_vmx *vmx)
vmx_set_constant_host_state(vmx);
}
-static void prepare_vmcs02_early_full(struct vcpu_vmx *vmx,
- struct vmcs12 *vmcs12)
-{
- prepare_vmcs02_constant_state(vmx);
-
- vmcs_write64(VMCS_LINK_POINTER, -1ull);
-
- if (enable_vpid) {
- if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
- vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
- else
- vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
- }
-}
-
static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
{
u32 exec_control, vmcs12_exec_ctrl;
u64 guest_efer = nested_vmx_calc_efer(vmx, vmcs12);
- if (vmx->nested.dirty_vmcs12 || vmx->nested.hv_evmcs)
- prepare_vmcs02_early_full(vmx, vmcs12);
+ if (vmx->nested.dirty_vmcs12 || vmx->nested.hv_evmcs) {
+ prepare_vmcs02_constant_state(vmx);
+
+ vmcs_write64(VMCS_LINK_POINTER, -1ull);
+
+ if (enable_vpid) {
+ if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
+ vmcs_write16(VIRTUAL_PROCESSOR_ID,
+ vmx->nested.vpid02);
+ else
+ vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
+ }
+ }
/*
* PIN CONTROLS
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller
2019-06-07 18:05 [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller Krish Sadhukhan
@ 2019-06-07 18:52 ` Sean Christopherson
2019-06-09 9:38 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2019-06-07 18:52 UTC (permalink / raw)
To: Krish Sadhukhan; +Cc: kvm, pbonzini, rkrcmar
On Fri, Jun 07, 2019 at 02:05:44PM -0400, Krish Sadhukhan wrote:
> ..as there is no need for a separate function
>
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
> ---
> arch/x86/kvm/vmx/nested.c | 30 +++++++++++++-----------------
> 1 file changed, 13 insertions(+), 17 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index f1a69117ac0f..4643eb3a97f7 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1963,28 +1963,24 @@ static void prepare_vmcs02_constant_state(struct vcpu_vmx *vmx)
> vmx_set_constant_host_state(vmx);
> }
>
> -static void prepare_vmcs02_early_full(struct vcpu_vmx *vmx,
> - struct vmcs12 *vmcs12)
> -{
> - prepare_vmcs02_constant_state(vmx);
> -
> - vmcs_write64(VMCS_LINK_POINTER, -1ull);
> -
> - if (enable_vpid) {
> - if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
> - vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
> - else
> - vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
> - }
> -}
> -
> static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
> {
> u32 exec_control, vmcs12_exec_ctrl;
> u64 guest_efer = nested_vmx_calc_efer(vmx, vmcs12);
>
> - if (vmx->nested.dirty_vmcs12 || vmx->nested.hv_evmcs)
> - prepare_vmcs02_early_full(vmx, vmcs12);
> + if (vmx->nested.dirty_vmcs12 || vmx->nested.hv_evmcs) {
> + prepare_vmcs02_constant_state(vmx);
> +
> + vmcs_write64(VMCS_LINK_POINTER, -1ull);
> +
> + if (enable_vpid) {
> + if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
> + vmcs_write16(VIRTUAL_PROCESSOR_ID,
> + vmx->nested.vpid02);
> + else
> + vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
> + }
> + }
My vote is to keep the separate helper. I agree that it's a bit
superfluous, but I really like having symmetry across the "early" and
"late" prepartion flows, i.e. there's value in having both
prepare_vmcs02_full() and prepare_vmcs02_early_full().
>
> /*
> * PIN CONTROLS
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller
2019-06-07 18:52 ` Sean Christopherson
@ 2019-06-09 9:38 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2019-06-09 9:38 UTC (permalink / raw)
To: Sean Christopherson, Krish Sadhukhan; +Cc: kvm, rkrcmar
On 07/06/19 20:52, Sean Christopherson wrote:
> My vote is to keep the separate helper. I agree that it's a bit
> superfluous, but I really like having symmetry across the "early" and
> "late" prepartion flows, i.e. there's value in having both
> prepare_vmcs02_full() and prepare_vmcs02_early_full().
I agree.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-09 9:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-07 18:05 [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller Krish Sadhukhan
2019-06-07 18:52 ` Sean Christopherson
2019-06-09 9:38 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.