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

Re: [libvirt] [PATCH] xen: work with ia64 MAX_VIRT_CPUS of 64



On Fri, Oct 29, 2010 at 11:19:50AM -0600, Eric Blake wrote:
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index 974e96b..614c036 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -5770,10 +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.  */
> -    verify(MAX_VIRT_CPUS <= sizeof(1U) * CHAR_BIT);
> +    /* 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);

This chunk causes a compile error for me

  CC     libvirt_driver_xen_la-xend_internal.lo
cc1: warnings being treated as errors
xen/xend_internal.c: In function 'xenDaemonFormatSxpr':
xen/xend_internal.c:5775: error: nested extern declaration of 'verify_function2' [-Wnested-externs]
make[3]: *** [libvirt_driver_xen_la-xend_internal.lo] Error 1


Also, what was commited, looks different to this diff here

@@ -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);

eg, main GIT repo didn't have any existing use of 'verify' removed,
whereas your patch did ?!?!?


> diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
> index f80e252..6c5df0f 100644
> --- a/src/xen/xm_internal.c
> +++ b/src/xen/xm_internal.c
> @@ -2336,10 +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 32.  */
> -    verify(MAX_VIRT_CPUS <= sizeof(1U) * CHAR_BIT);
> +    /* 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) &&

The same with this chunk


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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