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

Re: [Xen-devel] [PATCH] tools/libxc: Improve efficiency of xc_cpuid_apply_policy()



On Mon, Oct 05, 2015 at 02:12:17PM +0100, Andrew Cooper wrote:
> Having the internals of xc_cpuid_policy() make hypercalls to collect domain
> information causes xc_cpuid_apply_policy() to be very inefficient.
> 
> Re-order operations to collect all information at once at the outermost layer,
> and pass a structure in to all cpuid policy generation functions.
> 
> This removes several hypercalls (4 from HVM, 3 from PV) for each of the
> up-to 108 leaves processed.
> 
> No change in the eventual policy provided, although all the information
> gathering how has (or has correct) error checking.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>

Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>

> ---
>  tools/libxc/xc_cpuid_x86.c |  245 
> +++++++++++++++++++++++++-------------------
>  1 file changed, 141 insertions(+), 104 deletions(-)
> 
> diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
> index e146a3e..715f30c 100644
> --- a/tools/libxc/xc_cpuid_x86.c
> +++ b/tools/libxc/xc_cpuid_x86.c
> @@ -33,6 +33,27 @@
>  #define DEF_MAX_INTELEXT  0x80000008u
>  #define DEF_MAX_AMDEXT    0x8000001cu
>  
> +struct cpuid_domain_info
> +{
> +    enum
> +    {
> +        VENDOR_UNKNOWN,
> +        VENDOR_INTEL,
> +        VENDOR_AMD,
> +    } vendor;
> +
> +    bool hvm;
> +    bool pvh;
> +    uint64_t xfeature_mask;
> +
> +    /* PV-only information. */
> +    bool pv64;
> +
> +    /* HVM-only infomation. */
> +    bool pae;
> +    bool nestedhvm;

I would have used union for these fields. But I don't want to bikeshed
too much on this. Definitely not a blocker for this patch. :-)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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