[Libvir] [PATCH] BZ#251641: Allow to change the cpu pinning for inactive domain

Daniel Veillard veillard at redhat.com
Mon Nov 26 15:17:41 UTC 2007

On Mon, Nov 26, 2007 at 11:12:29AM +0900, Saori Fukuta wrote:
> Hi,
> I want to change the cpu pinning for inactive domain on RHEL-5.1.
> So, I just add the xenXMDomainPinVcpu to xm_internal.c.
> We will be allowed to change "cpus" parameter in configuration file
> with "vcpupin" command by this patch, like "setmem" or "setvcpus".
> There is 2 things to note:
>   - This is an effective feature for inactive domain with
>     Xen3.0.3 (less than 3 of xendConfigVersion).
>   - On the above environment, the number which specified as 
>     <vcpu> is ignored, because the virtual CPUs is not present 
>     when domain is shut off. So, when executing "vcpupin" command
>     with this option
>        # virsh vcpupin Guest 0 1
>     "0"(vcpu) is ignored and "1"(cpulist) is set to configuration file
>     as "cpus".
>        # cat /etc/xen/Guest | grep cpus
>        cpus = "1"

  Hi Saori,

thanks for looking at this, I think this could be fixed but
there is just a couple of things i feel a bit uneasy with the patch:
  - they work with arrays allocated on the stack of fixed
    dimention (and rather big), i would rather see a dynamic
    allocation of the array to a more reasonnable size and
    growing them dynamically
  - the repeted use of strcat on each cpu pinning found makes
    it a quadratic algorithm though it could really be linear
    if one kept a pointer to the current end of the buffer
  - the ranges variable is defined in the middle of the function,
    this may look notmal in C++ but this is against the conventions
    in libvirt C code.

 I think the code should be reworked a bit around those lines, but
I have no doubt we can quickly get to a fix in libvirt,

  thanks !


Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

More information about the libvir-list mailing list