[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 4/7] x86/msr: add VMX MSRs into HVM_max domain policy



>>> On 18.10.17 at 10:27, <sergey.dyasli@xxxxxxxxxx> wrote:
> +static void __init calculate_hvm_max_vmx_policy(struct msr_domain_policy *dp)
> +{
> +    if ( !cpu_has_vmx )
> +        return;
> +
> +    dp->vmx.basic.raw = host_msr_domain_policy.vmx.basic.raw;
> +
> +    dp->vmx.pinbased_ctls.raw = ((uint64_t) VMX_PINBASED_CTLS_DEFAULT1 << 
> 32) |

Stray blank after cast.

> +                                            VMX_PINBASED_CTLS_DEFAULT1;
> +    vmx_host_allowed_cpyb(dp, vmx, pinbased_ctls, ext_intr_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, pinbased_ctls, nmi_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, pinbased_ctls, preempt_timer);
> +
> +    dp->vmx.procbased_ctls.raw =
> +        ((uint64_t) VMX_PROCBASED_CTLS_DEFAULT1 << 32) |

Again.

> +                    VMX_PROCBASED_CTLS_DEFAULT1;
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, virtual_intr_pending);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, use_tsc_offseting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, hlt_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, invlpg_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, mwait_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, rdpmc_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, rdtsc_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, cr8_load_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, cr8_store_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, tpr_shadow);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, virtual_nmi_pending);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, mov_dr_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, uncond_io_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, activate_io_bitmap);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, monitor_trap_flag);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, activate_msr_bitmap);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, monitor_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, pause_exiting);
> +    vmx_host_allowed_cpyb(dp, vmx, procbased_ctls, 
> activate_secondary_controls);

This looks pretty ugly and hard to maintain to me. Wouldn't it be
possible to have static const instances of the structures describing
which fields should come from where, allowing simple & and | to
be done on the raw fields instead. I understand we won't get
away without listing the individual bits, but the overhead here is
far higher than if there was a simple initializer line for each field.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.