WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel][PATCH] libxc bitmap utils and vcpu-affinity

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel][PATCH] libxc bitmap utils and vcpu-affinity
From: Dulloor <dulloor@xxxxxxxxx>
Date: Tue, 30 Mar 2010 12:05:37 -0400
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Tue, 30 Mar 2010 09:07:08 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=x58VRICDqBKtLaWBg8svoQwwhR0aigKh79vW6J/BYIk=; b=NUGLyub/JNZ2DzeIqHm/mjvw4C6ldb+KhUTZPFNxL11+M57LM+wfWck94zMoJCMn+T N39vswEeFTjTaY0gF+b4C8JhZGS7GHSe5H6gsJKEihymeCz/l+9A0BYC7a44eGcQdcAH 1Ypf0Q9e27jXx7mJ8fpVolhgcWtFVCDlQCgik=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=S+areULzWg81fAjFiFDu0zWODFXGhXWJsHmNS8aYp6xvxqAnN46bx+5+YNMwAvUbJr Wg7oCiedKJy7PVf8hKb0iVt556sfznkGWPUqTBL6iIpiRRTFkmKQwEzg8Q3oXCiUliyI 40UyeHpKsYupOw7y09BikHNOQk5fpJGQfJe58=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C7D7D456.F136%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <940bcfd21003300742s28db15dbm9bf3316f8625f180@xxxxxxxxxxxxxx> <C7D7D456.F136%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> No changeset comment. No signed-off-by line.
Sorry, I forgot. Will do once we finalize on the patch.

> It actually bloats the libraries by a net 650 LOC
> (747 added, 87 deleted according to diffstat).
In the patch, we have used the library only for vcpu get/set affinity.
There are clearly other opportunities (right now and in future) to use
most of the functions provided by the library, which will offset this.
Also, this provides a cleaner/standard way of using the cpumap
structure in libxc.

> And below I append the very first function I read: it doesn't inspire
> confidence that the implementation is over-complicated/long and
> unnecessarily handles 16-bit values.
I guess you mean 8-bit values. The library works with byte-based
bitmap structures, instead of "uint32_t or uint64_t" bitmap
structures, so that we don't need to convert when using the
bitmap-library with xenctl_cpumap. Please let know if you would rather
that we keep the bitmap utilities separate from xenctl_cpumap and
provide for conversion functions. That would be a small change.

The function that you quote is inspired from linux kernel
implementation (as mentioned) and is a simple generic function. And I
have tested the library thoroughly.

> Why should I show your patch some love?
We can work towards that ;)

-dulloor

On Tue, Mar 30, 2010 at 11:16 AM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
> No changeset comment. No signed-off-by line. It actually bloats the
> libraries by a net 650 LOC (747 added, 87 deleted according to diffstat).
> And below I append the very first function I read: it doesn't inspire
> confidence that the implementation is over-complicated/long and
> unnecessarily handles 16-bit values. Why should I show your patch some love?
>
>  -- Keir
>
> +static inline int __xc_ffs(uint8_t byte)
> +{
> +       int num = 0;
> +
> +       if ((byte & 0xff) == 0) {
> +               num += 8;
> +               byte >>= 8;
> +       }
> +       if ((byte & 0xf) == 0) {
> +               num += 4;
> +               byte >>= 4;
> +       }
> +       if ((byte & 0x3) == 0) {
> +               num += 2;
> +               byte >>= 2;
> +       }
> +       if ((byte & 0x1) == 0)
> +               num += 1;
> +       return num;
> +}
>
> On 30/03/2010 15:42, "Dulloor" <dulloor@xxxxxxxxx> wrote:
>
>> Resubmitting the patch.
>>
>> -dulloor
>>
>> ---------- Forwarded message ----------
>> From: Dulloor <dulloor@xxxxxxxxx>
>> Date: Tue, Mar 23, 2010 at 12:55 PM
>> Subject: Re: [Xen-devel][PATCH] libxc bitmap utils and vcpu-affinity
>> To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
>> Cc: Jan Beulich <JBeulich@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx"
>> <xen-devel@xxxxxxxxxxxxxxxxxxx>
>>
>>
>> Please use this patch, in which length of bitmap is
>> (physinfo.max_cpu_id+1), rather than (physinfo.nr_cpus).
>>
>> -dulloor
>>
>> On Tue, Mar 23, 2010 at 12:41 PM, Dulloor <dulloor@xxxxxxxxx> wrote:
>>> I meant utils for **xenctl_cpumap**
>>>
>>> On Tue, Mar 23, 2010 at 12:40 PM, Dulloor <dulloor@xxxxxxxxx> wrote:
>>>> Fine, I agree with you both. Attached is a patch adding utils for
>>>> xenctl_bitmap (to libxc) and using the same in vcpu_(get|set)affinity.
>>>> For the guest-numa interface, I will see if I can use xenctl_cpumap.
>>>>
>>>> -dulloor
>>>>
>>>> On Tue, Mar 23, 2010 at 7:05 AM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
>>>> wrote:
>>>>> On 23/03/2010 10:10, "Jan Beulich" <JBeulich@xxxxxxxxxx> wrote:
>>>>>
>>>>>>>>> Dulloor <dulloor@xxxxxxxxx> 22.03.10 18:44 >>>
>>>>>>> Motivation for using xenctl_cpumask in Xen interfaces :
>>>>>>> - xenctl_cpumap is just 4 bytes smaller than static xenctl_cpumask for
>>>>>>> 128 cpus (128 would be good for quite some time). However, the new
>>>>>>
>>>>>> I don't buy this (we're already building for 256 CPUs, looking forward
>>>>>> to further bump this in the not too distant future), and I'm generally
>>>>>> opposed to introducing hard coded limits in a public interface.
>>>>>
>>>>> We should use xenctl_cpumask everywhere for specifying physical CPU
>>>>> bitmaps,
>>>>> even into guest NUMA interfaces if appropriate. I don't really care if it
>>>>> is
>>>>> a bit harder to use than a static bitmap.
>>>>>
>>>>>  -- Keir
>>>>>
>>>>>
>>>>>
>>>>
>>>
>
>
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel