[libvirt] [PATCH 3/8] Add vcpu functions to libxl driver

Jim Fehlig jfehlig at novell.com
Mon Mar 28 22:12:36 UTC 2011


Markus Groß wrote:
> Am Mittwoch 23 März 2011 17:59:11 schrieb Jim Fehlig:
>   
>> Markus Groß wrote:
>>     
>>> +    maplen = (unsigned int) ceil((double) nvcpus / 8);
>>> +    if (VIR_ALLOC_N(bitmask, maplen) < 0) {
>>> +        virReportOOMError();
>>> +        goto cleanup;
>>> +    }
>>> +
>>> +    memset(bitmask, 0, maplen);
>>> +    for (i = 0; i < nvcpus; ++i) {
>>> +        pos = (unsigned int) floor((double) i / 8);
>>> +        bitmask[pos] |= 1 << (i % 8);
>>> +    }
>>> +
>>> +    map.size = maplen;
>>> +    map.map = bitmask;
>>>   
>>>       
>> Hmm, could this be simplified to
>>
>>     if (libxl_cpumap_alloc(&priv->ctx, &map)) {
>>         virReportOOMError()
>>         goto cleanup;
>>     }
>>     for (i = 0; i < nvcpus; i++)
>>         libxl_cpumap_set(&map, i);
>>
>>     
>
> This would be convenient, however these functions are part of libxl_utils.c/h and are not installed by xen.
> At least I found them nowhere when installing xen.
>   

Yeah, I realized this after making that comment.  There are several
useful functions in libxl_utils so I asked Ian Jackson to provide it and
he obliged

http://lists.xensource.com/archives/html/xen-devel/2011-03/msg01631.html

Doesn't help us much for now though.

Regards,
Jim




More information about the libvir-list mailing list