|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 10/13] x86/domctl: Implement XEN_DOMCTL_get_cpumsr_policy
On Tue, 2018-07-03 at 21:55 +0100, Andrew Cooper wrote:
> From: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx>
>
> This finally (after literally years of work!) marks the point where the
> toolstack can ask the hypervisor for the current CPUID configuration of a
> specific domain.
>
> Also extend xen-cpuid's --policy mode to be able to take a domid and dump a
> specific domains CPUID and MSR policy.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx>
> ---
>
> diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
> index a5b3004..52a3694 100644
> --- a/tools/misc/xen-cpuid.c
> +++ b/tools/misc/xen-cpuid.c
...
> @@ -407,17 +434,36 @@ int main(int argc, char **argv)
> if ( !msrs )
> err(1, "calloc(max_msrs)");
>
> - for ( pol = 0; pol < ARRAY_SIZE(sys_policies); ++pol )
> + if ( domid != -1 )
> {
> + char name[20];
> uint32_t nr_leaves = max_leaves;
> uint32_t nr_msrs = max_msrs;
>
> - if ( xc_get_system_cpumsr_policy(xch, pol, &nr_leaves, leaves,
> + if ( xc_get_domain_cpumsr_policy(xch, domid, &nr_leaves, leaves,
> &nr_msrs, msrs) )
> - err(1, "xc_get_system_cpumsr_policy(, %s,,)",
> - sys_policies[pol]);
> + err(1, "xc_get_domain_cpuid_policy(, %d, %d,, %d,)",
^^^^^
This wants to be "cpumsr" for consistency.
> + domid, nr_leaves, nr_msrs);
>
> - print_policy(sys_policies[pol], leaves, nr_leaves, msrs,
> nr_msrs);
> + snprintf(name, sizeof(name), "Domain %d", domid);
> + print_policy(name, leaves, nr_leaves, msrs, nr_msrs);
> + }
> + else
> + {
> + /* Get system policies */
> + for ( pol = 0; pol < ARRAY_SIZE(sys_policies); ++pol )
> + {
> + uint32_t nr_leaves = max_leaves;
> + uint32_t nr_msrs = max_msrs;
> +
> + if ( xc_get_system_cpumsr_policy(xch, pol, &nr_leaves,
> leaves,
> + &nr_msrs, msrs) )
> + err(1, "xc_get_system_cpumsr_policy(, %s,,)",
> + sys_policies[pol]);
> +
> + print_policy(sys_policies[pol], leaves, nr_leaves,
> + msrs, nr_msrs);
> + }
> }
>
> free(leaves);
>
--
Thanks,
Sergey
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |