Cpumap types in tools (libxc and libxl) are changed to be based on bytes like in the interface to the hypervisor. To make handling easier the size of used cpumaps is always based on the number of physical cpus supported by the hypervisor. This eliminates the need to keep track of the cpumap size in external interfaces. In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu). Interfaces changed: libxl_set_vcpuaffinity() libxl_cpumap_alloc() xc_vcpu_setaffinity() xc_vcpu_getaffinity() xc_cpupool_freeinfo() Signed-off-by: juergen.gross@ts.fujitsu.com 10 files changed, 180 insertions(+), 163 deletions(-) tools/libxc/xc_cpupool.c | 59 +++++++++++++--------------------- tools/libxc/xc_domain.c | 14 ++++---- tools/libxc/xc_misc.c | 18 ++++++++++ tools/libxc/xenctrl.h | 41 ++++++++++++++++-------- tools/libxl/libxl.c | 63 ++++++++++++++++++++----------------- tools/libxl/libxl.h | 4 +- tools/libxl/libxl_utils.c | 21 +++++++----- tools/libxl/libxl_utils.h | 4 +- tools/libxl/xl_cmdimpl.c | 57 ++++++++++++++------------------- tools/python/xen/lowlevel/xc/xc.c | 62 +++++++++++++++--------------------- _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2010-Oct-28 14:25 UTC
Re: [Xen-devel] [PATCH] change tools cpumaps to uint8_t
Looks nice. Thanks for doing this.> @@ -74,27 +69,15 @@ > { > int err = 0; > xc_cpupoolinfo_t *info = NULL; > - int local_size; > - int cpumap_size; > - int size; > + size_t local_size; > DECLARE_SYSCTL; > DECLARE_HYPERCALL_BUFFER(uint8_t, local); > > - local_size = get_cpumap_size(xch); > - if (!local_size) > - { > - PERROR("Could not get number of cpus"); > - return NULL; > - } > - > - local = xc_hypercall_buffer_alloc(xch, local, local_size); > + local = xc_cpumap_hypercall_buffer_alloc(xch, local, local_size); > if ( local == NULL ) { > PERROR("Could not allocate locked memory for xc_cpupool_getinfo"); > return NULL; > }I''m not that keen on this interface change, I think get_cpumap_size + xc_hypercall_buffer_alloc was fine as it was. More importantly I really don''t like hiding the taking of the pointer on the size parameter being hidden inside the macro. [...]> info->cpupool_id = sysctl.u.cpupool_op.cpupool_id; > info->sched_id = sysctl.u.cpupool_op.sched_id; > info->n_dom = sysctl.u.cpupool_op.n_dom; > - bitmap_byte_to_64(info->cpumap, local, local_size * 8); > + bcopy(local, info->cpumap, local_size);bcopy is deprecated, should use memcpy (several times). Rest looks good, lots of magic numbers disappear ;-) Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Cpumap types in tools (libxc and libxl) are changed to be based on bytes like in the interface to the hypervisor. To make handling easier the size of used cpumaps is always based on the number of physical cpus supported by the hypervisor. This eliminates the need to keep track of the cpumap size in external interfaces. In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu). Interfaces changed: libxl_set_vcpuaffinity() libxl_cpumap_alloc() xc_vcpu_setaffinity() xc_vcpu_getaffinity() xc_cpupool_freeinfo() Signed-off-by: juergen.gross@ts.fujitsu.com 10 files changed, 190 insertions(+), 152 deletions(-) tools/libxc/xc_cpupool.c | 50 ++++++++++++++--------------- tools/libxc/xc_domain.c | 26 ++++++++++++--- tools/libxc/xc_misc.c | 15 ++++++++ tools/libxc/xenctrl.h | 40 +++++++++++++++-------- tools/libxl/libxl.c | 63 ++++++++++++++++++++----------------- tools/libxl/libxl.h | 4 +- tools/libxl/libxl_utils.c | 21 +++++++----- tools/libxl/libxl_utils.h | 4 +- tools/libxl/xl_cmdimpl.c | 57 ++++++++++++++------------------- tools/python/xen/lowlevel/xc/xc.c | 62 +++++++++++++++--------------------- _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2010-Oct-29 12:41 UTC
Re: [Xen-devel] [PATCH] change tools cpumaps to uint8_t
On Fri, 2010-10-29 at 06:56 +0100, Juergen Gross wrote:> Cpumap types in tools (libxc and libxl) are changed to be based on bytes like > in the interface to the hypervisor. > To make handling easier the size of used cpumaps is always based on the > number of physical cpus supported by the hypervisor. This eliminates the need > to keep track of the cpumap size in external interfaces. > In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu). > > Interfaces changed: > libxl_set_vcpuaffinity() > libxl_cpumap_alloc() > xc_vcpu_setaffinity() > xc_vcpu_getaffinity() > xc_cpupool_freeinfo() > > Signed-off-by: juergen.gross@ts.fujitsu.comLooks good, thanks. Acked-by: Ian Campbell <ian.campbell@citrix.com>> > > 10 files changed, 190 insertions(+), 152 deletions(-) > tools/libxc/xc_cpupool.c | 50 ++++++++++++++--------------- > tools/libxc/xc_domain.c | 26 ++++++++++++--- > tools/libxc/xc_misc.c | 15 ++++++++ > tools/libxc/xenctrl.h | 40 +++++++++++++++-------- > tools/libxl/libxl.c | 63 ++++++++++++++++++++----------------- > tools/libxl/libxl.h | 4 +- > tools/libxl/libxl_utils.c | 21 +++++++----- > tools/libxl/libxl_utils.h | 4 +- > tools/libxl/xl_cmdimpl.c | 57 ++++++++++++++------------------- > tools/python/xen/lowlevel/xc/xc.c | 62 +++++++++++++++--------------------- > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Nov-03 12:23 UTC
Re: [Xen-devel] [PATCH] change tools cpumaps to uint8_t [and 1 more messages]
Juergen Gross writes ("[Xen-devel] [PATCH] change tools cpumaps to uint8_t"):> Cpumap types in tools (libxc and libxl) are changed to be based on bytes like > in the interface to the hypervisor. > To make handling easier the size of used cpumaps is always based on the > number of physical cpus supported by the hypervisor. This eliminates the need > to keep track of the cpumap size in external interfaces. > In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu).Applied, thanks. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel