[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.5 1/2] xen/domctl: Fix getdomaininfo() of a domain without vcpus
In the case that a domain has not got any vcpus, getdomaininfo() leaves info->max_vcpu_id uninitialised, which causes a problem for toolstacks. Unfortunately, setting it to 0 as a default is not appropriate. A max_vcpu_id of 0 and nr_online_cpus of 0 is the valid state for a single vcpu domain which is in the process of being destroyed. As all components are required to add 1 to max_vcpu_id to get the number of vcpus, an id of ~0U is not valid to be used. Explicitly define this as an invalid max vcpu value, and use it to express "no vcpus" in getdomaininfo() Reported-by: Euan Harris <euan.harris@xxxxxxxxxx> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Keir Fraser <keir@xxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/common/domctl.c | 1 + xen/include/public/domctl.h | 1 + 2 files changed, 2 insertions(+) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index b6f9708..d9c2635 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -156,6 +156,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info) struct vcpu_runstate_info runstate; info->domain = d->domain_id; + info->max_vcpu_id = XEN_INVALID_MAX_VCPU_ID; info->nr_online_vcpus = 0; info->ssidref = 0; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index f519524..58b19e7 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -108,6 +108,7 @@ struct xen_domctl_getdomaininfo { uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */ uint64_aligned_t cpu_time; uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ +#define XEN_INVALID_MAX_VCPU_ID (~0U) /* Domain has no vcpus? */ uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */ uint32_t ssidref; xen_domain_handle_t handle; -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |