mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
xen: work with ia64 MAX_VIRT_CPUS of 64
* src/xen/xen_hypervisor.c (MAX_VIRT_CPUS): Move... * src/xen/xen_driver.h (MAX_VIRT_CPUS): ...so all xen code can see same value. * src/xen/xend_internal.c (sexpr_to_xend_domain_info) (xenDaemonDomainGetVcpusFlags, xenDaemonParseSxpr) (xenDaemonFormatSxpr): Work if MAX_VIRT_CPUS is 64 on a platform where long is 64-bits. * src/xen/xm_internal.c (xenXMDomainConfigParse) (xenXMDomainConfigFormat): Likewise.
This commit is contained in:
parent
2f88770b44
commit
dc27e089bf
@ -29,6 +29,14 @@
|
||||
# include <winsock2.h>
|
||||
# endif
|
||||
|
||||
/* xen-unstable changeset 19788 removed MAX_VIRT_CPUS from public
|
||||
* headers. Its semantic was retained with XEN_LEGACY_MAX_VCPUS.
|
||||
* Ensure MAX_VIRT_CPUS is defined accordingly.
|
||||
*/
|
||||
# if !defined(MAX_VIRT_CPUS) && defined(XEN_LEGACY_MAX_VCPUS)
|
||||
# define MAX_VIRT_CPUS XEN_LEGACY_MAX_VCPUS
|
||||
# endif
|
||||
|
||||
extern int xenRegister (void);
|
||||
|
||||
# define XEN_UNIFIED_HYPERVISOR_OFFSET 0
|
||||
|
@ -109,14 +109,6 @@ typedef privcmd_hypercall_t hypercall_t;
|
||||
# define SYS_IFACE_MIN_VERS_NUMA 4
|
||||
#endif
|
||||
|
||||
/* xen-unstable changeset 19788 removed MAX_VIRT_CPUS from public
|
||||
* headers. Its semanitc was retained with XEN_LEGACY_MAX_VCPUS.
|
||||
* Ensure MAX_VIRT_CPUS is defined accordingly.
|
||||
*/
|
||||
#if !defined(MAX_VIRT_CPUS) && defined(XEN_LEGACY_MAX_VCPUS)
|
||||
# define MAX_VIRT_CPUS XEN_LEGACY_MAX_VCPUS
|
||||
#endif
|
||||
|
||||
static int xen_ioctl_hypercall_cmd = 0;
|
||||
static int initialized = 0;
|
||||
static int in_init = 0;
|
||||
|
@ -2192,7 +2192,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
|
||||
}
|
||||
|
||||
def->maxvcpus = sexpr_int(root, "domain/vcpus");
|
||||
def->vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
|
||||
def->vcpus = count_one_bits_l(sexpr_u64(root, "domain/vcpu_avail"));
|
||||
if (!def->vcpus || def->maxvcpus < def->vcpus)
|
||||
def->vcpus = def->maxvcpus;
|
||||
|
||||
@ -2468,7 +2468,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
|
||||
}
|
||||
info->cpuTime = sexpr_float(root, "domain/cpu_time") * 1000000000;
|
||||
vcpus = sexpr_int(root, "domain/vcpus");
|
||||
info->nrVirtCpu = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
|
||||
info->nrVirtCpu = count_one_bits_l(sexpr_u64(root, "domain/vcpu_avail"));
|
||||
if (!info->nrVirtCpu || vcpus < info->nrVirtCpu)
|
||||
info->nrVirtCpu = vcpus;
|
||||
|
||||
@ -3706,7 +3706,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
|
||||
ret = sexpr_int(root, "domain/vcpus");
|
||||
if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
int vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
|
||||
int vcpus = count_one_bits_l(sexpr_u64(root, "domain/vcpu_avail"));
|
||||
if (vcpus)
|
||||
ret = MIN(vcpus, ret);
|
||||
}
|
||||
@ -5770,9 +5770,11 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
||||
virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)",
|
||||
def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
|
||||
virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus);
|
||||
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */
|
||||
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
|
||||
either 32, or 64 on a platform where long is big enough. */
|
||||
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||
if (def->vcpus < def->maxvcpus)
|
||||
virBufferVSprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1);
|
||||
virBufferVSprintf(&buf, "(vcpu_avail %lu)", (1UL << def->vcpus) - 1);
|
||||
|
||||
if (def->cpumask) {
|
||||
char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
|
||||
@ -5869,8 +5871,8 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
||||
|
||||
virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus);
|
||||
if (def->vcpus < def->maxvcpus)
|
||||
virBufferVSprintf(&buf, "(vcpu_avail %u)",
|
||||
(1U << def->vcpus) - 1);
|
||||
virBufferVSprintf(&buf, "(vcpu_avail %lu)",
|
||||
(1UL << def->vcpus) - 1);
|
||||
|
||||
for (i = 0 ; i < def->os.nBootDevs ; i++) {
|
||||
switch (def->os.bootDevs[i]) {
|
||||
|
@ -776,7 +776,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
|
||||
def->maxvcpus = count;
|
||||
if (xenXMConfigGetULong(conf, "vcpu_avail", &count, -1) < 0)
|
||||
goto cleanup;
|
||||
def->vcpus = MIN(count_one_bits(count), def->maxvcpus);
|
||||
def->vcpus = MIN(count_one_bits_l(count), def->maxvcpus);
|
||||
|
||||
if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
|
||||
goto cleanup;
|
||||
@ -2336,8 +2336,11 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
||||
|
||||
if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
|
||||
goto no_memory;
|
||||
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
|
||||
either 32, or 64 on a platform where long is big enough. */
|
||||
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
|
||||
if (def->vcpus < def->maxvcpus &&
|
||||
xenXMConfigSetInt(conf, "vcpu_avail", (1U << def->vcpus) - 1) < 0)
|
||||
xenXMConfigSetInt(conf, "vcpu_avail", (1UL << def->vcpus) - 1) < 0)
|
||||
goto no_memory;
|
||||
|
||||
if ((def->cpumask != NULL) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user