[libvirt] [Xen-devel] [PATCH] libxl: use LIBXL_API_VERSION 0x040200

Dario Faggioli dario.faggioli at citrix.com
Thu Apr 14 12:55:57 UTC 2016


On Thu, 2016-04-14 at 09:33 +0100, George Dunlap wrote:
> On Thu, Apr 14, 2016 at 12:37 AM, Jim Fehlig <jfehlig at suse.com>
> wrote:
>> > diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
> > index 3c0eafb..24e2911 100644
> > --- a/src/libxl/libxl_conf.h
> > +++ b/src/libxl/libxl_conf.h
> > @@ -69,18 +69,6 @@
> >  # endif
> > 
> > 
> > -/* libxl interface for setting VCPU affinity changed in 4.5. In
> > fact, a new
> > - * parameter has been added, representative of 'VCPU soft
> > affinity'. If one
> > - * does not care about it (and that's libvirt case), passing NULL
> > is the
> > - * right thing to do. To mark that change,
> > LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
> > - * is defined. */
> > -# ifdef LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
> > -#  define libxl_set_vcpuaffinity(ctx, domid, vcpuid, map) \
> > -    libxl_set_vcpuaffinity((ctx), (domid), (vcpuid), (map), NULL)
> > -#  define libxl_set_vcpuaffinity_all(ctx, domid, max_vcpus, map) \
> > -    libxl_set_vcpuaffinity_all((ctx), (domid), (max_vcpus), (map),
> > NULL)
> > -# endif
> Just checking with this -- the LIBXL_API_VERSION is meant for
> *forward* compatibility, but I think the LIBXL_HAVE_* macros are for
> *backwards* compatibility, isn't that right?  If you compile this
> against an older version of Xen without LIBXL_HAVE_VCPU_SOFT_AFFINITY
> (say, 4.4), will it break with this patch?
> 
Err... I'm not good at this things, but I don't think it will break.

So, libxl_set_vcpuaffinity(ctx,d,v,map,map) was defined in Xen 4.5. Xen
4.4 only has libxl_set_vcpuaffinity(ctx,d,v,map).

Libvirt only uses libxl_set_vcpuaffinity(ctx,d,v,map) (i.e., the
latter == the older one).

On anything below Xen 4.5 --which also means
LIBXL_HAVE_VCPU_SOFT_AFFINITY is not defined-- the variant with only
one map parameter is available, and therefore things should build and
work.

For anything above Xen 4.5 _and_ with LIBXL_API_VERSION<4.5 (which
would be the case, with this patch), libxl.h provides the stub for the
variant with only one map argument, so everything should again be fine.

Or am I missing something?

Perhaps, the point is that the hunk being removed above should really
have been using LIBXL_API_VERSION already, rather than
LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY.

But, at the time, as far as I can recall, libvirt was not setting
LIBXL_API_VERSION to anything, and doing that was not considered
necessary. Therefore I did use LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY for
the check, which is always present, starting from Xen 4.5 (or never
present, before that).

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160414/eecd2423/attachment-0001.sig>


More information about the libvir-list mailing list