[PATCH v1 4/4] libxl: set vcpu affinity during domain creation

Olaf Hering olaf at aepfle.de
Wed May 5 01:10:25 UTC 2021

Am Tue, 4 May 2021 16:34:05 -0600
schrieb Jim Fehlig <jfehlig at 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.

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210505/2cac6254/attachment-0001.sig>

More information about the libvir-list mailing list