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

[Xen-users] Possible VCPU hotplug bug


  • To: xen-users@xxxxxxxxxxxxxxxxxxx
  • From: "Gabriel Southern" <gsouther@xxxxxxx>
  • Date: Sun, 10 Feb 2008 00:08:53 -0500
  • Delivery-date: Sat, 09 Feb 2008 21:09:27 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=tm2EwAL9Aay5bz2c1d4hpI1EHmHz1CpJalMJlZru10yuKy8wdroaQ0pRVbUq7l7FTDJo4UKiFpAgWlWphDAo7fSo9F6BXRB+Cqo9E/mpVX9KgUQwd+QY510yuLTfxaCmJ2QdQolZ6FIrkOqK1S0ljA2lUHVpMKNf8DWj3Fxb9eg=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

I am working on a project that uses OpenMP along with Xen's VCPU
hotplug feature.  The OpenMP libraries are used for writing
multi-threaded applications, and they have a function named
omp_get_num_procs() that is used to determine the number of processors
available on the system.  I noticed that when using the xm vcpu-set
command in Xen to change the number of vcpus assigned to a domU that
that omp_get_num_procs() still returns the original value.

In trying to determine the cause of this problem, I found that the
implementation of omp_get_num_procs() is simply calling the
sysconf(_SC_NPROCESSORS_ONLN) function, which is in <unistd.h>.  I
looked at the implementation of sysconf and it appears that it is
parsing the /proc/stat file to count the number of cpus that are
online.  However, the /proc/stat file is not being updated correctly,
which I think is a bug.

To test this I executed the following program:
---------------------------
#include <stdio.h>
#include <unistd.h>

int main()
{
        int num_procs_onln = 0;
        num_procs_onln = sysconf(_SC_NPROCESSORS_ONLN);
        printf("Number of online processors is: %d\n",num_procs_onln);
        return 0;
}
-----------------------------

This program always reported the number of vcpus that the system was
booted with rather than its current configuration.  For example if I
booted my system with vcpus = '6', and then executed xm vcpu-set
xen-vm 4 , to change the number of vcpus to 4 the program still
reported 6 processors.  I also saw that /proc/cpuinfo would only show
4 processors, but that /proc/stat would still list 6.  I think that
/proc/stat should be updated to 4, but I could not figure out why this
was not happening.

If anyone else can test this for me and confirm if they experience the
same problem it would be helpful. Also please let me know if this
should be filed as a bug.  I am using Ubuntu 7.10 with Xen 3.2, I am
not sure if this would be a Linux kernel bug or a Xen bug.

Thanks,

-Gabriel

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.