From: Keir Fraser Subject: Re: [RFC] Re: [PATCH] fix xenctl_cpumap translation to handle bitops accessed like arrays Date: Thu, 21 Dec 2006 19:51:00 +0000 Message-ID: References: <20AD633C-685E-4325-A6C1-1D81D7265C74@watson.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20AD633C-685E-4325-A6C1-1D81D7265C74@watson.ibm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jimi Xenidis , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 21/12/06 5:32 pm, "Jimi Xenidis" wrote: >> How about functions long_to_byte_bitmap(bitmap, nr_bits) and >> byte_to_long_bitmap(bitmap, nr_bits) defined in asm/bitops.h? > > hmm, as I see it we have 3 interfaces that should remain compatible. > 1) The hvcall which uses a byte array > 2) The libxc calls where 2 use uint64_t and one uses uint32_t > 3) The xm/xc.c call which constructs a python list using "C" > ordering of the uint*_t word > > so we would need similar interfaces in libxc and we would need a > byte_to_uint{64,32}(), unless you want to change the libxc interfaces > as well. I am suggesting we change just the hypervisor interface to expect a byte-oriented bitmap. So the libxc interfaces can stay as they are, but the libxc functions will need to do conversion from uint32_t/uint64_t to a byte-oriented bitmap. There is no loss of backward compatibility here for ia64 or x86 as little-endian systems do not care whether a bitmap is byte- word- or longword-oriented -- they're all identical. > I see now (I'm not that familiar with x86) that bitops in x86 are > "consistent" with "C" shifting so x86 experience no change, however > is it worth optimizing this? The way you are doing the conversion would be fine. I'm mainly aiming for a clean abstraction and formalising the concept of a 'byte-oriented bitmap' is the best way of doing this that I can see right now. -- Keir