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

Re: [Xen-devel] [PATCH v3 1/3] libxl/cpumap: Add xc_cpumap_[setcpu, clearcpu, testcpu] to complement xc_cpumap_alloc.



On Tue, 2015-03-24 at 16:29 -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Mar 24, 2015 at 05:46:04PM +0000, Ian Campbell wrote:
> > Is it necessary to worry about alignment here, since xc_cpumap_t is
> > actually a uint8_t*.
>
> We can also do and not worry about it:
>
> diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
> index 7514b84..19a1b18 100644
> --- a/tools/libxc/xc_misc.c
> +++ b/tools/libxc/xc_misc.c
> @@ -94,19 +94,22 @@ xc_cpumap_t xc_cpumap_alloc(xc_interface *xch)
>      return calloc(1, sz);
>  }
>  
> +#define BITS_PER_CPUMAP(map) (sizeof(*map) * 8)
> +#define CPUMAP_ENTRY(cpu, map) ((map))[(cpu) / BITS_PER_CPUMAP(map)]
> +#define CPUMAP_SHIFT(cpu, map) ((cpu) % BITS_PER_CPUMAP(map))
>
> [...]
>
Maybe it's only me, but I really find it a bit hard to figure out what
the differences between this and what's in xc_bitops.h are.

If going for this, I'd say that the reasons why we need these, and such
differences between these and BITMAP_* should be made evident somehow
(changelog, comments, etc.).

Regards,
Dario

Attachment: signature.asc
Description: This is a digitally signed message part

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