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

Re: [Xen-devel] [PATCH v12 2/5] xl: move away from the use of cpumap for hard affinity



On Tue, 2014-07-22 at 17:45 +0200, Dario Faggioli wrote:
[...]
> @@ -827,15 +826,31 @@ static void parse_config_data(const char *config_source,
>          libxl_defbool_set(&b_info->numa_placement, false);
>      }
>      else if (!xlu_cfg_get_string (config, "cpus", &buf, 0)) {
> -        if (libxl_cpu_bitmap_alloc(ctx, &b_info->cpumap, 0)) {
> -            fprintf(stderr, "Unable to allocate cpumap\n");
> +        b_info->vcpu_hard_affinity =
> +            xmalloc(b_info->max_vcpus * sizeof(libxl_bitmap));
> +
> +        libxl_bitmap_init(&b_info->vcpu_hard_affinity[0]);
> +        if (libxl_cpu_bitmap_alloc(ctx,
> +                                   &b_info->vcpu_hard_affinity[0], 0)) {
> +            fprintf(stderr, "Unable to allocate cpumap for vcpu 0\n");
>              exit(1);
>          }
>  
> -        libxl_bitmap_set_none(&b_info->cpumap);
> -        if (vcpupin_parse(buf, &b_info->cpumap))
> +        if (vcpupin_parse(buf, &b_info->vcpu_hard_affinity[0]))
>              exit(1);
>  
> +        for (i = 1; i < b_info->max_vcpus; i++) {
> +            libxl_bitmap_init(&b_info->vcpu_hard_affinity[i]);
> +            if (libxl_cpu_bitmap_alloc(ctx,
> +                                       &b_info->vcpu_hard_affinity[i], 0)) {
> +                fprintf(stderr, "Unable to allocate cpumap for vcpu %d\n", 
> i);
> +                exit(1);
> +            }
> +            libxl_bitmap_copy(ctx, &b_info->vcpu_hard_affinity[i],
> +                              &b_info->vcpu_hard_affinity[0]);
> +        }
> +        b_info->num_vcpu_hard_affinity = num_cpus;

In all the other loops etc you use b_info->max_vcpus and AFAICT num_cpus
is only initialised if the xlu_cfg_get_list succeeded, which it can't
have done if we ended up in this else branch.

Other than looks good to me.

Ian.


_______________________________________________
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®.