On 5/4/21 7:10 PM, Olaf Hering wrote:
Am Tue, 4 May 2021 16:34:05 -0600
schrieb Jim Fehlig <jfehlig(a)suse.com>:
>> +static int
>> +libxlDomainSetVcpuAffinities(virDomainDef *def,
>> + libxl_ctx *ctx,
>> + libxl_domain_build_info *b_info)
>
> We should tweak the name of this function after moving it from libxl_domain.c.
> Dropping 'Domain' is probably enough, e.g. libxlSetVcpuAffinities.
Ok, can do that change.
>> + unsigned int vcpu_idx = 0;
> libvirt typically uses size_t.
Other code uses unsigned int when dealing with vcpus AFAICS, but sure I can change it.
>> + /* Will be released by libxl_domain_config_dispose */
>> + b_info->vcpu_hard_affinity = calloc(vcpu_idx, sizeof(libxl_bitmap));
> Fails syntax-check. You'll need to use g_new0.
Then syntax-check must be fixed.
You can easily fix it by adding the file to
'exclude_file_name_regexp--sc_prohibit_raw_allocation' in
build-aux/syntax-check.mk, although it's a pretty big hammer :-).
I was expecting the worst when double checking with the glib docs,
and was not disappointed. "uses its own allocator", "pair g_free with
g_new*" and the like.
Since libxl does not use glib, and since it does not provide its own allocation function
for that memory area, I decided to pair libxl's plain free() with this plain malloc().
Hence the comment.
Makes sense. As you can see in the exclude list, other areas of libvirt have
encountered the issue.
Jim