|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v8 1/7] x86/domctl: generalize the restore of vMCE parameters
>>> Haozhong Zhang <haozhong.zhang@xxxxxxxxx> 07/10/17 4:53 AM >>>
>--- a/xen/arch/x86/domctl.c
>+++ b/xen/arch/x86/domctl.c
>@@ -302,6 +302,42 @@ static int update_domain_cpuid_info(struct domain *d,
>return 0;
>}
>
>+static int vcpu_set_vmce(struct vcpu *v,
>+ const struct xen_domctl_ext_vcpucontext *evc)
>+{
>+ /*
>+ * Sizes of vMCE parameters used by the current and past versions
>+ * of Xen in descending order. If vMCE parameters are extended,
>+ * remember to add the old size to this array by VMCE_SIZE().
>+ */
>+#define VMCE_SIZE(param) \
I dislike macro (or function) parameter to be named "param" or alike. Please
use names that say what they stand for, e.g. "field" here.
>+ (offsetof(typeof(evc->vmce), param) + sizeof(evc->vmce.param))
>+
>+ static const unsigned int valid_sizes[] = {
>+ sizeof(evc->vmce),
>+ VMCE_SIZE(caps),
>+ };
>+#undef VMCE_SIZE
>+
>+ struct hvm_vmce_vcpu vmce = { };
>+ unsigned int evc_vmce_size = evc->size - offsetof(typeof(*evc), mcg_cap);
I'd prefer for this to be put in a min(..., sizeof(evc->vmce)) to cope with
possible future additions of members after the vmce one.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |